diff --git a/assets/css/custom.css b/assets/css/custom.css new file mode 100644 index 0000000..9fc00b2 --- /dev/null +++ b/assets/css/custom.css @@ -0,0 +1,55 @@ +/* Login Page Styles */ +body.login-page { + background-color: #f8f9fa; +} + +.login-container { + margin-top: 100px; +} + +/* Dashboard Styles */ +#wrapper { + display: flex; +} + +#sidebar-wrapper { + min-height: 100vh; + margin-left: -15rem; + transition: margin .25s ease-out; +} + +#sidebar-wrapper .sidebar-heading { + padding: 0.875rem 1.25rem; + font-size: 1.2rem; +} + +#sidebar-wrapper .list-group { + width: 15rem; +} + +#page-content-wrapper { + min-width: 100vw; +} + +body.sb-sidenav-toggled #wrapper #sidebar-wrapper { + margin-left: 0; +} + +@media (min-width: 768px) { + #sidebar-wrapper { + margin-left: 0; + } + + #page-content-wrapper { + min-width: 0; + width: 100%; + } + + body.sb-sidenav-toggled #wrapper #sidebar-wrapper { + margin-left: -15rem; + } +} + +#sidebarToggle { + border-radius: 0.25rem; +} \ No newline at end of file diff --git a/customer.php b/customer.php new file mode 100644 index 0000000..9559a4a --- /dev/null +++ b/customer.php @@ -0,0 +1,227 @@ +prepare("DELETE FROM customers WHERE id = ?"); + $stmt->execute([$delete_id]); + header("Location: customer.php"); + exit; +} + +// Handle form submission for adding a new customer +if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['add_customer'])) { + $companyName = $_POST['companyName'] ?? ''; + $contactPerson = $_POST['contactPerson'] ?? ''; + $email = $_POST['email'] ?? ''; + $phone = $_POST['phone'] ?? ''; + + if (!empty($companyName)) { + $pdo = db(); + $stmt = $pdo->prepare("INSERT INTO customers (companyName, contactPerson, email, phone) VALUES (?, ?, ?, ?)"); + $stmt->execute([$companyName, $contactPerson, $email, $phone]); + header("Location: customer.php"); + exit; + } +} + +// Handle form submission for updating a customer +if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['update_customer'])) { + $id = $_POST['customer_id']; + $companyName = $_POST['companyName'] ?? ''; + $contactPerson = $_POST['contactPerson'] ?? ''; + $email = $_POST['email'] ?? ''; + $phone = $_POST['phone'] ?? ''; + + if (!empty($id) && !empty($companyName)) { + $pdo = db(); + $stmt = $pdo->prepare("UPDATE customers SET companyName = ?, contactPerson = ?, email = ?, phone = ? WHERE id = ?"); + $stmt->execute([$companyName, $contactPerson, $email, $phone, $id]); + header("Location: customer.php"); + exit; + } +} + +// Fetch all customers +$pdo = db(); +$stmt = $pdo->query("SELECT * FROM customers ORDER BY createdAt DESC"); +$customers = $stmt->fetchAll(); + +include 'includes/header.php'; +?> +
Welcome to your accounting dashboard.
+