39094-vm/index.php
Flatlogic Bot f6d1ea8ef2 test
2026-03-10 15:19:21 +00:00

127 lines
4.2 KiB
PHP

<?php
declare(strict_types=1);
require_once __DIR__ . '/includes/layout.php';
ensure_tables();
$stores = get_stores();
$recentProducts = get_products(null, 5);
$stats = [
'stores' => count($stores),
'products' => count($recentProducts),
];
render_header('Operations Overview', 'Multi-tenant store operations dashboard for catalog and order readiness.');
?>
<section class="hero-panel mb-4">
<div class="d-flex flex-wrap align-items-center justify-content-between gap-3">
<div>
<p class="text-muted small mb-2">Multi-store readiness</p>
<h2 class="display-6 mb-2">Run catalog operations across every store.</h2>
<p class="text-muted mb-0">Create stores, keep SKU inventory accurate, and prepare the order lifecycle with clear ownership.</p>
</div>
<div class="d-flex gap-2">
<a class="btn btn-dark" href="/stores.php">Create a store</a>
<a class="btn btn-outline-dark" href="/products.php">Add product</a>
</div>
</div>
</section>
<section class="row g-3 mb-4">
<div class="col-12 col-md-4">
<div class="metric-card">
<p class="text-muted small mb-1">Active stores</p>
<h3 class="mb-0"><?= h((string)$stats['stores']) ?></h3>
</div>
</div>
<div class="col-12 col-md-4">
<div class="metric-card">
<p class="text-muted small mb-1">Recent products</p>
<h3 class="mb-0"><?= h((string)$stats['products']) ?></h3>
</div>
</div>
<div class="col-12 col-md-4">
<div class="metric-card">
<p class="text-muted small mb-1">Order pipeline</p>
<p class="mb-0 text-muted">Enable next</p>
</div>
</div>
</section>
<section class="content-card mb-4">
<div class="d-flex align-items-center justify-content-between mb-3">
<div>
<h4 class="mb-1">Recent product activity</h4>
<p class="text-muted small mb-0">Latest SKUs added across the workspace.</p>
</div>
<a class="btn btn-sm btn-outline-dark" href="/products.php">View all</a>
</div>
<?php if (empty($recentProducts)): ?>
<div class="empty-state">
<p class="mb-2">No products yet. Start by creating a store and adding its first SKU.</p>
<a class="btn btn-dark btn-sm" href="/stores.php">Create store</a>
</div>
<?php else: ?>
<div class="table-responsive">
<table class="table align-middle">
<thead>
<tr>
<th>SKU</th>
<th>Product</th>
<th>Store</th>
<th>Status</th>
<th class="text-end">Stock</th>
</tr>
</thead>
<tbody>
<?php foreach ($recentProducts as $product): ?>
<tr>
<td class="text-muted"><?= h($product['sku']) ?></td>
<td><a href="/product.php?id=<?= h((string)$product['id']) ?>" class="link-dark"><?= h($product['name']) ?></a></td>
<td><?= h($product['store_name']) ?></td>
<td><span class="badge bg-light text-dark border"><?= h(ucfirst($product['status'])) ?></span></td>
<td class="text-end"><?= h((string)$product['stock']) ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php endif; ?>
</section>
<section class="content-card">
<div class="d-flex align-items-center justify-content-between mb-3">
<div>
<h4 class="mb-1">Next slice: Orders & payments</h4>
<p class="text-muted small mb-0">Track statuses from paid to delivered with payment reconciliation.</p>
</div>
<span class="badge text-bg-light border">Coming next</span>
</div>
<div class="row g-3">
<div class="col-12 col-md-4">
<div class="mini-card">
<p class="text-muted small mb-1">Order states</p>
<p class="mb-0">New → Paid → Packed → Shipped → Delivered</p>
</div>
</div>
<div class="col-12 col-md-4">
<div class="mini-card">
<p class="text-muted small mb-1">Payments</p>
<p class="mb-0">Record partials, refunds, and settlement notes.</p>
</div>
</div>
<div class="col-12 col-md-4">
<div class="mini-card">
<p class="text-muted small mb-1">Customer ledger</p>
<p class="mb-0">Centralize contact, address, and order history.</p>
</div>
</div>
</div>
</section>
<?php render_footer(); ?>