diff --git a/add-dependent.php b/add-dependent.php
new file mode 100644
index 0000000..2d2e76d
--- /dev/null
+++ b/add-dependent.php
@@ -0,0 +1,79 @@
+prepare('SELECT full_name FROM members WHERE id = ?');
+$stmt->execute([$member_id]);
+$member = $stmt->fetch();
+
+if (!$member) {
+ header('Location: index.php?error_message=Member+not+found');
+ exit;
+}
+
+$error_message = '';
+
+if ($_SERVER['REQUEST_METHOD'] === 'POST') {
+ if (empty($_POST['full_name']) || empty($_POST['relationship']) || empty($_POST['date_of_birth'])) {
+ $error_message = 'All fields are required.';
+ } else {
+ $stmt = $pdo->prepare(
+ 'INSERT INTO dependents (member_id, full_name, relationship, date_of_birth) VALUES (?, ?, ?, ?)'
+ );
+
+ try {
+ $stmt->execute([
+ $member_id,
+ $_POST['full_name'],
+ $_POST['relationship'],
+ $_POST['date_of_birth'],
+ ]);
+ header('Location: index.php?success_message=Dependent+added+successfully');
+ exit;
+ } catch (PDOException $e) {
+ $error_message = "Error adding dependent: " . $e->getMessage();
+ }
+ }
+}
+
+include __DIR__ . '/layout/header.php';
+?>
+
+
Add Dependent for
+
+
+
+
+
+
+
+
diff --git a/add-member.php b/add-member.php
new file mode 100644
index 0000000..01af661
--- /dev/null
+++ b/add-member.php
@@ -0,0 +1,104 @@
+prepare(
+ 'INSERT INTO members (full_name, street, number, neighborhood, city, state, zip_code, phone, email, job_title, department) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'
+ );
+
+ try {
+ $stmt->execute([
+ $_POST['full_name'] ?? null,
+ $_POST['street'] ?? null,
+ $_POST['number'] ?? null,
+ $_POST['neighborhood'] ?? null,
+ $_POST['city'] ?? null,
+ $_POST['state'] ?? null,
+ $_POST['zip_code'] ?? null,
+ $_POST['phone'] ?? null,
+ $_POST['email'] ?? null,
+ $_POST['job_title'] ?? null,
+ $_POST['department'] ?? null,
+ ]);
+ header('Location: index.php?success_message=Member+added+successfully');
+ exit;
+ } catch (PDOException $e) {
+ // In a real app, you might want to log this error
+ $error_message = "Error adding member: " . $e->getMessage();
+ }
+ }
+}
+
+include __DIR__ . '/layout/header.php';
+?>
+
+Add New Member
+
+
+
+
+
+
+
+
diff --git a/assets/css/style.css b/assets/css/style.css
new file mode 100644
index 0000000..ed50db2
--- /dev/null
+++ b/assets/css/style.css
@@ -0,0 +1,163 @@
+body {
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
+ background-color: #f8f9fa;
+ color: #212529;
+ margin: 0;
+ padding: 1rem;
+}
+
+.container {
+ max-width: 1200px;
+ margin: auto;
+ background-color: #ffffff;
+ padding: 2rem;
+ border-radius: 8px;
+ box-shadow: 0 2px 4px rgba(0,0,0,0.1);
+}
+
+h1, h2 {
+ color: #0d6efd;
+}
+
+table {
+ width: 100%;
+ border-collapse: collapse;
+ margin-top: 1rem;
+}
+
+th, td {
+ padding: 0.75rem;
+ text-align: left;
+ border-bottom: 1px solid #dee2e6;
+}
+
+th {
+ background-color: #f8f9fa;
+}
+
+.btn {
+ display: inline-block;
+ font-weight: 400;
+ color: #ffffff;
+ text-align: center;
+ vertical-align: middle;
+ cursor: pointer;
+ background-color: #0d6efd;
+ border: 1px solid #0d6efd;
+ padding: 0.375rem 0.75rem;
+ font-size: 1rem;
+ line-height: 1.5;
+ border-radius: 0.25rem;
+ text-decoration: none;
+ margin-top: 1rem;
+}
+
+.btn-sm {
+ padding: 0.25rem 0.5rem;
+ font-size: 0.875rem;
+ line-height: 1.5;
+ border-radius: 0.2rem;
+}
+
+.dependents-table {
+ margin-top: 0.5rem;
+ margin-left: 2rem;
+ width: calc(100% - 2rem);
+}
+
+.dependents-table th, .dependents-table td {
+ background-color: #e9ecef;
+}
+
+.alert {
+ padding: 1rem;
+ margin-bottom: 1rem;
+ border: 1px solid transparent;
+ border-radius: 0.25rem;
+}
+
+.alert-success {
+ color: #0f5132;
+ background-color: #d1e7dd;
+ border-color: #badbcc;
+}
+
+form {
+ margin-top: 1.5rem;
+}
+
+.form-group {
+ margin-bottom: 1rem;
+}
+
+.form-group label {
+ display: block;
+ margin-bottom: 0.5rem;
+}
+
+.form-group input, .form-group select {
+ width: 100%;
+ padding: 0.5rem;
+ font-size: 1rem;
+ border: 1px solid #ced4da;
+ border-radius: 0.25rem;
+}
+
+.actions {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 1rem;
+}
+
+.search-form {
+ display: flex;
+ gap: 0.5rem;
+ margin-top: 0;
+}
+
+.search-form input {
+ width: 300px;
+ padding: 0.375rem 0.75rem;
+ font-size: 1rem;
+ border: 1px solid #ced4da;
+ border-radius: 0.25rem;
+}
+
+.search-form .btn {
+ margin-top: 0;
+}
+
+.main-header {
+ background-color: #0d6efd;
+ color: #ffffff;
+ padding: 1rem 0;
+ margin-bottom: 2rem;
+}
+
+.header-content {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ max-width: 1200px;
+ margin: auto;
+ padding: 0 2rem;
+}
+
+.logo {
+ font-size: 1.5rem;
+ font-weight: bold;
+}
+
+.user-info {
+ display: flex;
+ align-items: center;
+ gap: 1rem;
+}
+
+.user-info .btn {
+ background-color: #ffffff;
+ color: #0d6efd;
+ border-color: #ffffff;
+ margin-top: 0;
+}
diff --git a/auth.php b/auth.php
new file mode 100644
index 0000000..05e8f93
--- /dev/null
+++ b/auth.php
@@ -0,0 +1,8 @@
+ PDO::ERRMODE_EXCEPTION,
+ PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
+ ]);
+ } catch (PDOException $e) {
+ // In a real app, you'd want to log this and show a user-friendly error.
+ die("Database connection failed: " . $e->getMessage());
+ }
+ }
+ return $pdo;
+}
+
+function initialize_database() {
+ $pdo = get_db_connection();
+
+ $statements = [
+ 'CREATE TABLE IF NOT EXISTS members (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ full_name VARCHAR(255) NOT NULL,
+ street VARCHAR(255),
+ number VARCHAR(50),
+ neighborhood VARCHAR(100),
+ city VARCHAR(100),
+ state VARCHAR(50),
+ zip_code VARCHAR(20),
+ phone VARCHAR(50),
+ email VARCHAR(255),
+ job_title VARCHAR(255),
+ department VARCHAR(255),
+ created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
+ );',
+ 'CREATE TABLE IF NOT EXISTS dependents (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ member_id INT NOT NULL,
+ full_name VARCHAR(255) NOT NULL,
+ relationship VARCHAR(100),
+ date_of_birth DATE,
+ created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE CASCADE
+ );',
+ 'CREATE TABLE IF NOT EXISTS users (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ username VARCHAR(255) NOT NULL UNIQUE,
+ password VARCHAR(255) NOT NULL,
+ created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
+ );'
+ ];
+
+ foreach ($statements as $statement) {
+ $pdo->exec($statement);
+ }
+
+ // Add a default admin user if one doesn't exist
+ $stmt = $pdo->query("SELECT id FROM users WHERE username = 'admin'");
+ if ($stmt->rowCount() == 0) {
+ $admin_pass = password_hash('password', PASSWORD_DEFAULT);
+ $pdo->prepare("INSERT INTO users (username, password) VALUES (?, ?)")
+ ->execute(['admin', $admin_pass]);
+ }
+}
+
+// Initialize the database schema when this file is included.
+initialize_database();
diff --git a/delete-dependent.php b/delete-dependent.php
new file mode 100644
index 0000000..7fccf8c
--- /dev/null
+++ b/delete-dependent.php
@@ -0,0 +1,22 @@
+prepare('DELETE FROM dependents WHERE id = ?');
+$stmt->execute([$dependent_id]);
+
+header('Location: index.php?success_message=Dependent deleted successfully');
+exit;
diff --git a/delete-member.php b/delete-member.php
new file mode 100644
index 0000000..31cd33d
--- /dev/null
+++ b/delete-member.php
@@ -0,0 +1,27 @@
+prepare('DELETE FROM dependents WHERE member_id = ?');
+$stmt->execute([$member_id]);
+
+// Then, delete the member
+$stmt = $pdo->prepare('DELETE FROM members WHERE id = ?');
+$stmt->execute([$member_id]);
+
+header('Location: index.php?success_message=Member deleted successfully');
+exit;
diff --git a/edit-dependent.php b/edit-dependent.php
new file mode 100644
index 0000000..b9484f8
--- /dev/null
+++ b/edit-dependent.php
@@ -0,0 +1,64 @@
+prepare(
+ 'UPDATE dependents SET full_name = ?, relationship = ?, date_of_birth = ? WHERE id = ?'
+ );
+ $stmt->execute([$full_name, $relationship, $date_of_birth, $dependent_id]);
+
+ header('Location: index.php?success_message=Dependent updated successfully');
+ exit;
+}
+
+// Fetch the dependent to edit
+$stmt = $pdo->prepare('SELECT * FROM dependents WHERE id = ?');
+$stmt->execute([$dependent_id]);
+$dependent = $stmt->fetch();
+
+if (!$dependent) {
+ header('Location: index.php');
+ exit;
+}
+
+include __DIR__ . '/layout/header.php';
+?>
+
+Edit Dependent
+
+
+
+
diff --git a/edit-member.php b/edit-member.php
new file mode 100644
index 0000000..7070cfb
--- /dev/null
+++ b/edit-member.php
@@ -0,0 +1,104 @@
+prepare(
+ 'UPDATE members SET full_name = ?, street = ?, number = ?, neighborhood = ?, city = ?, state = ?, zip_code = ?, phone = ?, email = ?, job_title = ?, department = ? WHERE id = ?'
+ );
+ $stmt->execute([$full_name, $street, $number, $neighborhood, $city, $state, $zip_code, $phone, $email, $job_title, $department, $member_id]);
+
+ header('Location: index.php?success_message=Member updated successfully');
+ exit;
+}
+
+// Fetch the member to edit
+$stmt = $pdo->prepare('SELECT * FROM members WHERE id = ?');
+$stmt->execute([$member_id]);
+$member = $stmt->fetch();
+
+if (!$member) {
+ header('Location: index.php');
+ exit;
+}
+
+include __DIR__ . '/layout/header.php';
+?>
+
+Edit Member
+
+
+
+
diff --git a/index.php b/index.php
index 7205f3d..b85332e 100644
--- a/index.php
+++ b/index.php
@@ -1,150 +1,136 @@
prepare($sql);
+$stmt->execute($params);
+$members = $stmt->fetchAll();
+
+
+// Fetch dependents for each member
+$dependentsByMember = [];
+if ($members) {
+ $memberIds = array_column($members, 'id');
+ if (!empty($memberIds)) {
+ $placeholders = implode(',', array_fill(0, count($memberIds), '?'));
+ $stmt = $pdo->prepare("SELECT * FROM dependents WHERE member_id IN ($placeholders) ORDER BY created_at DESC");
+ $stmt->execute($memberIds);
+ $dependents = $stmt->fetchAll();
+ foreach ($dependents as $dependent) {
+ $dependentsByMember[$dependent['member_id']][] = $dependent;
+ }
+ }
+}
+
+function calculate_age($dob) {
+ if (!$dob) return 'N/A';
+ $birthDate = new DateTime($dob);
+ $today = new DateTime('today');
+ $age = $birthDate->diff($today)->y;
+ return $age;
+}
+
+include __DIR__ . '/layout/header.php';
?>
-
-
-
-
-
- New Style
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Analyzing your requirements and generating your website…
-
- Loading…
-
-
= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.
-
This page will update automatically as the plan is implemented.
-
Runtime: PHP = htmlspecialchars($phpVersion) ?> — UTC = htmlspecialchars($now) ?>
+
+
Members
+
+
+
+
+
+
+
-
-
- Page updated: = htmlspecialchars($now) ?> (UTC)
-
-
-
+
+
+
+
+
+ Name
+ Email
+ Job Title
+ Department
+ Actions
+
+
+
+
+
+ No members found.
+
+
+
+
+
+
+
+
+
+ Add Dependent
+ Edit
+ Delete
+
+
+
+
+
+
+
+
+ Dependent Name
+ Relationship
+ Date of Birth
+ Age
+ Actions
+
+
+
+
+
+
+
+
+
+
+ Edit
+ Delete
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/layout/footer.php b/layout/footer.php
new file mode 100644
index 0000000..9943ff0
--- /dev/null
+++ b/layout/footer.php
@@ -0,0 +1,3 @@
+
+