Files
order/views/admin/specials.php
T
Ty Clifford 16235369cb - Implemented the full Fat Bottom Grille storefront and staff dashboard.
Highlights include configurable menus, specials, cart/checkout, taxes, 
customer accounts with email 2FA, newsletters, analytics, refunds, 
PDF/CSV exports, Square/Mailgun adapters, and optional MySQL migration.

See README.md for setup and production configuration. Verified 
PHP/JavaScript syntax, responsive layouts, registration, 2FA, checkout, 
dashboard workflows, settings persistence, and PDF generation.
Real Square, Mailgun, and MySQL connections require credentials/server 
access. Square implementation follows the official Payments API and 
Refunds API.
2026-06-10 13:27:42 -04:00

64 lines
4.6 KiB
PHP

<div class="admin-page-actions">
<p>All active specials are automatically arranged on the homepage based on how many are running.</p>
</div>
<section class="admin-panel">
<div class="admin-panel-heading">
<div><span class="eyebrow">Homepage promotion</span><h2>Specials</h2></div>
<span class="count-badge"><?= count($specials) ?> configured</span>
</div>
<div class="special-admin-grid">
<?php foreach ($specials as $special): ?>
<details class="special-admin-card">
<summary>
<span class="special-badge"><?= e($special['badge']) ?></span>
<h3><?= e($special['title']) ?></h3>
<p><?= e($special['description']) ?></p>
<div><strong><?= $special['price_cents'] !== null ? money($special['price_cents']) : 'No override' ?></strong><span class="status-dot <?= $special['active'] ? 'is-on' : '' ?>"><?= $special['active'] ? 'Active' : 'Hidden' ?></span></div>
</summary>
<form class="inline-editor form-stack" action="/admin/special/save" method="post">
<?= csrf_field() ?>
<input type="hidden" name="id" value="<?= (int) $special['id'] ?>">
<div class="form-grid">
<label>Title<input type="text" name="title" required value="<?= e($special['title']) ?>"></label>
<label>Badge<input type="text" name="badge" value="<?= e($special['badge']) ?>"></label>
<label>Linked menu item
<select name="menu_item_id">
<option value="">No linked item</option>
<?php foreach ($items as $item): ?><option value="<?= (int) $item['id'] ?>" <?= selected($special['menu_item_id'], $item['id']) ?>><?= e($item['name']) ?></option><?php endforeach; ?>
</select>
</label>
<label>Promotional price<input type="number" name="price" min="0" step="0.01" value="<?= $special['price_cents'] !== null ? number_format((int) $special['price_cents'] / 100, 2, '.', '') : '' ?>"></label>
<label class="field-wide">Description<textarea name="description" rows="2"><?= e($special['description']) ?></textarea></label>
<label>Starts at<input type="datetime-local" name="starts_at" value="<?= e(store_datetime($special['starts_at'], 'Y-m-d\TH:i')) ?>"></label>
<label>Ends at<input type="datetime-local" name="ends_at" value="<?= e(store_datetime($special['ends_at'], 'Y-m-d\TH:i')) ?>"></label>
<label>Display order<input type="number" name="display_order" value="<?= (int) $special['display_order'] ?>"></label>
<label class="check-control compact"><input type="checkbox" name="active" value="1" <?= checked($special['active']) ?>><span><strong>Active</strong></span></label>
</div>
<button class="button button-small" type="submit">Save Special</button>
</form>
</details>
<?php endforeach; ?>
</div>
<details class="new-record">
<summary>+ Add Homepage Special</summary>
<form class="inline-editor form-stack" action="/admin/special/save" method="post">
<?= csrf_field() ?>
<div class="form-grid">
<label>Title<input type="text" name="title" required></label>
<label>Badge<input type="text" name="badge" value="Special"></label>
<label>Linked menu item
<select name="menu_item_id"><option value="">No linked item</option><?php foreach ($items as $item): ?><option value="<?= (int) $item['id'] ?>"><?= e($item['name']) ?></option><?php endforeach; ?></select>
</label>
<label>Promotional price<input type="number" name="price" min="0" step="0.01"></label>
<label class="field-wide">Description<textarea name="description" rows="2"></textarea></label>
<label>Starts at<input type="datetime-local" name="starts_at"></label>
<label>Ends at<input type="datetime-local" name="ends_at"></label>
<label>Display order<input type="number" name="display_order" value="0"></label>
<label class="check-control compact"><input type="checkbox" name="active" value="1" checked><span><strong>Active</strong></span></label>
</div>
<button class="button button-small" type="submit">Create Special</button>
</form>
</details>
</section>