THE LABS GADGET CRM — PHASE 15
STAFF ATTENDANCE & HR MANAGEMENT
==========================================

FEATURES
- Clock In / Clock Out per logged-in employee (server time in UTC; MYT on screen).
- Start Break / End Break; break duration excluded from net attendance time.
- Active-shift protection with row locking; second Clock In on same account is rejected.
- Monthly timesheet and UTF-8 CSV download; staff only see their own records.
- Owner/Accounts HR can view team attendance and correct/close a shift with mandatory
  justification and audit logging. Accounts HR cannot correct their own/Owner records.
- Leave applications (Annual, Sick, Unpaid, Emergency, Other), withdrawal while
  Pending, review by Owner/Accounts HR, no self-approval and overlap prevention.
- Weekly work roster with shifts, overnight times, breaks and explicit rest days.
- Overtime requests/approval (NOT payroll overtime calculations).
- Existing English CRM interface, official white logo and futuristic dark blue theme.

ACCESS
- Owner (admin): manage team, review leave and OT, fix attendance, set roster,
  view/download team attendance. Can use Clock In/Out for own account if desired.
- Accounts/HR (accounts): same team management except no Owner security, no
  modifying Owner/self attendance, and no self-approvals.
- Manager / Technician / Frontdesk / Staff: own Clock In/Out, roster, leave,
  overtime requests and attendance CSV only; no access to other employees' data.
- Does not modify Fasa 10 permission settings or your retail sales permissions.

INSTALL (BACKUP BEFORE EXTRACT)
1. Back up entire working CRM folder and export SQL database from phpMyAdmin.
2. Separately back up current dashboard.php and crm3.php. The supplied versions
   are based on the latest Phase 14 CRM and Phase 11 Dashboard respectively.
   If your versions have been customized, MERGE the two nav links instead of
   blindly overwriting these files.
3. Upload this ZIP into the verified DOCUMENT ROOT of crm.thelabsgadget.com.
4. Extract keeping directories. Only these existing files are overwritten:
       crm3.php
       dashboard.php
   New files:
       crm-hr.php
       hr.php
       hr-attendance.php
       hr-leave.php
       hr-roster.php
       hr-overtime.php
       upgrade-fasa15.php
       assets/hr.css
       README-PHASE15.txt
   Does NOT include config.php, app.php, sales, inventory, user/password tables.
5. As OWNER, visit https://crm.thelabsgadget.com/upgrade-fasa15.php
6. Click Activate Phase 15. It creates five new HR tables:
       hr_attendance
       hr_attendance_audit
       hr_leave_requests
       hr_roster
       hr_overtime_requests
   Existing tables and rows are not overwritten by this migration.
7. On SUCCESS, immediately DELETE upgrade-fasa15.php from your web server.
8. Open https://crm.thelabsgadget.com/hr.php and test on staff test accounts.

PRACTICAL TESTS BEFORE LIVE USE
A. Clock In on staff login; ensure second Clock In is prevented.
B. Start Break, wait, End Break, Clock Out; refresh and confirm duration retained.
C. Owner/HR sees team shifts, staff sees own shifts only; staff can't change URL
   parameters to see another person's attendance or export other users' CSV.
D. Owner/HR corrects one TEST shift with a reason; audit shows original and new.
E. Staff applies for TEST leave; another authorized user Approves/Rejects.
F. HR creates an off day and an overnight working shift; assigned staff can view.
G. Staff requests TEST overtime; another authorized user reviews it.
H. Verify no modification to CRM POS, sales, repair, warranty and inventory data.

IMPORTANT LIMITATIONS
- This is operational time tracking, NOT a payroll system or a statutory hours,
  holiday, leave entitlement, overtime rate or payslip compliance calculator.
- An employee's ability to click Clock In does not prove physical presence;
  geolocation, biometric verification, device binding and anti-fraud are NOT present.
- Shift duration and weekly rest arrangement should be approved by HR against
  employee contracts and Malaysian Employment Act requirements before using live.
- Leave durations use calendar date ranges; working-day balances are not computed.
- OT requests are recorded separately from hours actually worked. Approval does
  not automatically create payable hours, wage deductions or bank transactions.
- No external WhatsApp, email, push or calendar notifications are sent.
- Timesheet export includes at most 500 entries per filtered month in this version;
  use additional archival/reporting for high-volume history.
- Technical checks completed with PHP 8.4 lint and date conversion tests. Actual
  MySQL/cPanel integration remains to be verified after deployment.

ROLLBACK
- Before activation: restore the two backed-up PHP files and delete new HR pages.
- After activation: revert two overwritten PHP files to restore old navigation;
  HR data/tables will remain in the database for safe inspection. DO NOT drop HR
  tables without verifying backups and dependencies.
- Existing customer/repair/payment/inventory data is not migrated or deleted.

LOYVERSE MIGRATION remains postponed until the final phase as requested.
