From 4f6f10c21fdc58726d8b4d2a65e93d5d7833b92a Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Sun, 26 Oct 2025 16:34:12 +0000 Subject: [PATCH] Auto commit: 2025-10-26T16:34:12.063Z --- customers.php | 180 +++++++++-------------- db/migrations/002_create_plans_table.sql | 8 + db/seed.php | 40 ++++- index.php | 145 ++++++------------ invoices.php | 25 ++++ plans.php | 58 ++++++++ reports.php | 19 +++ templates/footer.php | 9 ++ templates/header.php | 70 +++++++++ 9 files changed, 336 insertions(+), 218 deletions(-) create mode 100644 db/migrations/002_create_plans_table.sql create mode 100644 invoices.php create mode 100644 plans.php create mode 100644 reports.php create mode 100644 templates/footer.php create mode 100644 templates/header.php diff --git a/customers.php b/customers.php index 0815e26..00dbd18 100644 --- a/customers.php +++ b/customers.php @@ -1,127 +1,81 @@ query('SELECT id, name, email, plan, status FROM customers ORDER BY id'); - $customers = $stmt->fetchAll(); + $stmt = $pdo->query('SELECT id, name, email, status, created_at FROM customers ORDER BY created_at DESC'); + $customers = $stmt->fetchAll(PDO::FETCH_ASSOC); } catch (PDOException $e) { - // For development, you might want to log this error or display a generic message - // For production, log the error and show a user-friendly message. - error_log('Database error: ' . $e->getMessage()); - $customers = []; // Ensure $customers is an empty array on error - // Optionally, set an error message to display to the user - $errorMessage = 'Could not retrieve customer data. Please try again later.'; -} - -function getStatusBadgeClass($status) { - switch (strtolower($status)) { - case 'active': - return 'bg-success'; - case 'suspended': - return 'bg-warning text-dark'; - case 'deactivated': - return 'bg-danger'; - default: - return 'bg-secondary'; - } + $customers = []; + $error_message = "Error: Could not fetch customer data."; } ?> - - - - - - Customers - CableCRM - - - - - - - - - -