THE LABS GADGET — COMBINED HR + WEEKLY SHIFTS V1.7
==================================================
Purpose:
One Owner/Admin Employees page for editing employee profile information and weekly shift schedules. No need to switch between Employees and Weekly Shifts to edit an individual employee's work timetable.

COMPATIBLE WITH:
- Finance & HR V1.5 (Weekly Shift + GPS 150m standard version)
- Finance & HR V1.6 (HR Employee Editor standard version)

ADDED:
- Employees > click a name / Profile + Shifts
- Edit name, email, staff code, position, salary, login role (Owner only)
- Immediately below, edit the selected employee's 7-day roster for a chosen week
- Working / Off Day / Not Set, start/end times and late grace minutes
- Previous / current / next week navigation in that employee profile
- Separate Save buttons for employee details and shifts
- Save shift returns to the selected employee profile
- Shift days with attendance recorded are locked; existing attendance records remain
- Manager retains ability to change schedules in Weekly Shifts; does NOT gain salary / HR profile access
- Staff continue to see only their schedules, no salary access
- GPS 150m remains unchanged

BEFORE INSTALL:
1. Back up the Finance database (thelabsgadget_thelabsgadget_finance).
2. Back up financehub/app/ (and ideally entire financehub directory).
3. Do not use/modify CRM's original database or root folder.
4. If there are uninstalled patches or modified app files, finish checking version before installing.

INSTALL VIA cPANEL:
1. Open File Manager > the document root of crm.thelabsgadget.com > financehub.
2. Upload The_Labs_Gadget_HR_Combined_Shifts_PATCH_V1_7.zip.
3. Extract directly inside financehub. The folder patch_hr_v1_7 should appear.
4. Do not manually move patch_hr_v1_7/app into financehub/app.
5. Log in as Owner/Admin in Finance & HR.
6. Open https://crm.thelabsgadget.com/financehub/upgrade_hr_v1_7.php
7. Click Install Combined HR V1.7 ONCE. Read the result.
8. Open Employees, select a staff member, test their HR details and weekly shifts.
9. Test that old Weekly Shifts, Attendance GPS, Finance and PV still work.
10. After verifying the update, delete upgrade_hr_v1_7.php and patch_hr_v1_7/ from financehub.

SAFETY:
- Updater verifies exact V1.5 or V1.6 files and only installs when compatible.
- Backups of replaced files are made inside app/hr_combined_v17_backup_... and blocked by .htaccess.
- Replaces only app/actions.php, app/views.php, app/roster.php. Adds app/employee_schedule.php and assets/hr-profile.css.
- Finance DB only: if updating from V1.5, creates fh_employee_edit_history (V1.6 functionality). No data deleted.
- Does not touch any CRM database or the original CRM app.
- Do not run an updater in parallel with active staff clock-ins or roster edits; install outside busy hours.
- One-day shifts only (end must be later than start). Overnight shifts unsupported.
- Errors in hosting configuration or customised files require review; do not force overwrite.

IF AN UPGRADE FAILS:
- Do not click repeatedly; take a screenshot of the error, hiding passwords.
- Do not copy patch files into app manually.
- Keep the backup and ask for help.

ROLLBACK:
- Restore backed-up Finance files and Finance DB after evaluating any changes made since the backup.
- Never restore/delete the separate CRM database to roll back this feature.

TEST STATUS:
- PHP lint passed (PHP 8.4 CLI).
- Simulated HR page render and 7-day roster controls passed.
- Simulated updater tests passed for both V1.5 and V1.6; idempotency checked.
- LIVE HOSTING AND REAL DATABASE/GPS TESTS MUST BE PERFORMED AFTER INSTALL.
