Add pub hours admin panel, rebuild announcements/users lists on CSS Grid
- Add a Hours admin panel (admin/hours.php, admin/hours.js) for editing the weekly open/close schedule and an optional per-day kitchen closing time, with a live preview of how it'll read on the public site - Store hours in a new pub_hours table (inc/db.php), seeded with the site's existing Thu-Sat/9pm-kitchen schedule; inc/hours.php formats and groups it for display (day ranges, kitchen-close note, footer summary) - Wire the public Visit card and both site footers (index.php, menu.php) to read hours from that data instead of hardcoded copy - Rebuild the Announcements and Users admin tables onto the same CSS Grid list pattern already used for the Menu (admin-table-actions -> row-actions), and make the Announcements status toggle an in-place AJAX action like the menu item's (admin/index.js) - Add the Hours tab to admin nav across all four admin pages Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
fd928a24cf
commit
eab20899de
14 files changed
+1224
-441
No files matched your search
@@ -0,0 +1,34 @@
|
||||
// Announcements admin page: intercepts the status badge's toggle form so
|
||||
// clicking it updates in place via fetch instead of reloading the whole
|
||||
// page — same interaction as the menu item's status toggle. Everything
|
||||
// else here (create/edit/delete) is still a plain form POST + reload.
|
||||
|
||||
document.addEventListener('submit', async (e) => {
|
||||
const form = e.target;
|
||||
if (!form.classList.contains('status-toggle-form')) return;
|
||||
|
||||
e.preventDefault();
|
||||
const btn = form.querySelector('button');
|
||||
btn.disabled = true;
|
||||
|
||||
try {
|
||||
const response = await fetch('index.php', {
|
||||
method: 'POST',
|
||||
body: new FormData(form),
|
||||
headers: { 'X-Requested-With': 'XMLHttpRequest' }
|
||||
});
|
||||
const data = await response.json();
|
||||
|
||||
if (data.success) {
|
||||
btn.className = `status-badge ${data.status_class}`;
|
||||
btn.textContent = data.status_label;
|
||||
btn.title = `Click to turn ${data.is_active ? 'off' : 'on'}`;
|
||||
} else {
|
||||
alert(data.error || 'Failed to update status.');
|
||||
}
|
||||
} catch {
|
||||
alert('Network error. Please try again.');
|
||||
} finally {
|
||||
btn.disabled = false;
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user