THE LABS GADGET CRM — PHASE 3 UPGRADE (ENGLISH + OFFICIAL WHITE LOGO)
======================================================================
Compatibility: Add-on for the previously installed Phase 1 login and Phase 2 dashboard.
PHP 8.4 / MariaDB / cPanel. No WordPress or plugin installation needed.

IMPORTANT BEFORE UPLOAD
1. Back up the LIVE CRM folder and export the database using phpMyAdmin.
2. Confirm Phase 1 and Phase 2 are already working and that you can sign in as Owner.
3. Use the correct CRM domain DOCUMENT ROOT (check cPanel > Domains).
4. Do not delete or modify config.php, users, passwords or the existing database.

INSTALL
1. Upload this ZIP into the existing CRM document root, e.g.
   public_html/crm.thelabsgadget.com/ if that is the verified document root.
2. Extract into the SAME folder; allow overwrite for files included in this ZIP.
   NOTE: This ZIP deliberately contains NO config.php and NO setup.php.
3. Sign in as OWNER / Admin and open:
   https://crm.thelabsgadget.com/upgrade-fasa3.php
4. Click "Activate Phase 3" ONCE. Creates three additive tables:
   customers, repair_jobs, repair_events.
5. After a SUCCESS message, delete upgrade-fasa3.php from File Manager.
6. Reload dashboard.php and open Customers or Repair Records via the sidebar.
7. Test with a DEMO customer/device that is clearly identified as a test,
   then delete test records using phpMyAdmin ONLY if safe to do so; this version
   intentionally has no delete feature to preserve audit history.

FEATURES INCLUDED
- English navigation and main screens; official white logo with transparent
  background in Login, Owner staff admin, Password screen, Dashboard, Phase 3
  pages, and favicon.
- Customer registration and search; phone number unique in customer directory.
- Register device + automatically create/reuse customer by phone, assign
  technician (Owner/Manager), mark new jobs Pending, and show job reference.
- Repair records, filter and search by customer, phone, model, job ID or status.
- Job detail, notes, repair status updates, staff activity/audit history.
- Repair status sequence: Pending > Checking > Repairing > Completed > Collected.
  Other supported transitions: Checking > Completed; Repairing > Checking;
  completed > Repairing (reopen), cancel by Owner/Manager; cancelled > Pending
  (Owner/Manager). Collected is a final state.
- Server-side access enforcement:
  Owner/Manager can update statuses + assign technicians;
  Technician can move jobs through checking/repairing/completed;
  Frontdesk can move Pending > Checking or Completed > Collected;
  Accounts/HR can mark Completed > Collected;
  generic Staff can register and read, not change status.
- Dashboard updates four status counts automatically from repair_jobs.
- Sales visibility unchanged: Owner/Manager/Accounts-HR can see total store
  sales; others only their own sales (as implemented in Phase 2).
- Collected jobs are NOT automatically treated as paid sales.

IMPORTANT LIMITATIONS
- Payment/receipt/invoice, cost of goods, warranty and WhatsApp messages are
  NOT yet implemented. That will be done in subsequent phases.
- Fasa2 dashboard uses a separate sales_ledger table for paid sales.
- Actual cPanel database functionality was not tested remotely. A successful
  PHP syntax check cannot guarantee runtime DB access or permissions.
- Individual repair records and customer data may include sensitive customer
  information; never share screenshots showing phone numbers or IMEIs.
- Run CRM only over HTTPS, use separate staff accounts, and remove upgrade
  scripts after use.

RECORD DEFINITION
Registered Devices: all repair_jobs, including cancelled jobs.
Pending & Checking: status pending or checking.
Repairs Completed: status completed only (waiting collection).
Devices Collected: status collected only.
A job in Repairing remains under Registered but not Pending/Checking/Completed.

UPGRADE FILES
Replaced: app.php, admin.php, login.php, change-password.php, dashboard.php.
Added: crm3.php, customers.php, repair-new.php, repair-view.php, repairs.php,
       upgrade-fasa3.php, assets/phase3.css, assets/branding.css,
       assets/tlg-logo-white.png, assets/tlg-favicon.png.
Kept in place: config.php, .htaccess, staff.php, dashboard-data.php,
       assets/style.css, assets/dashboard-v2.css, assets/dashboard-v2.js,
       existing customer/staff/account data and other files.

If a page shows "Phase 3 not active", make sure you activated the migration
as Owner. If an error occurs, use the backup rather than erasing database.
