From 1d5ec407b8642ed22e5bfd66307cadfdfe9ba02b Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Sun, 2 Nov 2025 19:50:28 +0000 Subject: [PATCH] Auto commit: 2025-11-02T19:50:28.947Z --- add_member.php | 54 ++++++++++++++ assets/css/custom.css | 79 ++++++++++++++++++++ db/setup.php | 33 +++++++++ includes/footer.php | 45 +++++++++++ includes/header.php | 47 ++++++++++++ index.php | 169 ++++++------------------------------------ team.php | 109 +++++++++++++++++++++++++++ 7 files changed, 388 insertions(+), 148 deletions(-) create mode 100644 add_member.php create mode 100644 assets/css/custom.css create mode 100644 db/setup.php create mode 100644 includes/footer.php create mode 100644 includes/header.php create mode 100644 team.php diff --git a/add_member.php b/add_member.php new file mode 100644 index 0000000..f567efd --- /dev/null +++ b/add_member.php @@ -0,0 +1,54 @@ +prepare("SELECT id FROM team_members WHERE email = :email"); + $stmt->bindParam(':email', $email); + $stmt->execute(); + + if ($stmt->fetch()) { + $message = 'A member with this email address already exists.'; + } else { + // Insert new member + $sql = "INSERT INTO team_members (name, email, role) VALUES (:name, :email, :role)"; + $stmt = $db->prepare($sql); + $stmt->bindParam(':name', $name); + $stmt->bindParam(':email', $email); + $stmt->bindParam(':role', $role); + + if ($stmt->execute()) { + $status = 'success'; + $message = 'New team member added successfully!'; + } else { + $message = 'Failed to add new member. Please try again.'; + } + } + } catch (PDOException $e) { + // In a real app, log the error instead of showing it to the user + // error_log($e->getMessage()); + $message = 'Database error. Could not add member.'; + } + } +} else { + $message = 'Invalid request method.'; +} + +header('Location: team.php?status=' . $status . '&msg=' . urlencode($message)); +exit(); diff --git a/assets/css/custom.css b/assets/css/custom.css new file mode 100644 index 0000000..7fa6c93 --- /dev/null +++ b/assets/css/custom.css @@ -0,0 +1,79 @@ +/* + * Custom Styles for TEST-CRM-APLIKACIJA + * Palette: + * Primary: #3B82F6 + * Secondary: #6B7280 + * Background: #F9FAFB + * Surface/Card: #FFFFFF + */ + +@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap'); + +body { + font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; + background-color: #F9FAFB; + color: #374151; /* Gray 700 */ +} + +.navbar { + background-color: #FFFFFF; + border-bottom: 1px solid #E5E7EB; /* Gray 200 */ +} + +.btn-primary { + background-color: #3B82F6; + border-color: #3B82F6; + font-weight: 500; +} + +.btn-primary:hover { + background-color: #2563EB; + border-color: #2563EB; +} + +.card { + border: 1px solid #E5E7EB; /* Gray 200 */ + border-radius: 0.5rem; /* rounded-lg */ + box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px 0 rgba(0, 0, 0, 0.06); +} + +.table { + background-color: #FFFFFF; +} + +.table thead th { + border-bottom-width: 1px; + border-color: #E5E7EB; /* Gray 200 */ + font-weight: 600; + color: #4B5563; /* Gray 600 */ + text-transform: uppercase; + letter-spacing: 0.05em; + font-size: 0.75rem; +} + +.badge { + font-weight: 500; + font-size: 0.75rem; + padding: 0.3em 0.6em; +} + +.modal-content { + border-radius: 0.5rem; + border: none; +} + +.form-label { + font-weight: 500; + color: #374151; /* Gray 700 */ +} + +.toast { + width: 350px; + max-width: 100%; + font-size: .875rem; + background-color: rgba(255,255,255,.85); + background-clip: padding-box; + border: 1px solid rgba(0,0,0,.1); + box-shadow: 0 0.5rem 1rem rgba(0,0,0,.15); + border-radius: .25rem; +} diff --git a/db/setup.php b/db/setup.php new file mode 100644 index 0000000..4957fca --- /dev/null +++ b/db/setup.php @@ -0,0 +1,33 @@ +exec($sql); + echo "Table 'team_members' created successfully (if it didn't exist).
"; + + // Optional: Seed with some data + $stmt = $db->query("SELECT COUNT(*) FROM team_members"); + if ($stmt->fetchColumn() == 0) { + $seed_sql = " + INSERT INTO `team_members` (name, email, role, status) VALUES + ('John Doe', 'john.doe@example.com', 'Admin', 'active'), + ('Jane Smith', 'jane.smith@example.com', 'Project Manager', 'active'), + ('Peter Jones', 'peter.jones@example.com', 'Team Member', 'inactive'); + "; + $db->exec($seed_sql); + echo "Seeded 'team_members' table with initial data.
"; + } + +} catch (PDOException $e) { + die("DB setup failed: " . $e->getMessage()); +} diff --git a/includes/footer.php b/includes/footer.php new file mode 100644 index 0000000..d261d7c --- /dev/null +++ b/includes/footer.php @@ -0,0 +1,45 @@ + + + +
+ +
+ + + + + + + diff --git a/includes/header.php b/includes/header.php new file mode 100644 index 0000000..9190c24 --- /dev/null +++ b/includes/header.php @@ -0,0 +1,47 @@ + + + + + + + TEST-CRM-APLIKACIJA + + + + + + + + + + + + + + + + + + + +
diff --git a/index.php b/index.php index 7205f3d..e602f5b 100644 --- a/index.php +++ b/index.php @@ -1,150 +1,23 @@ - -$phpVersion = PHP_VERSION; -$now = date('Y-m-d H:i:s'); -?> - - - - - - New Style - - - - - - - - - - - - - - - - - - - - - -
-
-

Analyzing your requirements and generating your website…

-
- Loading… -
-

AI is collecting your requirements and applying the first changes.

-

This page will update automatically as the plan is implemented.

-

Runtime: PHP — UTC

+
+

Welcome to your CRM

+
+

This is the starting point for your new application. We've set up a sample "Team Members" page for you to get started.

+
+ Manage Team Members + +
-
-
- Page updated: (UTC) -
- - + + +
Running one-time database setup...
'; + include 'db/setup.php'; + file_put_contents('db/setup_done.flag', 'done'); +} +?> + + \ No newline at end of file diff --git a/team.php b/team.php new file mode 100644 index 0000000..1f18244 --- /dev/null +++ b/team.php @@ -0,0 +1,109 @@ +query("SELECT id, name, email, role, status, created_at FROM team_members ORDER BY created_at DESC"); + $members = $stmt->fetchAll(PDO::FETCH_ASSOC); +} catch (PDOException $e) { + // In a real app, you'd log this error. For now, we'll just show a message. + echo '
Could not connect to the database.
'; +} +?> + +
+
+

Team Members

+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameEmailRoleStatusJoinedActions
No team members found. Add one to get started!
+ ' . htmlspecialchars(ucfirst($member['status'])) . ''; + ?> + + + +
+
+
+
+ + + + +