# Control Panel Fix Notes

This build fixes the control panel routing/runtime issues found in the previous Pro POS package.

## What was fixed

- Added sub-folder safe URL generation for cPanel deployments. The project no longer assumes it is installed only at the domain root.
- Added safe demo/setup mode when MySQL is not connected. Control-panel pages now render with sample records instead of showing blank/failing pages before database import.
- Added fallback demo authentication for admin, vendor, customer, marketing member, and POS staff while the database is not connected.
- Fixed public login redirects for affiliate/member and POS staff roles.
- Added POS staff role aliases so POS cashier/manager accounts can access the POS register pages.
- Added a shared logout endpoint at `public/logout.php`.
- Added `admin/control-panel-check.php` for deployment diagnostics.
- Patched admin/vendor/customer/member/POS layout logout links.
- Hardened module CRUD helpers to avoid database-only assumptions during first setup.

## Recommended setup flow

1. Upload the project files to cPanel.
2. Visit `public/login.php` and sign in using the demo credentials.
3. Open `admin/control-panel-check.php` to verify paths, PWA files, modules, and database state.
4. Create a MySQL database in cPanel.
5. Import `install/schema.sql` first, then `install/seed.sql`.
6. Update `app/config.php` with your real database credentials and `APP_URL`.
7. Reload `admin/control-panel-check.php`. The database row should change from setup mode to connected.

## Demo credentials before database import

- Admin: `admin@smarttech-omp.com` / `admin123`
- Vendor: `vendor@smarttech-omp.com` / `admin123`
- Customer: `customer@smarttech-omp.com` / `admin123`
- Marketing member: `member@smarttech-omp.com` / `admin123`
- POS cashier: `poscashier@smarttech-omp.com` / `admin123`
- POS manager: `posmanager@smarttech-omp.com` / `admin123`

After importing the database, credentials are loaded from the `users` table.
