# PeakHour admin: Phase 4b of 4c (Catalogue, Orders, Reviews, Notifications, Devices, Analytics)

Server untouched again: **nothing to upload to the server, no SQL.** Unzip over your `admin-site/` and run `firebase deploy --only hosting`.

## Files
NEW: `public/js/lookup.js`, `public/js/pages/{catalogue,orders,reviews,notifications,devices,analytics}.js`
REPLACED: `public/js/manifest.js` (adds the 6 screens), `public/css/app.css` (a few lines appended). Everything else is as in 4a.

## Screens (live API)
- **Catalogue** (3 tabs): *Categories* add/edit/delete (server refuses delete while it has products); *Products* search + category filter, add/edit/delete (shows who sells it; deleting removes every supplier's price, type DELETE); *Supplier prices* pick a supplier, add product, edit price, toggle stock, remove. Slugs are auto-suggested from the name and fixed after creation.
- **Orders**: status tabs with counts, supplier, date range, search (BC-1001, buyer, phone, product). Detail: buyer/supplier links, payment, delivery + map link, review, **proof-of-payment image**, change status with an unticked "tell the buyer" box, delete (type DELETE).
- **Reviews**: filters (supplier, stars, text), delete (shows the supplier's new rating), "Recalc" per supplier.
- **Notifications**: send to one user (search, or arrive from the user page) or everyone (must type SEND). Tells you if push isn't configured or the user has no device. History with filters and delete.
- **Devices**: masked tokens only, remove one.
- **Analytics**: 7/30/90/all days, totals, events chart, per-supplier table (views, visitors, product views, calls, WhatsApp, directions, orders), top products.
The Suppliers screen now shows "Edit prices & stock" and order links, and the Users screen "Send notification", automatically.

## Checked
Same method as 4a: your real PHP on scratch SQLite, headless phone browser, no JS errors. Exercised: create category + product + supplier price, order detail with a real proof image, status change with notify, review delete (rating recalculated 4.5), user and everyone notifications (SEND gate), device remove, analytics. Not run: MySQL, FCM, real phone.

## Notes
- Without FCM configured, announcements are saved in the app inbox but phones aren't alerted. The site says so after sending.
- Deleting a review keeps the order marked reviewed, so that buyer cannot post a second one (Phase 2 decision).
- Supplier list dropdowns load up to 100 per page, all pages.

## Left: Phase 4c
Danger Zone (10 resets, row counts, typed word, Download backup, last-run), Log screen, final README (Termux deploy, API off switch), single final zip, delete/replace list.
