93 lines
4.5 KiB
PHP
93 lines
4.5 KiB
PHP
<div class="page-header">
|
|
<div>
|
|
<h1 class="page-title">Orders</h1>
|
|
<p class="page-subtitle">Track, filter, and manage customer orders</p>
|
|
</div>
|
|
<div>
|
|
<a href="/orders/create" class="btn btn-primary">+ Create New Order</a>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Filters & Search -->
|
|
<div class="card" style="margin-bottom: 1.25rem;">
|
|
<div class="card-body" style="padding: 1rem 1.25rem;">
|
|
<form method="GET" action="/orders" class="filter-bar" style="margin-bottom: 0;">
|
|
<div style="flex: 1; min-width: 240px;">
|
|
<input type="text" name="search" class="form-control" placeholder="Search by Order #, Customer name or email..." value="<?= e($search ?? '') ?>">
|
|
</div>
|
|
|
|
<div style="min-width: 180px;">
|
|
<select name="status" class="form-select" onchange="this.form.submit()">
|
|
<option value="all" <?= ($currentStatus ?? 'all') === 'all' ? 'selected' : '' ?>>All Statuses</option>
|
|
<option value="Pending" <?= ($currentStatus ?? '') === 'Pending' ? 'selected' : '' ?>>Pending</option>
|
|
<option value="Processing" <?= ($currentStatus ?? '') === 'Processing' ? 'selected' : '' ?>>Processing</option>
|
|
<option value="Completed" <?= ($currentStatus ?? '') === 'Completed' ? 'selected' : '' ?>>Completed</option>
|
|
<option value="Cancelled" <?= ($currentStatus ?? '') === 'Cancelled' ? 'selected' : '' ?>>Cancelled</option>
|
|
</select>
|
|
</div>
|
|
|
|
<button type="submit" class="btn btn-secondary">Search</button>
|
|
<?php if (!empty($search) || ($currentStatus ?? 'all') !== 'all'): ?>
|
|
<a href="/orders" class="btn btn-secondary" style="color: var(--danger);">Reset</a>
|
|
<?php endif; ?>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Orders Table -->
|
|
<div class="card">
|
|
<div class="table-responsive">
|
|
<table class="table">
|
|
<thead>
|
|
<tr>
|
|
<th>Order Number</th>
|
|
<th>Customer</th>
|
|
<th>Subtotal</th>
|
|
<th>Tax</th>
|
|
<th>Discount</th>
|
|
<th>Total</th>
|
|
<th>Status</th>
|
|
<th>Date</th>
|
|
<th style="text-align: right;">Action</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php if (empty($orders)): ?>
|
|
<tr>
|
|
<td colspan="9" style="text-align: center; color: var(--text-muted); padding: 3rem;">
|
|
No orders found matching your filter criteria.
|
|
</td>
|
|
</tr>
|
|
<?php else: ?>
|
|
<?php foreach ($orders as $order): ?>
|
|
<tr>
|
|
<td>
|
|
<a href="/orders/<?= e($order['id']) ?>" style="font-weight: 600; color: var(--primary); text-decoration: none;">
|
|
<?= e($order['order_number']) ?>
|
|
</a>
|
|
</td>
|
|
<td>
|
|
<div style="font-weight: 500;"><?= e($order['customer_name']) ?></div>
|
|
<div style="font-size: 0.8rem; color: var(--text-muted);"><?= e($order['customer_email']) ?></div>
|
|
</td>
|
|
<td><?= money($order['subtotal']) ?></td>
|
|
<td><?= money($order['tax']) ?></td>
|
|
<td style="color: var(--danger);">-<?= money($order['discount']) ?></td>
|
|
<td style="font-weight: 700; color: var(--primary); font-size: 1rem;"><?= money($order['total']) ?></td>
|
|
<td>
|
|
<span class="badge badge-<?= strtolower(e($order['status'])) ?>">
|
|
<?= e($order['status']) ?>
|
|
</span>
|
|
</td>
|
|
<td style="color: var(--text-muted); font-size: 0.85rem;"><?= date('Y-m-d H:i', strtotime($order['created_at'])) ?></td>
|
|
<td style="text-align: right;">
|
|
<a href="/orders/<?= e($order['id']) ?>" class="btn btn-secondary btn-sm">Details</a>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
<?php endif; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|