diff --git a/customers.php b/customers.php
index 2be26da..eae3d55 100644
--- a/customers.php
+++ b/customers.php
@@ -66,8 +66,8 @@ try {
|
-
-
+
+
|
diff --git a/delete_customer.php b/delete_customer.php
new file mode 100644
index 0000000..3d89e5a
--- /dev/null
+++ b/delete_customer.php
@@ -0,0 +1,19 @@
+prepare('DELETE FROM customers WHERE id = ?');
+ $stmt->execute([$customer_id]);
+ } catch (PDOException $e) {
+ // Optional: Log the error or show a generic error message
+ // For simplicity, we redirect without an error message
+ }
+}
+
+header('Location: customers.php');
+exit;
+?>
diff --git a/delete_invoice.php b/delete_invoice.php
new file mode 100644
index 0000000..5d483d9
--- /dev/null
+++ b/delete_invoice.php
@@ -0,0 +1,19 @@
+prepare('DELETE FROM invoices WHERE id = ?');
+ $stmt->execute([$invoice_id]);
+ } catch (PDOException $e) {
+ // Optional: Log the error or show a generic error message
+ // For simplicity, we redirect without an error message
+ }
+}
+
+header('Location: invoices.php');
+exit;
+?>
diff --git a/delete_plan.php b/delete_plan.php
new file mode 100644
index 0000000..2c127c4
--- /dev/null
+++ b/delete_plan.php
@@ -0,0 +1,19 @@
+prepare('DELETE FROM plans WHERE id = ?');
+ $stmt->execute([$plan_id]);
+ } catch (PDOException $e) {
+ // Optional: Log the error or show a generic error message
+ // For simplicity, we redirect without an error message
+ }
+}
+
+header('Location: plans.php');
+exit;
+?>
diff --git a/edit_customer.php b/edit_customer.php
new file mode 100644
index 0000000..030005b
--- /dev/null
+++ b/edit_customer.php
@@ -0,0 +1,89 @@
+prepare('UPDATE customers SET name = ?, email = ?, status = ? WHERE id = ?');
+ $stmt->execute([$name, $email, $status, $customer_id]);
+ $success_message = 'Customer updated successfully!';
+ }
+ }
+
+ $stmt = $pdo->prepare('SELECT id, name, email, status FROM customers WHERE id = ?');
+ $stmt->execute([$customer_id]);
+ $customer = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ if (!$customer) {
+ header('Location: customers.php');
+ exit;
+ }
+} catch (PDOException $e) {
+ $error_message = 'Database error: ' . $e->getMessage();
+}
+
+?>
+
+
+
Edit Customer
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Customer not found.
+
+
+
diff --git a/edit_invoice.php b/edit_invoice.php
new file mode 100644
index 0000000..8847918
--- /dev/null
+++ b/edit_invoice.php
@@ -0,0 +1,122 @@
+prepare('UPDATE invoices SET customer_id = ?, plan_id = ?, amount = ?, status = ?, due_date = ? WHERE id = ?');
+ $stmt->execute([$customer_id, $plan_id, $amount, $status, $due_date, $invoice_id]);
+ $success_message = 'Invoice updated successfully!';
+ }
+ }
+
+ $stmt = $pdo->prepare('SELECT * FROM invoices WHERE id = ?');
+ $stmt->execute([$invoice_id]);
+ $invoice = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ if (!$invoice) {
+ header('Location: invoices.php');
+ exit;
+ }
+
+ $customers_stmt = $pdo->query('SELECT id, name FROM customers');
+ $customers = $customers_stmt->fetchAll(PDO::FETCH_ASSOC);
+
+ $plans_stmt = $pdo->query('SELECT id, name FROM plans');
+ $plans = $plans_stmt->fetchAll(PDO::FETCH_ASSOC);
+
+} catch (PDOException $e) {
+ $error_message = 'Database error: ' . $e->getMessage();
+}
+
+?>
+
+
+
Edit Invoice #
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Invoice not found.
+
+
+
diff --git a/edit_plan.php b/edit_plan.php
new file mode 100644
index 0000000..6fc1570
--- /dev/null
+++ b/edit_plan.php
@@ -0,0 +1,100 @@
+prepare('UPDATE plans SET name = ?, price = ?, billing_cycle = ?, features = ? WHERE id = ?');
+ $stmt->execute([$name, $price, $billing_cycle, $features_json, $plan_id]);
+ $success_message = 'Plan updated successfully!';
+ }
+ }
+
+ $stmt = $pdo->prepare('SELECT * FROM plans WHERE id = ?');
+ $stmt->execute([$plan_id]);
+ $plan = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ if (!$plan) {
+ header('Location: plans.php');
+ exit;
+ }
+} catch (PDOException $e) {
+ $error_message = 'Database error: ' . $e->getMessage();
+}
+
+?>
+
+
+
Edit Plan
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Plan not found.
+
+
+
diff --git a/invoices.php b/invoices.php
index 0e0da7a..d7ddc84 100644
--- a/invoices.php
+++ b/invoices.php
@@ -65,8 +65,9 @@ $status_colors = [
|
|
-
-
+
+
+
|
diff --git a/plans.php b/plans.php
index a73bc4d..f10782c 100644
--- a/plans.php
+++ b/plans.php
@@ -45,7 +45,12 @@ $plans = $stmt->fetchAll(PDO::FETCH_ASSOC);
}
?>
-
+
diff --git a/view_invoice.php b/view_invoice.php
new file mode 100644
index 0000000..ef01f6a
--- /dev/null
+++ b/view_invoice.php
@@ -0,0 +1,123 @@
+prepare('
+ SELECT
+ i.*,
+ c.name AS customer_name, c.email AS customer_email,
+ p.name AS plan_name
+ FROM invoices i
+ JOIN customers c ON i.customer_id = c.id
+ JOIN plans p ON i.plan_id = p.id
+ WHERE i.id = ?
+ ');
+ $stmt->execute([$invoice_id]);
+ $invoice = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ if (!$invoice) {
+ header('Location: invoices.php');
+ exit;
+ }
+} catch (PDOException $e) {
+ $error_message = 'Database error: ' . $e->getMessage();
+}
+
+$status_colors = [
+ 'Paid' => 'success',
+ 'Pending' => 'warning',
+ 'Overdue' => 'danger',
+];
+
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+
Invoice Info:
+
Invoice #:
+
Created Date:
+
Due Date:
+
+
+
+
+
+
+
+ | Description |
+ Amount |
+
+
+
+
+ | Subscription: |
+ $ |
+
+
+
+
+ | Total: |
+ $ |
+
+
+
+
+
+
+
+
+
+
+