# Round 5 — Upgrade notes

## 1. Install (fixes the `composer install` error)
`composer.lock` now contains `mike42/escpos-php v4.0` and its dependency `mike42/gfx-php v0.6`
(content-hash matches composer.json, `composer validate` passes).

    composer install
    php artisan optimize:clear
    php artisan migrate            # 1 new migration: 2024_06_03_000001_add_dynamic_permissions_to_roles_table
    php artisan test               # 11 new tests should pass

The printer library needs PHP extensions `intl`, `zlib` (and optionally `gd`). If composer complains, enable them in php.ini.
The stale `bootstrap/cache/config.php` and `routes-v7.php` that shipped in the zip were removed (they would hide the new routes).

## 2. Exports (CSV, Excel, PDF)
Every report and the Dashboard have an **Export** drop-down: Dashboard, Sales, Restaurant, Bar, Inventory,
Financial (P&L), Audit Trail, VAT, Daily Levy, eTIMS log. Files contain exactly what is on screen (same period/filters).
Core: `App\Services\ReportExporter`, `App\Support\ReportDocument`, `App\Exports\*`, `resources/views/exports/report.blade.php`.
To add export to a new report: build a `ReportDocument`, call `$exporter->download($doc, $format, 'name')`, add a route
`.../export/{format}` and `<x-export-menu route="..."/>`.

## 3. Dynamic permissions
* Settings → **Roles & Permissions**: pick a role, tick Menus, Actions, Dashboard Widgets, Other Widgets & Data, Save.
* 85 permissions in `App\Support\Permissions` (catalogue + defaults). Stored per role in `roles.permissions` (JSON).
* Enforced three ways: route middleware `permission:key` (direct URLs → 403), `@can('key')` in views, and server-side
  checks (discounts, complimentary items, credit-limit override). Sidebar, Dashboard widgets, exports and search respect it.
* Administrator is locked to full access. Standard roles can be reset; custom roles can be created/copied/deleted.
* Existing custom roles are converted best-effort by the migration — **review them once** on the Roles screen.
* Users with no Dashboard permission are redirected to the first page their role can open.

## 4. User Guide
`public/docs/Hotel-POS-User-Guide.pdf` (23 pages, plain language). Shown in the menu under Help → User Guide
(permission `guide.view`).
