THE LABS GADGET CRM — PHASE 9: DAILY OPERATIONS & OVERDUE ALERTS
================================================================
PHP 8.x / Existing CRM Phase 8B database / no migration.

WHAT THIS PATCH DOES
- Adds six Daily Operations cards to dashboard.php:
  Registered Today; Repairs In Progress; Ready for Collection;
  Collected Today; Today's Sales; Follow-Ups Due.
- Adds Overdue Repair Alerts (Pending >=24h, Checking >=24h,
  Repairing >=48h) including clickable repair details.
- Adds operations.php for a full summary and up to 100 overdue jobs.
- Adds crm-operations.php read-only query library and assets/operations.css.
- Includes dashboard-data.php with the existing Repairs In Progress count
  (from the earlier tested repair-progress patch).
- Dashboard's old five repair status cards, sales trend, staff/security
  controls remain present. The official logo and English UI are preserved.

DATA RULES
- Date-based metrics use Malaysian calendar days (Asia/Kuala_Lumpur),
  converted to UTC for database comparisons. Current counts cover all
  relevant repair jobs, while 'Today' cards cover the current KL date.
- Overdue timers measure time since the genuine status change; pause/
  resume and staff reassign events do not reset the age.
- Store-wide repair-operation counts and queue: Owner, Manager, Accounts/HR,
  Frontdesk. Other roles: assigned repair jobs only.
- Store-wide sales totals: ONLY Owner, Manager and Accounts/HR.
  All other roles: only their own paid sales_ledger transactions.
- Voided sales never enter totals (sales_ledger.status='paid' only).
- Follow-Up Due: Collected >=72 hours ago and not confirmed completed.
- No WhatsApp sends, notifications, database updates, or auto-escalations.
  This feature is a read-only dashboard; refresh page to update data.
- Thresholds: crm-operations.php > tlgops_alert_hours().
- Missing data shows a dash rather than fictitious values.

INSTALL (PLEASE FOLLOW IN ORDER)
1. BACK UP dashboard.php and dashboard-data.php from your live CRM folder.
   Also export your existing database as an SQL backup. Download backups
   to a safe location outside public_html.
2. Upload ZIP to the ACTUAL Document Root for crm.thelabsgadget.com.
3. Extract there. Allow overwrite ONLY for dashboard.php and
   dashboard-data.php. All other files in the ZIP should be NEW.
4. No upgrade/activation script and no SQL import needed.
5. Log in as Owner, open dashboard.php and operations.php. Check:
   a. Today's registrations and collections against Repair Records.
   b. Sales totals and excluded void test payments.
   c. Due follow-up count vs. followups.php.
   d. Overdue list and links to actual repair jobs.
   e. Log in as Technician to confirm restricted sales and assigned jobs.
6. If errors appear, restore backed-up dashboard.php and
   dashboard-data.php; remove the new Phase9 files if needed.

FILES IN ZIP
 dashboard.php             [REPLACE]
 dashboard-data.php        [REPLACE]
 operations.php            [NEW]
 crm-operations.php        [NEW]
 assets/operations.css     [NEW]
 README-PHASE9.txt         [NEW]

No config.php, credentials, database wipe, or installer is included.

SAFETY NOTE
Static PHP lint and rule/unit assertions were run locally, but
live database connectivity cannot be tested here. Test on a backup/staging
site first if you have one; keep regular database backups.
