111 lines
5.2 KiB
PHP
111 lines
5.2 KiB
PHP
<div class="page-header">
|
|
<div>
|
|
<h1 class="page-title">Products & Inventory</h1>
|
|
<p class="page-subtitle">Manage catalog items, pricing, and stock levels</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div style="display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; align-items: start;">
|
|
|
|
<!-- Products Table -->
|
|
<div class="card">
|
|
<div class="card-header">
|
|
<h2 class="card-title">Available Products (<?= count($products) ?>)</h2>
|
|
</div>
|
|
<div class="table-responsive">
|
|
<table class="table">
|
|
<thead>
|
|
<tr>
|
|
<th>SKU</th>
|
|
<th>Product Name</th>
|
|
<th>Category</th>
|
|
<th>Price</th>
|
|
<th>Stock</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php if (empty($products)): ?>
|
|
<tr>
|
|
<td colspan="5" style="text-align: center; color: var(--text-muted); padding: 2rem;">
|
|
No products found in the catalog.
|
|
</td>
|
|
</tr>
|
|
<?php else: ?>
|
|
<?php foreach ($products as $prod): ?>
|
|
<tr>
|
|
<td style="font-family: monospace; font-weight: 600; font-size: 0.85rem;"><?= e($prod['sku']) ?></td>
|
|
<td>
|
|
<div style="font-weight: 600;"><?= e($prod['name']) ?></div>
|
|
<?php if (!empty($prod['description'])): ?>
|
|
<div style="font-size: 0.8rem; color: var(--text-muted); max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">
|
|
<?= e($prod['description']) ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
</td>
|
|
<td><span class="badge badge-neutral"><?= e($prod['category']) ?></span></td>
|
|
<td style="font-weight: 600;"><?= money($prod['price']) ?></td>
|
|
<td>
|
|
<?php if ($prod['stock'] <= 5): ?>
|
|
<span class="badge badge-cancelled"><?= e($prod['stock']) ?> (Low)</span>
|
|
<?php elseif ($prod['stock'] <= 25): ?>
|
|
<span class="badge badge-pending"><?= e($prod['stock']) ?></span>
|
|
<?php else: ?>
|
|
<span class="badge badge-completed"><?= e($prod['stock']) ?></span>
|
|
<?php endif; ?>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
<?php endif; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Add Product Form -->
|
|
<div class="card">
|
|
<div class="card-header">
|
|
<h2 class="card-title">Add New Product</h2>
|
|
</div>
|
|
<div class="card-body">
|
|
<form method="POST" action="/products">
|
|
<?= \App\Core\View::csrfField() ?>
|
|
|
|
<div class="form-group">
|
|
<label class="form-label">SKU / Code <span style="color: var(--danger);">*</span></label>
|
|
<input type="text" name="sku" class="form-control" placeholder="e.g. PROD-007" required>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="form-label">Product Name <span style="color: var(--danger);">*</span></label>
|
|
<input type="text" name="name" class="form-control" placeholder="e.g. Ergonomic Keyboard" required>
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
<div class="form-group">
|
|
<label class="form-label">Price ($) <span style="color: var(--danger);">*</span></label>
|
|
<input type="number" step="0.01" min="0.01" name="price" class="form-control" placeholder="49.99" required>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="form-label">Initial Stock <span style="color: var(--danger);">*</span></label>
|
|
<input type="number" min="0" name="stock" class="form-control" placeholder="50" required>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="form-label">Category</label>
|
|
<input type="text" name="category" class="form-control" placeholder="Electronics, Accessories, etc.">
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="form-label">Description</label>
|
|
<textarea name="description" class="form-textarea" rows="2" placeholder="Brief product overview..."></textarea>
|
|
</div>
|
|
|
|
<button type="submit" class="btn btn-primary" style="width: 100%;">Create Product</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|