diff --git a/assets/css/custom.css b/assets/css/custom.css new file mode 100644 index 0000000..814fa2f --- /dev/null +++ b/assets/css/custom.css @@ -0,0 +1,66 @@ + +/* --- custom.css --- */ +@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap'); + +body { + font-family: 'Poppins', sans-serif; + background-color: #f8f9fa; + color: #333; +} + +:root { + --primary-gradient: linear-gradient(45deg, #6f42c1, #007bff); + --primary-gradient-hover: linear-gradient(45deg, #007bff, #6f42c1); +} + +.navbar-brand { + font-weight: 700; +} + +.hero { + padding: 6rem 1rem; + text-align: center; + background: #fff; + border-bottom: 1px solid #dee2e6; +} + +.hero h1 { + font-size: 3rem; + font-weight: 700; +} + +.hero p { + font-size: 1.25rem; + font-weight: 300; + max-width: 600px; + margin: 1rem auto; +} + +.btn-primary { + background: var(--primary-gradient); + border: none; + padding: 0.75rem 1.5rem; + font-weight: 600; + transition: background 0.3s ease; +} + +.btn-primary:hover { + background: var(--primary-gradient-hover); +} + +.interactive-widget { + background: #ffffff; + padding: 3rem 1rem; + margin-top: 2rem; + border-radius: 0.5rem; + box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.05); + text-align: center; + max-width: 500px; + margin-left: auto; + margin-right: auto; +} + +.interactive-widget h3 { + font-weight: 600; + margin-bottom: 1.5rem; +} diff --git a/db/migrate.php b/db/migrate.php new file mode 100644 index 0000000..e352fe8 --- /dev/null +++ b/db/migrate.php @@ -0,0 +1,27 @@ +exec($sql); + + echo "Success: Database schema applied successfully." . PHP_EOL; + +} catch (PDOException $e) { + die("Error: Database connection failed: " . $e->getMessage()); +} catch (Exception $e) { + die($e->getMessage()); +} diff --git a/db/migrations/001_initial_schema.sql b/db/migrations/001_initial_schema.sql new file mode 100644 index 0000000..b8d9509 --- /dev/null +++ b/db/migrations/001_initial_schema.sql @@ -0,0 +1,32 @@ +-- Initial Schema for Event Management App + +-- Venues Table: Stores information about event locations. +CREATE TABLE IF NOT EXISTS `venues` ( + `id` INT PRIMARY KEY AUTO_INCREMENT, + `name` VARCHAR(255) NOT NULL, + `description` TEXT, + `capacity` INT, + `address` VARCHAR(255), + `is_available` BOOLEAN DEFAULT TRUE, + `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +-- Vendors Table: Stores information about service providers. +CREATE TABLE IF NOT EXISTS `vendors` ( + `id` INT PRIMARY KEY AUTO_INCREMENT, + `name` VARCHAR(255) NOT NULL, + `service_type` VARCHAR(100) COMMENT '''e.g., Catering, Decor, Entertainment''', + `contact_email` VARCHAR(255), + `contact_phone` VARCHAR(20), + `rating` DECIMAL(3, 2) COMMENT '''Rating from 1.00 to 5.00''', + `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +-- Users Table: For authentication and roles. +CREATE TABLE IF NOT EXISTS `users` ( + `id` INT PRIMARY KEY AUTO_INCREMENT, + `email` VARCHAR(255) NOT NULL UNIQUE, + `password_hash` VARCHAR(255) NOT NULL, + `role` VARCHAR(50) NOT NULL DEFAULT '''event_manager''' COMMENT '''e.g., event_manager, admin''', + `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; diff --git a/edit-vendor.php b/edit-vendor.php new file mode 100644 index 0000000..7722d2a --- /dev/null +++ b/edit-vendor.php @@ -0,0 +1,125 @@ +prepare('UPDATE vendors SET name = ?, service_type = ?, contact_email = ?, contact_phone = ?, rating = ? WHERE id = ?'); + $stmt->execute([$name, $service_type, $contact_email, $contact_phone, $rating, $vendor_id]); + header("Location: vendors.php?success=3"); + exit; + } catch (PDOException $e) { + $errorMessage = "Error: Could not update the vendor. " . $e->getMessage(); + } + } +} + +// Fetch the vendor to edit +$vendor = null; +try { + $pdo = db(); + $stmt = $pdo->prepare('SELECT * FROM vendors WHERE id = ?'); + $stmt->execute([$vendor_id]); + $vendor = $stmt->fetch(PDO::FETCH_ASSOC); +} catch (PDOException $e) { + $errorMessage = "Error: Could not fetch vendor details."; +} + +if (!$vendor) { + header("Location: vendors.php"); + exit; +} + +?> + + + + + + Edit Vendor - The Best Events + + + + + + + +
+

Edit Vendor

+ + +
+ +
+ + +
+ +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ + Cancel +
+ +
+ + + + diff --git a/edit-venue.php b/edit-venue.php new file mode 100644 index 0000000..0f32ace --- /dev/null +++ b/edit-venue.php @@ -0,0 +1,120 @@ +prepare('UPDATE venues SET name = ?, description = ?, capacity = ?, features = ? WHERE id = ?'); + $stmt->execute([$name, $description, $capacity, $features, $venue_id]); + header("Location: venues.php?success=3"); + exit; + } catch (PDOException $e) { + $errorMessage = "Error: Could not update the venue. " . $e->getMessage(); + } + } +} + +// Fetch the venue to edit +$venue = null; +try { + $pdo = db(); + $stmt = $pdo->prepare('SELECT * FROM venues WHERE id = ?'); + $stmt->execute([$venue_id]); + $venue = $stmt->fetch(PDO::FETCH_ASSOC); +} catch (PDOException $e) { + $errorMessage = "Error: Could not fetch venue details."; +} + +if (!$venue) { + header("Location: venues.php"); + exit; +} + +?> + + + + + + Edit Venue - The Best Events + + + + + + + +
+

Edit Venue

+ + +
+ +
+ + +
+ +
+ + +
+
+ + +
+
+ + +
+
+ + +
+ + Cancel +
+ +
+ + + + diff --git a/index.php b/index.php index e13ae95..c38ab6f 100644 --- a/index.php +++ b/index.php @@ -1,131 +1,84 @@ - - + - - - New Style - - - - + + + Title + + + + -
-
-

Analyzing your requirements and generating your website…

-
- Loading… -
-

Flatlogic AI is collecting your requirements and applying the first changes.

-

This page will update automatically as the plan is implemented.

-

Runtime: PHP — UTC

-
-
- + + + + + +
+
+

Effortless Events, Perfectly Planned.

+

Your all-in-one solution for managing venues, vendors, guests, and budgets from a single, easy-to-use dashboard.

+ Discover Your Dream Venue +
+
+ + +
+ +
+

Venue Availability Checker

+
+
+ +
+ +
+
+
+ + + + + + + + + - + \ No newline at end of file diff --git a/vendors.php b/vendors.php new file mode 100644 index 0000000..44ddb3f --- /dev/null +++ b/vendors.php @@ -0,0 +1,191 @@ +prepare('DELETE FROM vendors WHERE id = ?'); + $stmt->execute([$vendor_id]); + header("Location: vendors.php?success=2"); + exit; + } catch (PDOException $e) { + $errorMessage = "Error: Could not delete the vendor. " . $e->getMessage(); + } + } +} + +// Handle form submission for adding a new vendor +if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['add_vendor'])) { + $name = trim($_POST['name'] ?? ''); + $service_type = trim($_POST['service_type'] ?? ''); + $contact_email = filter_input(INPUT_POST, 'contact_email', FILTER_VALIDATE_EMAIL); + $contact_phone = trim($_POST['contact_phone'] ?? ''); + $rating = filter_input(INPUT_POST, 'rating', FILTER_VALIDATE_FLOAT); + + if (empty($name) || empty($service_type) || !$contact_email) { + $errorMessage = "Error: Vendor name, service type, and a valid email are required."; + } else { + try { + $pdo = db(); + $stmt = $pdo->prepare('INSERT INTO vendors (name, service_type, contact_email, contact_phone, rating) VALUES (?, ?, ?, ?, ?)'); + $stmt->execute([$name, $service_type, $contact_email, $contact_phone, $rating]); + header("Location: vendors.php?success=1"); + exit; + } catch (PDOException $e) { + $errorMessage = "Error: Could not add the vendor. " . $e->getMessage(); + } + } +} + +// Handle success messages +if (isset($_GET['success'])) { + if ($_GET['success'] == 1) $successMessage = "Vendor added successfully!"; + if ($_GET['success'] == 2) $successMessage = "Vendor deleted successfully!"; + if ($_GET['success'] == 3) $successMessage = "Vendor updated successfully!"; +} + +// Fetch vendors from the database +$vendors = []; +try { + $pdo = db(); + $stmt = $pdo->query('SELECT * FROM vendors ORDER BY name'); + $vendors = $stmt->fetchAll(PDO::FETCH_ASSOC); +} catch (PDOException $e) { + $errorMessage = "Error: Could not connect to the database."; +} + +?> + + + + + + Vendors - The Best Events + + + + + + + +
+

Manage Vendors

+ + +
+ + +
+ + +

+ +

+
+
+
+ +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ +
+
+
+ + +
+ No vendors found. Get started by adding one! +
+ +
+ +
+
+
+ Service: +
+

Contact: |

+ Rating: / 5 +
+ Edit + +
+
+ + + + +
+ + + + + diff --git a/venues.php b/venues.php new file mode 100644 index 0000000..dbe4350 --- /dev/null +++ b/venues.php @@ -0,0 +1,207 @@ +prepare('DELETE FROM venues WHERE id = ?'); + $stmt->execute([$venue_id]); + $successMessage = "Success: Venue deleted successfully!"; + header("Location: venues.php?success=2"); + exit; + } catch (PDOException $e) { + $errorMessage = "Error: Could not delete the venue. " . $e->getMessage(); + } + } +} + +// Handle form submission for adding a new venue +if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['add_venue'])) { + $name = trim($_POST['name'] ?? ''); + $description = trim($_POST['description'] ?? ''); + $capacity = filter_input(INPUT_POST, 'capacity', FILTER_VALIDATE_INT); + $features = trim($_POST['features'] ?? ''); + + if (empty($name) || $capacity === false || $capacity <= 0) { + $errorMessage = "Error: Venue name and a valid capacity are required."; + } else { + try { + $pdo = db(); + $stmt = $pdo->prepare('INSERT INTO venues (name, description, capacity, features) VALUES (?, ?, ?, ?)'); + $stmt->execute([$name, $description, $capacity, $features]); + $successMessage = "Success: Venue added successfully!"; + // Redirect to avoid form resubmission + header("Location: venues.php?success=1"); + exit; + } catch (PDOException $e) { + $errorMessage = "Error: Could not add the venue. " . $e->getMessage(); + } + } +} + +// Handle success message from redirect +if (isset($_GET['success'])) { + if ($_GET['success'] == '1') { + $successMessage = "Success: Venue added successfully!"; + } + if ($_GET['success'] == '2') { + $successMessage = "Success: Venue deleted successfully!"; + } + if ($_GET['success'] == '3') { + $successMessage = "Success: Venue updated successfully!"; + } +} + +// Fetch venues from the database +$venues = []; +try { + $pdo = db(); + $stmt = $pdo->query('SELECT * FROM venues ORDER BY name'); + $venues = $stmt->fetchAll(PDO::FETCH_ASSOC); +} catch (PDOException $e) { + // Handle DB error gracefully + $errorMessage = "Error: Could not connect to the database."; + // In a real app, you'd log this error. +} + +?> + + + + + + Venues - The Best Events + + + + + + + +
+

Manage Venues

+ + +
+ +
+ + +
+ +
+ + +

+ +

+
+
+
+ +
+ + +
+
+ + +
+
+ + +
+
+ + +
+ +
+
+
+ + +
+ +
+ +
+ No venues found. Get started by adding one! +
+ +
+ +
+
+
+ Capacity: +
+

+ Features: +
+ Edit + +
+
+ + + + +
+ + +
+ + + +