34894-vm/dashboard.php
Flatlogic Bot da0815949e finavo
2025-10-12 05:26:53 +00:00

90 lines
4.5 KiB
PHP

<?php
require_once 'includes/auth.php';
$active_page = 'dashboard';
include 'includes/header.php';
include 'db/config.php';
// Fetch total customers
$customers_query = "SELECT COUNT(*) as total_customers FROM customers";
$customers_result = db()->query($customers_query);
$total_customers = $customers_result->fetch_assoc()['total_customers'];
// Fetch total quotations
$quotations_query = "SELECT COUNT(*) as total_quotations FROM quotations";
$quotations_result = db()->query($quotations_query);
$total_quotations = $quotations_result->fetch_assoc()['total_quotations'];
// Fetch total invoices
$invoices_query = "SELECT COUNT(*) as total_invoices FROM invoices";
$invoices_result = db()->query($invoices_query);
$total_invoices = $invoices_result->fetch_assoc()['total_invoices'];
?>
<div class="d-flex" id="wrapper">
<?php include 'includes/sidebar.php'; ?>
<!-- Page content wrapper-->
<div id="page-content-wrapper">
<!-- Top navigation-->
<nav class="navbar navbar-expand-lg navbar-light bg-light border-bottom">
<div class="container-fluid">
<button class="btn btn-primary" id="sidebarToggle"><i class="bi bi-list"></i></button>
<ul class="navbar-nav ms-auto mt-2 mt-lg-0">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" id="navbarDropdown" href="#" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><?php echo htmlspecialchars($_SESSION["username"]); ?></a>
<div class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="#!">Profile</a>
<a class="dropdown-item" href="#!">Settings</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="logout.php">Logout</a>
</div>
</li>
</ul>
</div>
</nav>
<!-- Page content-->
<div class="container-fluid p-4">
<h1 class="mt-4">Dashboard</h1>
<p>Welcome to your accounting dashboard.</p>
<div class="row">
<div class="col-xl-3 col-md-6">
<div class="card bg-primary text-white mb-4">
<div class="card-body">Total Customers</div>
<div class="card-footer d-flex align-items-center justify-content-between">
<span class="small text-white"><?php echo $total_customers; ?></span>
<div class="small text-white"><i class="bi bi-chevron-right"></i></div>
</div>
</div>
</div>
<div class="col-xl-3 col-md-6">
<div class="card bg-warning text-white mb-4">
<div class="card-body">Total Invoices</div>
<div class="card-footer d-flex align-items-center justify-content-between">
<span class="small text-white"><?php echo $total_invoices; ?></span>
<div class="small text-white"><i class="bi bi-chevron-right"></i></div>
</div>
</div>
</div>
<div class="col-xl-3 col-md-6">
<div class="card bg-success text-white mb-4">
<div class="card-body">Quotations Sent</div>
<div class="card-footer d-flex align-items-center justify-content-between">
<span class="small text-white"><?php echo $total_quotations; ?></span>
<div class="small text-white"><i class="bi bi-chevron-right"></i></div>
</div>
</div>
</div>
<div class="col-xl-3 col-md-6">
<div class="card bg-danger text-white mb-4">
<div class="card-body">Overdue Invoices</div>
<div class="card-footer d-flex align-items-center justify-content-between">
<span class="small text-white">0</span>
<div class="small text-white"><i class="bi bi-chevron-right"></i></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php include 'includes/footer.php'; ?>