<?php
require_once 'config.inc.php';require_login();$pageTitle='Dashboard';
$brands=db()->query("SELECT COUNT(*) c FROM brands")->fetch_assoc()['c'];
$products=db()->query("SELECT COUNT(*) c FROM products")->fetch_assoc()['c'];
$stock=db()->query("SELECT COALESCE(SUM(quantity),0) c FROM products")->fetch_assoc()['c'];
$compat=db()->query("SELECT COUNT(*) c FROM compatible_models")->fetch_assoc()['c'];
include 'partials/header.php'; ?>
<div class="row g-4 mb-4">
<?php foreach([['Brands',$brands,'bi-tags'],['Displays',$products,'bi-phone'],['Total Stock',$stock,'bi-box-seam'],['Compatibility',$compat,'bi-diagram-3']] as $s):?>
<div class="col-md-6 col-xl-3"><div class="card p-4"><div class="text-secondary"><?=$s[0]?></div><div class="d-flex justify-content-between align-items-center"><h2><?=$s[1]?></h2><i class="bi <?=$s[2]?> fs-2 text-primary"></i></div></div></div>
<?php endforeach;?></div>
<div class="card p-4"><div class="d-flex justify-content-between"><div><h5>Display Inventory</h5><p class="text-secondary mb-0">Manage displays and cross-brand compatibility.</p></div><a href="products.php?action=add" class="btn btn-primary">+ Add Display</a></div></div>
<?php include 'partials/footer.php'; ?>
