From c6859bf3de517d23a1372a6b4b947027207cb844 Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Mon, 16 Feb 2026 11:41:41 +0000 Subject: [PATCH] first one --- api/register_clergy.php | 27 +++ assets/css/custom.css | 91 ++++++++ assets/js/main.js | 53 +++++ db/migrations/001_initial_schema.sql | 20 ++ index.php | 329 +++++++++++++++------------ 5 files changed, 379 insertions(+), 141 deletions(-) create mode 100644 api/register_clergy.php create mode 100644 assets/css/custom.css create mode 100644 assets/js/main.js create mode 100644 db/migrations/001_initial_schema.sql diff --git a/api/register_clergy.php b/api/register_clergy.php new file mode 100644 index 0000000..f217ed9 --- /dev/null +++ b/api/register_clergy.php @@ -0,0 +1,27 @@ + false, 'error' => 'Invalid request method.']); + exit; +} + +$firstName = trim($_POST['first_name'] ?? ''); +$lastName = trim($_POST['last_name'] ?? ''); +$rank = trim($_POST['clergy_rank'] ?? ''); +$metropolis = trim($_POST['metropolis_name'] ?? ''); +$email = trim($_POST['email'] ?? ''); + +if (empty($firstName) || empty($lastName) || empty($rank) || empty($metropolis)) { + echo json_encode(['success' => false, 'error' => 'All required fields must be filled.']); + exit; +} + +try { + $stmt = db()->prepare("INSERT INTO clergy (first_name, last_name, clergy_rank, metropolis_name, email) VALUES (?, ?, ?, ?, ?)"); + $stmt->execute([$firstName, $lastName, $rank, $metropolis, $email]); + echo json_encode(['success' => true]); +} catch (Exception $e) { + echo json_encode(['success' => false, 'error' => 'Database error: ' . $e->getMessage()]); +} diff --git a/assets/css/custom.css b/assets/css/custom.css new file mode 100644 index 0000000..e38aa4a --- /dev/null +++ b/assets/css/custom.css @@ -0,0 +1,91 @@ +/* Custom styles for Clergy Registry Admin */ +body { + background-color: #F9FAFB; + color: #111827; + font-family: 'Inter', -apple-system, sans-serif; + font-size: 14px; + letter-spacing: -0.01em; +} + +.sidebar { + background-color: #FFFFFF; + border-right: 1px solid #E5E7EB; + min-height: 100vh; +} + +.nav-link { + color: #4B5563; + padding: 0.75rem 1rem; + border-radius: 4px; + margin-bottom: 0.25rem; +} + +.nav-link:hover, .nav-link.active { + background-color: #F3F4F6; + color: #111827; +} + +.card { + background-color: #FFFFFF; + border: 1px solid #E5E7EB; + border-radius: 4px; + box-shadow: none; +} + +.stat-card { + padding: 1.5rem; +} + +.stat-value { + font-size: 1.5rem; + font-weight: 600; + color: #111827; +} + +.stat-label { + color: #6B7280; + font-size: 0.875rem; + text-transform: uppercase; + letter-spacing: 0.05em; +} + +.table thead th { + background-color: #F9FAFB; + color: #6B7280; + font-weight: 500; + text-transform: uppercase; + font-size: 0.75rem; + letter-spacing: 0.05em; + border-bottom: 1px solid #E5E7EB; +} + +.btn-primary { + background-color: #111827; + border-color: #111827; + border-radius: 4px; + padding: 0.5rem 1rem; + font-weight: 500; +} + +.btn-primary:hover { + background-color: #1F2937; + border-color: #1F2937; +} + +.badge-active { + background-color: #D1FAE5; + color: #065F46; + font-weight: 500; + padding: 0.25rem 0.5rem; + border-radius: 4px; +} + +.form-control { + border-radius: 4px; + border: 1px solid #D1D5DB; +} + +.form-control:focus { + border-color: #111827; + box-shadow: 0 0 0 1px #111827; +} diff --git a/assets/js/main.js b/assets/js/main.js new file mode 100644 index 0000000..b1bb6b2 --- /dev/null +++ b/assets/js/main.js @@ -0,0 +1,53 @@ +document.addEventListener('DOMContentLoaded', function() { + const registerForm = document.getElementById('registerClergyForm'); + if (registerForm) { + registerForm.addEventListener('submit', function(e) { + e.preventDefault(); + const formData = new FormData(this); + const submitBtn = this.querySelector('button[type="submit"]'); + + submitBtn.disabled = true; + submitBtn.innerHTML = 'Registering...'; + + fetch('api/register_clergy.php', { + method: 'POST', + body: formData + }) + .then(response => response.json()) + .then(data => { + if (data.success) { + showToast('Success', 'Clergy member registered successfully.'); + setTimeout(() => location.reload(), 1500); + } else { + showToast('Error', data.error || 'Failed to register clergy.'); + submitBtn.disabled = false; + submitBtn.innerHTML = 'Register Clergy'; + } + }) + .catch(error => { + showToast('Error', 'An unexpected error occurred.'); + submitBtn.disabled = false; + submitBtn.innerHTML = 'Register Clergy'; + }); + }); + } +}); + +function showToast(title, message) { + const toastContainer = document.getElementById('toastContainer'); + const toastHtml = ` + + `; + toastContainer.innerHTML = toastHtml; + setTimeout(() => { + toastContainer.innerHTML = ''; + }, 5000); +} diff --git a/db/migrations/001_initial_schema.sql b/db/migrations/001_initial_schema.sql new file mode 100644 index 0000000..6299094 --- /dev/null +++ b/db/migrations/001_initial_schema.sql @@ -0,0 +1,20 @@ +-- Initial schema for Clergy Registry +CREATE TABLE IF NOT EXISTS clergy ( + id INT AUTO_INCREMENT PRIMARY KEY, + first_name VARCHAR(255) NOT NULL, + last_name VARCHAR(255) NOT NULL, + clergy_rank VARCHAR(100) NOT NULL, + metropolis_name VARCHAR(255) NOT NULL, + email VARCHAR(255), + status VARCHAR(50) DEFAULT 'Active', + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +-- Seed data for testing +INSERT INTO clergy (first_name, last_name, clergy_rank, metropolis_name, email) +SELECT 'Ioannis', 'Papadopoulos', 'Archimandrite', 'Metropolis of Athens', 'ioannis.p@example.gr' +WHERE NOT EXISTS (SELECT 1 FROM clergy WHERE email = 'ioannis.p@example.gr'); + +INSERT INTO clergy (first_name, last_name, clergy_rank, metropolis_name, email) +SELECT 'Dimitrios', 'Georgiou', 'Priest', 'Metropolis of Thessaloniki', 'dimitrios.g@example.gr' +WHERE NOT EXISTS (SELECT 1 FROM clergy WHERE email = 'dimitrios.g@example.gr'); diff --git a/index.php b/index.php index 7205f3d..a819e10 100644 --- a/index.php +++ b/index.php @@ -1,150 +1,197 @@ - - - - - - New Style -query("SELECT * FROM clergy ORDER BY created_at DESC"); +$clergyList = $stmt->fetchAll(); + +// Stats +$totalClergy = count($clergyList); +$activeAssignments = $totalClergy; // Simplified for MVP + +$title = $_SERVER['PROJECT_NAME'] ?? 'Clergy Registry'; +$description = $_SERVER['PROJECT_DESCRIPTION'] ?? 'Digital Registry and Payroll System for Clergy in Greece'; $projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? ''; ?> - - - - - - - - - - - - - - - - - - + + + + + + <?php echo htmlspecialchars($title); ?> + + + + + + + + + + + + + + + -
-
-

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

+ +
+
+ + + + +
+
+

Registry Dashboard

+ +
+ + +
+
+
+
Total Clergy
+
+
+
+
+
+
Active Assignments
+
+
+
+
+
+
Metropolises
+
2
+
+
+
+
+
Pending Payroll
+
€0.00
+
+
+
+ + +
+
+
Recent Registrations
+ Viewing latest entries +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameRankMetropolisEmailStatusRegistered
+
+
Active
No records found.
+
+
+
-
- + + + + + + +
+ + +