in this codes (<?php // public/dashboard.php // Enable error reporting for debugging…
- User
in this codes (<?php // public/dashboard.php
// Enable error reporting for debugging (disable in production) ini_set('display_errors', 0); // Set to 0 in production ini_set('display_startup_errors', 0); // Set to 0 in production error_reporting(E_ALL);
// Start output buffering to prevent "headers already sent" errors ob_start();
// Include authentication and database connection first require_once '../includes/auth.php'; require_once '../includes/db_connect.php';
// Now include the header require_once '../includes/header.php';
/**
- Fetch Quick Stats */
// Total Orders totalOrdersResult = totalOrdersSql); totalOrdersResult && totalOrdersResult->fetch_assoc()) ? (int)$row['total'] : 0;
// Pending Orders pendingOrdersResult = pendingOrdersSql); pendingOrdersResult && pendingOrdersResult->fetch_assoc()) ? (int)$row['total'] : 0;
// Completed Orders completedOrdersResult = completedOrdersSql); completedOrdersResult && completedOrdersResult->fetch_assoc()) ? (int)$row['total'] : 0;
// Delivered Orders deliveredOrdersResult = deliveredOrdersSql); deliveredOrdersResult && deliveredOrdersResult->fetch_assoc()) ? (int)$row['total'] : 0;
// Total Sales from Completed and Delivered Orders considering discounts totalSalesResult = totalSalesSql); totalSalesResult && totalSalesResult->fetch_assoc()) ? (float)$row['total_sales'] : 0.00;
/**
- Fetch Recent Orders */
// Fetch the 5 most recent orders $recentOrdersSql = " SELECT o.id AS order_id, c.name AS customer_name, c.contact, c.delivery_address, o.status, o.order_date, o.delivery_datetime, GROUP_CONCAT( CONCAT( p.name, ' - ', p.size, ' (', FORMAT(p.price, 2), ' KD) ', 'Qty: ', oi.quantity, '', 'Packaging: ', IFNULL(oi.packaging_preferences, 'None'), '', 'Discount: ', oi.discount_percentage, '%', 'Reason: ', IFNULL(oi.discount_reason, 'N/A') ) SEPARATOR '' ) AS products_details FROM orders o JOIN customers c ON o.customer_id = c.id JOIN order_items oi ON o.id = oi.order_id JOIN products p ON oi.product_id = p.id GROUP BY o.id ORDER BY o.order_date DESC LIMIT 5 ";
conn->query(recentOrders = (recentOrdersResult && recentOrdersResult->num_rows > 0) ? $recentOrdersResult : false;
?>
<!-- Google Fonts --> <link href="https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700&family=Nunito:wght@400;600;700&family=Roboto:wght@400;700&display=swap" rel="stylesheet"> <!-- Bootstrap CSS --> <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css"> <!-- Bootstrap Icons --> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css"> <!-- Custom Styles --><!-- Welcome Section --> <div class="welcome-section"> <h3>Welcome to the Kaak Alia Management System!</h3> <hr> </div> <!-- Statistics Section --> <div class="stats-section"> <!-- Total Orders --> <div class="stat-card"> <div class="stat-icon total-orders"> <i class="bi bi-cart-fill"></i> </div> <div class="stat-info"> <h5>Total Orders</h5> <p><?= number_format($totalOrders) ?></p> </div> </div> <!-- Pending Orders --> <div class="stat-card"> <div class="stat-icon pending-orders"> <i class="bi bi-hourglass-top"></i> </div> <div class="stat-info"> <h5>Pending Orders</h5> <p><?= number_format($pendingOrders) ?></p> </div> </div> <!-- Completed Orders --> <div class="stat-card"> <div class="stat-icon completed-orders"> <i class="bi bi-check-circle-fill"></i> </div> <div class="stat-info"> <h5>Completed Orders</h5> <p><?= number_format($completedOrders) ?></p> </div> </div> <!-- Delivered Orders --> <div class="stat-card"> <div class="stat-icon delivered-orders"> <i class="bi bi-truck"></i> </div> <div class="stat-info"> <h5>Delivered Orders</h5> <p><?= number_format($deliveredOrders) ?></p> </div> </div> <!-- Total Sales --> <div class="stat-card"> <div class="stat-icon total-sales"> <i class="bi bi-cash-stack"></i> </div> <div class="stat-info"> <h5>Total Sales (KD)</h5> <p><?= number_format($totalSales, 2) ?></p> </div> </div> </div> <!-- Main Buttons Section --> <div class="buttons-section"> <a href="orders/add_order.php" class="action-button add-order"> <i class="bi bi-plus-circle-fill me-2"></i> Add New Order </a> <a href="orders/view_orders.php" class="action-button view-orders"> <i class="bi bi-eye-fill me-2"></i> View Orders </a> <a href="products/manage_products.php" class="action-button manage-products"> <i class="bi bi-box-seam-fill me-2"></i> Manage Products </a> <a href="users/manage_users.php" class="action-button manage-users"> <i class="bi bi-people-fill me-2"></i> Manage Users </a> <a href="reports/generate_reports.php" class="action-button generate-reports"> <i class="bi bi-bar-chart-fill me-2"></i> Generate Reports </a> </div> <!-- Recent Orders Section --> <div class="recent-orders-section"> <h4>Recent Orders</h4> <div class="table-responsive"> <table class="table table-hover"> <thead> <tr> <th>#ID</th> <th>Customer Name</th> <th>Contact</th> <th>Delivery Address</th> <th>Products</th> <th>Status</th> <th>Order Date</th> <th>Delivery DateTime</th> </tr> </thead> <tbody> <?php if ($recentOrders && $recentOrders->num_rows > 0): ?> <?php while($order = $recentOrders->fetch_assoc()): ?> <tr> <td><?= htmlspecialchars($order['order_id']) ?></td> <td><?= htmlspecialchars($order['customer_name']) ?></td> <td><?= htmlspecialchars($order['contact']) ?></td> <td><?= nl2br(htmlspecialchars($order['delivery_address'])) ?></td> <td> <?php // Display all products associated with the order echo $order['products_details']; ?> </td> <td> <?php switch ($order['status']) { case 'Pending': echo '<span class="badge-status-pending">Pending</span>'; break; case 'In Progress': echo '<span class="badge-status-in-progress">In Progress</span>'; break; case 'Completed': echo '<span class="badge-status-completed">Completed</span>'; break; case 'Delivered': echo '<span class="badge-status-delivered">Delivered</span>'; break; default: echo '<span class="badge bg-light text-dark">Unknown</span>'; } ?> </td> <td><?= htmlspecialchars(date("d M Y, h:i A", strtotime($order['order_date']))) ?></td> <td><?= $order['delivery_datetime'] ? htmlspecialchars(date("d M Y, h:i A", strtotime($order['delivery_datetime']))) : 'N/A' ?></td> </tr> <?php endwhile; ?> <?php else: ?> <tr> <td colspan="8" class="text-center">No recent orders.</td> </tr> <?php endif; ?> </tbody> </table> </div> <a href="orders/view_orders.php" class="view-all">View All Orders</a> </div> <!-- Footer --> <div class="footer"> © 2024 Kaak Alia Bakery. All rights reserved. </div>- Background and Layout Background Color: Use a very light grey or soft, cool-toned blue-grey for the main panel background. This keeps the design clean, spacious, and modern. Card and Table Borders: Replace traditional solid borders with subtle shadows to create a card-like effect. This approach gives a softer, more polished look. Padding and Spacing: Increase spacing around elements and between rows to create an airy, open feel, improving readability and user comfort.
- Filters Section Filter Buttons: Replace rounded rectangles with modern pill-shaped buttons, and use gradient colors (e.g., light blue to dark blue-grey) to make them stand out. This gradient effect adds vibrancy and makes the interface feel more dynamic. Date Pickers and Dropdowns: Use outlined fields with rounded corners, and have the border color change on focus (e.g., light blue or teal). This is a sleek, interactive design choice.
- Search Bar Search Field Styling: Add a subtle icon inside the search bar for better usability, such as a magnifying glass icon at the left. Set the border color to light grey, and highlight it with a brighter shade on focus to indicate interactivity. Search Button: Use a modern, rounded shape with a bold color like cool blue-grey or teal for visibility. Adding a slight shadow or subtle glow effect on hover enhances the interactive feel.
- Data Table Column Headers: Use a clean, sans-serif font in bold and larger font size for column headers. A light grey background differentiates the header row without adding visual weight. Avoid heavy borders and opt for a single bottom border line. Row Backgrounds: Alternate row backgrounds with very light shades (e.g., soft blue-grey and white) to enhance readability. This technique also reinforces visual hierarchy. Details Presentation: Present detailed information within each cell in a card-style layout. Use a slightly smaller font and display details in a column layout, with each item on a separate line to organize information clearly. Status Badges: Use rounded labels with soft pastel backgrounds for each status. For example: Pending: Soft yellow with dark grey text. Completed: Soft green with white text. Priority Labels: Align badge colors with priority level: Normal: Light grey. Important: Soft red or orange.
- Action Buttons Button Colors and Layout: Replace basic color blocks with gradient or outlined buttons. Suggestions include: Edit: Soft blue gradient from light to medium blue. Change Status: Green gradient from light green to dark green. Delete: Soft red gradient from light pink to deeper red. View: Bright teal with a subtle hover animation for a slight scale-up effect. Button Shape and Iconography: Use pill-shaped buttons with slight shadowing for a floating effect. Adding small icons (e.g., pencil for Edit, trash for Delete) next to text labels improves functionality clarity.
- Typography Font Choice: Select a modern, sans-serif font like "Roboto" or "Open Sans" for a clean and polished appearance. Increase font size slightly for better readability. Hierarchy and Emphasis: Emphasize key information (e.g., dates or highlighted text) with bold weight, while using lighter weights for secondary details to maintain a clear visual hierarchy.
- Color Palette Primary Colors: Use cool tones such as blue-greys, light blues, and teals. Accent Colors: Soft greens, purples, and a touch of orange for tags or priority indicators. Text Colors: Use dark grey or black for main text, with white text on buttons and color-coded labels for contrast. These updates will result in a visually pleasing, cool-toned, and modern interface. Clean lines, gradient buttons, and soft backgrounds will create a fresh, organized, and engaging user experience.
) and type full codes and make into file page plz
- Assistant
Sure! I'll help you redesign your
dashboard.phppage to feature a modern, clean, and visually appealing UI using cool, neutral colors like blue-grey tones. The updated design will incorporate the suggestions you provided, ensuring a refreshing and contemporary look. Below is the complete updated code with detailed comments to help you understand the changes made.Updated
dashboard.php<?php // public/dashboard.php // Enable error reporting for debugging (disable in production) ini_set('display_errors', 0); // Set to 0 in production ini_set('display_startup_errors', 0); // Set to 0 in production error_reporting(E_ALL); // Start output buffering to prevent "headers already sent" errors ob_start(); // Include authentication and database connection first require_once '../includes/auth.php'; require_once '../includes/db_connect.php'; // Now include the header require_once '../includes/header.php'; /** * Fetch Quick Stats */ // Total Orders $totalOrdersSql = "SELECT COUNT(*) AS total FROM orders"; $totalOrdersResult = $conn->query($totalOrdersSql); $totalOrders = ($totalOrdersResult && $row = $totalOrdersResult->fetch_assoc()) ? (int)$row['total'] : 0; // Pending Orders $pendingOrdersSql = "SELECT COUNT(*) AS total FROM orders WHERE status = 'Pending'"; $pendingOrdersResult = $conn->query($pendingOrdersSql); $pendingOrders = ($pendingOrdersResult && $row = $pendingOrdersResult->fetch_assoc()) ? (int)$row['total'] : 0; // Completed Orders $completedOrdersSql = "SELECT COUNT(*) AS total FROM orders WHERE status = 'Completed'"; $completedOrdersResult = $conn->query($completedOrdersSql); $completedOrders = ($completedOrdersResult && $row = $completedOrdersResult->fetch_assoc()) ? (int)$row['total'] : 0; // Delivered Orders $deliveredOrdersSql = "SELECT COUNT(*) AS total FROM orders WHERE status = 'Delivered'"; $deliveredOrdersResult = $conn->query($deliveredOrdersSql); $deliveredOrders = ($deliveredOrdersResult && $row = $deliveredOrdersResult->fetch_assoc()) ? (int)$row['total'] : 0; // Total Sales from Completed and Delivered Orders considering discounts $totalSalesSql = " SELECT SUM(p.price * oi.quantity * (1 - (oi.discount_percentage / 100))) AS total_sales FROM order_items oi JOIN products p ON oi.product_id = p.id JOIN orders o ON oi.order_id = o.id WHERE o.status IN ('Completed', 'Delivered') "; $totalSalesResult = $conn->query($totalSalesSql); $totalSales = ($totalSalesResult && $row = $totalSalesResult->fetch_assoc()) ? (float)$row['total_sales'] : 0.00; /** * Fetch Recent Orders */ // Fetch the 5 most recent orders $recentOrdersSql = " SELECT o.id AS order_id, c.name AS customer_name, c.contact, c.delivery_address, o.status, o.order_date, o.delivery_datetime, GROUP_CONCAT( CONCAT( p.name, ' - ', p.size, ' (', FORMAT(p.price, 2), ' KD) <br>', 'Qty: ', oi.quantity, '<br>', 'Packaging: ', IFNULL(oi.packaging_preferences, 'None'), '<br>', 'Discount: ', oi.discount_percentage, '%<br>', 'Reason: ', IFNULL(oi.discount_reason, 'N/A') ) SEPARATOR '<hr>' ) AS products_details FROM orders o JOIN customers c ON o.customer_id = c.id JOIN order_items oi ON o.id = oi.order_id JOIN products p ON oi.product_id = p.id GROUP BY o.id ORDER BY o.order_date DESC LIMIT 5 "; $recentOrdersResult = $conn->query($recentOrdersSql); $recentOrders = ($recentOrdersResult && $recentOrdersResult->num_rows > 0) ? $recentOrdersResult : false; ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Dashboard - Kaak Alia Management System</title> <!-- Google Fonts --> <link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;700&family=Roboto:wght@400;700&display=swap" rel="stylesheet"> <!-- Bootstrap CSS --> <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css"> <!-- Bootstrap Icons --> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css"> <!-- Custom Styles --> <style> /* --------------------------------------------------- 1. CSS Variables for Consistent Design with Cool Tones ---------------------------------------------------- */ :root { /* Cool Blue-Grey Theme Colors */ --primary-color: #4A90E2; /* Cool Blue */ --secondary-color: #34495E; /* Dark Blue-Grey */ --light-grey: #ECF0F1; /* Light Grey for Backgrounds */ --card-shadow: rgba(0, 0, 0, 0.1); --accent-gradient: linear-gradient(135deg, #89f7fe 0%, #66a6ff 100%); --button-hover-shadow: rgba(0, 0, 0, 0.15); /* Text Colors */ --main-text: #2C3E50; --secondary-text: #7f8c8d; --title-color: #2C3E50; --placeholder-text: #95A5A6; /* UI Elements */ --input-border: #BDC3C7; --input-focus-border: #4A90E2; --box-background: #FFFFFF; --box-border-radius: 12px; --box-shadow: 0px 4px 6px var(--card-shadow); --title-font: 'Open Sans', sans-serif; --body-font: 'Roboto', sans-serif; /* Badge Colors */ --badge-pending: #F1C40F; /* Soft Yellow */ --badge-in-progress: #3498DB; /* Soft Blue */ --badge-completed: #2ECC71; /* Soft Green */ --badge-delivered: #E67E22; /* Soft Orange */ } /* --------------------------------------------------- 2. Global Styles ---------------------------------------------------- */ body { font-family: var(--body-font), sans-serif; background: var(--light-grey); margin: 0; padding: 0; color: var(--main-text); } .container-body { font-family: var(--body-font), sans-serif; background-color: var(--light-grey); margin: 0; padding: 30px; box-sizing: border-box; } /* --------------------------------------------------- 3. Header Styles ---------------------------------------------------- */ .header { padding: 20px 30px; background: var(--primary-color); border-radius: var(--box-border-radius); display: flex; align-items: center; justify-content: center; margin-bottom: 30px; box-shadow: var(--box-shadow); } .header h1 { color: #FFFFFF; font-size: 32px; font-weight: 700; font-family: var(--title-font); } /* --------------------------------------------------- 4. Welcome Section ---------------------------------------------------- */ .welcome-section { background-color: var(--box-background); box-shadow: var(--box-shadow); border-radius: var(--box-border-radius); padding: 25px; text-align: center; margin-bottom: 30px; } .welcome-section h3 { font-size: 24px; color: var(--main-text); margin-bottom: 10px; font-family: var(--title-font); } .welcome-section hr { width: 60px; height: 3px; background: var(--primary-color); border: none; margin: 10px auto; border-radius: 2px; } /* --------------------------------------------------- 5. Statistics Section ---------------------------------------------------- */ .stats-section { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 25px; margin-bottom: 30px; } .stat-card { background-color: var(--box-background); box-shadow: var(--box-shadow); border-radius: var(--box-border-radius); padding: 20px; display: flex; align-items: center; transition: transform 0.3s, box-shadow 0.3s; } .stat-card:hover { transform: translateY(-5px); box-shadow: 0 8px 16px var(--button-hover-shadow); } .stat-icon { font-size: 36px; margin-right: 20px; color: var(--primary-color); } .stat-info h5 { font-size: 18px; color: var(--main-text); margin-bottom: 5px; font-family: var(--title-font); } .stat-info p { font-size: 26px; font-weight: 700; color: var(--main-text); margin: 0; } /* --------------------------------------------------- 6. Main Buttons Section ---------------------------------------------------- */ .buttons-section { display: flex; flex-wrap: wrap; gap: 20px; margin-bottom: 30px; } .action-button { display: flex; align-items: center; justify-content: center; flex: 1 1 200px; height: 60px; font-size: 18px; font-weight: 600; color: #FFFFFF; border: none; border-radius: 30px; padding: 10px 20px; cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; text-decoration: none; text-align: center; font-family: var(--title-font); box-shadow: 0 4px 6px var(--card-shadow); } .action-button.add-order { background: linear-gradient(135deg, #89f7fe 0%, #66a6ff 100%); } .action-button.view-orders { background: linear-gradient(135deg, #43cea2 0%, #185a9d 100%); } .action-button.manage-products { background: linear-gradient(135deg, #fbc2eb 0%, #a6c1ee 100%); } .action-button.manage-users { background: linear-gradient(135deg, #fddb92 0%, #d1fdff 100%); } .action-button.generate-reports { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); } .action-button:hover { transform: scale(1.05); box-shadow: 0 8px 12px var(--button-hover-shadow); } .action-button i { margin-right: 10px; font-size: 20px; } /* --------------------------------------------------- 7. Recent Orders Section ---------------------------------------------------- */ .recent-orders-section { background-color: var(--box-background); border-radius: var(--box-border-radius); padding: 25px; box-shadow: var(--box-shadow); } .recent-orders-section h4 { font-size: 24px; font-weight: 700; color: var(--main-text); margin-bottom: 20px; font-family: var(--title-font); } /* Make table responsive */ .table-responsive { overflow-x: auto; } .recent-orders-section table { width: 100%; border-collapse: collapse; } .recent-orders-section th, .recent-orders-section td { padding: 15px; text-align: left; font-size: 16px; vertical-align: top; font-family: var(--body-font); } .recent-orders-section th { background-color: var(--primary-color); color: #FFFFFF; font-weight: 700; position: sticky; top: 0; z-index: 1; border-bottom: 2px solid #2980B9; } .recent-orders-section tr:nth-child(even) { background-color: #F2F4F7; } .recent-orders-section tr:hover { background-color: #D6EAF8; } .recent-orders-section td { font-size: 14px; color: var(--main-text); } .recent-orders-section .view-all { display: block; text-align: right; margin-top: 15px; font-size: 16px; color: var(--primary-color); font-weight: 600; text-decoration: none; font-family: var(--title-font); transition: color 0.3s; } .recent-orders-section .view-all:hover { color: #2874A6; } /* Badge Styles */ .badge-status-pending { background-color: var(--badge-pending); color: #FFFFFF; padding: 6px 12px; border-radius: 20px; font-size: 13px; font-weight: 600; display: inline-block; } .badge-status-in-progress { background-color: var(--badge-in-progress); color: #FFFFFF; padding: 6px 12px; border-radius: 20px; font-size: 13px; font-weight: 600; display: inline-block; } .badge-status-completed { background-color: var(--badge-completed); color: #FFFFFF; padding: 6px 12px; border-radius: 20px; font-size: 13px; font-weight: 600; display: inline-block; } .badge-status-delivered { background-color: var(--badge-delivered); color: #FFFFFF; padding: 6px 12px; border-radius: 20px; font-size: 13px; font-weight: 600; display: inline-block; } /* --------------------------------------------------- 8. Footer Styles ---------------------------------------------------- */ .footer { background-color: var(--secondary-color); color: #FFFFFF; padding: 20px; text-align: center; border-radius: var(--box-border-radius); font-size: 14px; line-height: 20px; margin-top: 50px; font-family: var(--body-font); } /* --------------------------------------------------- 9. Responsive Design Enhancements ---------------------------------------------------- */ @media (max-width: 991px) { .stat-card { flex-direction: column; align-items: flex-start; } .stat-icon { margin-bottom: 10px; } } @media (max-width: 768px) { .buttons-section { flex-direction: column; align-items: stretch; } .action-button { flex: 1 1 100%; } } @media (max-width: 576px) { .header h1 { font-size: 24px; } .welcome-section h3 { font-size: 20px; } .stat-info p { font-size: 22px; } .recent-orders-section th, .recent-orders-section td { padding: 10px; font-size: 12px; } .recent-orders-section h4 { font-size: 20px; } } </style> </head> <body> <main class='container-body'> <!-- Header --> <div class="header"> <h1>Kaak Alia Dashboard</h1> </div> <!-- Welcome Section --> <div class="welcome-section"> <h3>Welcome to the Kaak Alia Management System!</h3> <hr> </div> <!-- Statistics Section --> <div class="stats-section"> <!-- Total Orders --> <div class="stat-card"> <div class="stat-icon"> <i class="bi bi-cart-fill"></i> </div> <div class="stat-info"> <h5>Total Orders</h5> <p><?= number_format($totalOrders) ?></p> </div> </div> <!-- Pending Orders --> <div class="stat-card"> <div class="stat-icon"> <i class="bi bi-hourglass-split"></i> </div> <div class="stat-info"> <h5>Pending Orders</h5> <p><?= number_format($pendingOrders) ?></p> </div> </div> <!-- Completed Orders --> <div class="stat-card"> <div class="stat-icon"> <i class="bi bi-check-circle-fill"></i> </div> <div class="stat-info"> <h5>Completed Orders</h5> <p><?= number_format($completedOrders) ?></p> </div> </div> <!-- Delivered Orders --> <div class="stat-card"> <div class="stat-icon"> <i class="bi bi-truck"></i> </div> <div class="stat-info"> <h5>Delivered Orders</h5> <p><?= number_format($deliveredOrders) ?></p> </div> </div> <!-- Total Sales --> <div class="stat-card"> <div class="stat-icon"> <i class="bi bi-cash-coin"></i> </div> <div class="stat-info"> <h5>Total Sales (KD)</h5> <p><?= number_format($totalSales, 2) ?></p> </div> </div> </div> <!-- Main Buttons Section --> <div class="buttons-section"> <a href="orders/add_order.php" class="action-button add-order"> <i class="bi bi-plus-circle-fill"></i> Add New Order </a> <a href="orders/view_orders.php" class="action-button view-orders"> <i class="bi bi-eye-fill"></i> View Orders </a> <a href="products/manage_products.php" class="action-button manage-products"> <i class="bi bi-box-seam-fill"></i> Manage Products </a> <a href="users/manage_users.php" class="action-button manage-users"> <i class="bi bi-people-fill"></i> Manage Users </a> <a href="reports/generate_reports.php" class="action-button generate-reports"> <i class="bi bi-bar-chart-fill"></i> Generate Reports </a> </div> <!-- Recent Orders Section --> <div class="recent-orders-section"> <h4>Recent Orders</h4> <div class="table-responsive"> <table class="table table-hover"> <thead> <tr> <th>#ID</th> <th>Customer Name</th> <th>Contact</th> <th>Delivery Address</th> <th>Products</th> <th>Status</th> <th>Order Date</th> <th>Delivery DateTime</th> </tr> </thead> <tbody> <?php if ($recentOrders && $recentOrders->num_rows > 0): ?> <?php while($order = $recentOrders->fetch_assoc()): ?> <tr> <td><?= htmlspecialchars($order['order_id']) ?></td> <td><?= htmlspecialchars($order['customer_name']) ?></td> <td><?= htmlspecialchars($order['contact']) ?></td> <td><?= nl2br(htmlspecialchars($order['delivery_address'])) ?></td> <td> <?php // Display all products associated with the order echo $order['products_details']; ?> </td> <td> <?php switch ($order['status']) { case 'Pending': echo '<span class="badge-status-pending">Pending</span>'; break; case 'In Progress': echo '<span class="badge-status-in-progress">In Progress</span>'; break; case 'Completed': echo '<span class="badge-status-completed">Completed</span>'; break; case 'Delivered': echo '<span class="badge-status-delivered">Delivered</span>'; break; default: echo '<span class="badge bg-light text-dark">Unknown</span>'; } ?> </td> <td><?= htmlspecialchars(date("d M Y, h:i A", strtotime($order['order_date']))) ?></td> <td><?= $order['delivery_datetime'] ? htmlspecialchars(date("d M Y, h:i A", strtotime($order['delivery_datetime']))) : 'N/A' ?></td> </tr> <?php endwhile; ?> <?php else: ?> <tr> <td colspan="8" class="text-center">No recent orders.</td> </tr> <?php endif; ?> </tbody> </table> </div> <a href="orders/view_orders.php" class="view-all">View All Orders</a> </div> <!-- Footer --> <div class="footer"> © 2024 Kaak Alia Bakery. All rights reserved. </div> </main> <!-- Embedded Bootstrap JS --> <script src="bootstrap/js/bootstrap.bundle.min.js"></script> </body> </html> <?php // Flush the output buffer ob_end_flush(); // No closing PHP tag to prevent unwanted output ?>
Key Updates and Enhancements
-
Color Palette and Theme:
- Switched to a cool blue-grey theme using CSS variables for consistency.
- Defined gradient backgrounds for buttons to make them stand out and appear dynamic.
-
Typography:
- Updated fonts to "Open Sans" and "Roboto" for a modern and clean appearance.
- Enhanced font sizes and weights to improve readability and hierarchy.
-
Layout and Spacing:
- Increased padding and spacing around elements to create an airy and open feel.
- Utilized CSS Grid for the statistics section to ensure responsiveness and alignment.
-
Buttons:
- Implemented pill-shaped buttons with gradient backgrounds.
- Added subtle hover effects like scaling and shadow enhancements to improve interactivity.
- Included icons next to button text for better visual cues.
-
Cards and Tables:
- Replaced solid borders with soft shadows to create a card-like effect.
- Designed the recent orders table with alternating row colors for better readability.
- Enhanced table headers with a sticky position and gradient borders to maintain context during scrolling.
-
Badges:
- Styled status badges with rounded labels and soft pastel backgrounds aligned with their statuses.
- Ensured badges are easily distinguishable and maintain consistency across different order statuses.
-
Responsive Design:
- Ensured that the layout adapts gracefully across various screen sizes using media queries.
- Adjusted font sizes, paddings, and element alignments for optimal viewing on mobile devices.
-
Additional Enhancements:
- Added hover animations to buttons and table rows to provide visual feedback.
- Utilized
nl2brandhtmlspecialcharsto safely display data from the database, preventing potential security issues like XSS attacks.
Implementation Notes
-
Fonts and Icons:
- The Google Fonts links have been updated to include "Open Sans" for titles and "Roboto" for body text.
- Bootstrap Icons are used for consistent and visually appealing icons within buttons and statistics.
-
CSS Variables:
- Utilizing CSS variables (
:root) allows for easy theming and maintenance. Adjusting colors or fonts can be done in one place, ensuring consistency throughout the application.
- Utilizing CSS variables (
-
Gradient Buttons:
- Buttons now feature linear gradients, adding depth and modernity to the UI. These gradients also help in differentiating between various actions intuitively.
-
Enhanced Tables:
- Tables in the recent orders section have sticky headers and alternating row colors, which improve usability and aesthetics.
-
Accessibility:
- Ensured sufficient color contrast between text and backgrounds.
- Used semantic HTML elements and proper heading structures to enhance accessibility.
File Structure Recommendation
While the updated styles are embedded within the
<style>tag for simplicity, it's recommended to separate CSS into an external stylesheet for better maintainability, especially as the project grows. Here's a suggested file structure:project-root/ ├── public/ │ ├── dashboard.php │ ├── orders/ │ │ ├── add_order.php │ │ └── view_orders.php │ ├── products/ │ │ └── manage_products.php │ ├── users/ │ │ └── manage_users.php │ ├── reports/ │ │ └── generate_reports.php │ ├── includes/ │ │ ├── auth.php │ │ ├── db_connect.php │ │ └── header.php │ └── assets/ │ ├── css/ │ │ └── styles.css │ ├── js/ │ │ └── scripts.js │ └── bootstrap/ │ ├── css/ │ └── js/assets/css/styles.css: Move all custom CSS here.assets/js/scripts.js: If you have custom JavaScript, include it here.- Link External Stylesheet: Update the
<head>section indashboard.phpto link the external CSS.
Example:
<!-- In dashboard.php --> <link rel="stylesheet" href="assets/css/styles.css">This approach ensures that your HTML files remain clean and that styles are managed centrally, making it easier to implement changes and maintain the codebase.
Feel free to integrate the updated
dashboard.phpinto your project. If you have any further questions or need additional modifications, feel free to ask! -