- Implemented the full order lifecycle, secure customer tracker, automatic acceptance emails, configurable status templates, and guest/account CRM management.
Key areas: [OrderStatusService.php](/Users/tyemeclifford/Documents/GH/fatbottomgrille/app/Services/OrderStatusService.php), [AdminController.php](/Users/tyemeclifford/Documents/GH/fatbottomgrille/app/Controllers/AdminController.php), and [Database.php](/Users/tyemeclifford/Documents/GH/fatbottomgrille/app/Core/Database.php). SQLite migration applied successfully. PHP/JS syntax, integration workflows, rendered pages, database integrity, and tracker authorization all passed. Invalid tracker tokens correctly return 403.
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<a class="back-link" href="<?= e(url('/admin/orders')) ?>">← Back to orders</a>
|
||||
<div class="detail-title-row">
|
||||
<h2><?= e($order['order_number']) ?></h2>
|
||||
<span class="status-pill status-<?= e($order['status']) ?>"><?= e(ucfirst((string) $order['status'])) ?></span>
|
||||
<span class="status-pill status-<?= e($order['status']) ?>"><?= e(order_status_label((string) $order['status'])) ?></span>
|
||||
</div>
|
||||
<p>Placed <?= e(store_datetime((string) $order['placed_at'], 'F j, Y \a\t g:i A')) ?></p>
|
||||
</div>
|
||||
@@ -39,8 +39,11 @@
|
||||
<div>
|
||||
<i></i>
|
||||
<span>
|
||||
<strong><?= e(ucwords(str_replace('_', ' ', (string) $event['event_type']))) ?></strong>
|
||||
<strong><?= e($event['status'] ? order_status_label((string) $event['status']) : ucwords(str_replace('_', ' ', (string) $event['event_type']))) ?></strong>
|
||||
<p><?= e($event['details']) ?></p>
|
||||
<?php if ($event['note']): ?>
|
||||
<small><?= $event['customer_visible'] ? 'Customer-visible note' : 'Internal note' ?><?= $event['email_sent'] ? ' · Emailed' : '' ?></small>
|
||||
<?php endif; ?>
|
||||
<small><?= e($event['staff_name'] ?: 'System') ?> · <?= e(store_datetime((string) $event['created_at'], 'M j, g:i A')) ?></small>
|
||||
</span>
|
||||
</div>
|
||||
@@ -50,21 +53,28 @@
|
||||
</div>
|
||||
<aside>
|
||||
<section class="admin-panel">
|
||||
<div class="admin-panel-heading"><h2>Update Order</h2></div>
|
||||
<div class="admin-panel-heading"><h2>Order Actions</h2></div>
|
||||
<form class="form-stack" action="<?= e(url('/admin/order')) ?>" method="post">
|
||||
<?= csrf_field() ?>
|
||||
<input type="hidden" name="order_id" value="<?= (int) $order['id'] ?>">
|
||||
<label>Status
|
||||
<select name="status">
|
||||
<?php foreach (['paid', 'preparing', 'ready', 'completed', 'cancelled'] as $status): ?>
|
||||
<option value="<?= $status ?>" <?= selected($order['status'], $status) ?>><?= e(ucfirst($status)) ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<label>Reason or note
|
||||
<textarea name="status_note" rows="3" placeholder="Optional. A blank rejection reason will not appear to the customer."></textarea>
|
||||
</label>
|
||||
<label>Staff note
|
||||
<textarea name="staff_note" rows="3" placeholder="Optional internal note"></textarea>
|
||||
<label class="check-control compact">
|
||||
<input type="checkbox" name="customer_visible" value="1">
|
||||
<span><strong>Show this note to the customer</strong><small>The status itself is always visible.</small></span>
|
||||
</label>
|
||||
<button class="button button-block" type="submit">Update Status</button>
|
||||
<label class="check-control compact">
|
||||
<input type="checkbox" name="send_email" value="1">
|
||||
<span><strong>Email this update</strong><small>Acceptance emails are always sent.</small></span>
|
||||
</label>
|
||||
<div class="order-action-grid">
|
||||
<button class="button" type="submit" name="status" value="accepted">Accept</button>
|
||||
<button class="button button-danger" type="submit" name="status" value="declined">Reject</button>
|
||||
<button class="button button-outline" type="submit" name="status" value="processing">Start Order</button>
|
||||
<button class="button" type="submit" name="status" value="ready">Complete / Ready</button>
|
||||
<button class="button button-ghost" type="submit" name="status" value="completed">Picked Up</button>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
<section class="admin-panel">
|
||||
@@ -74,6 +84,9 @@
|
||||
<a href="mailto:<?= e($order['customer_email']) ?>"><?= e($order['customer_email']) ?></a>
|
||||
<a href="tel:<?= e(preg_replace('/[^0-9+]/', '', (string) $order['customer_phone'])) ?>"><?= e($order['customer_phone']) ?></a>
|
||||
<span>Pickup<?= $order['pickup_time'] ? ' at ' . e($order['pickup_time']) : '' ?></span>
|
||||
<?php if ($customer): ?>
|
||||
<a class="button button-small button-ghost" href="<?= e(url('/admin/customer')) ?>?id=<?= (int) $customer['id'] ?>">Open CRM Profile</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</section>
|
||||
<section class="admin-panel">
|
||||
|
||||
Reference in New Issue
Block a user