# AMC Agency Management Console — HTML interface prototype

A standalone, navigable interface specification for the AMC staff console. It uses plain HTML5, one shared CSS file and classic (non-module) vanilla JavaScript. There is no build step, no framework, no backend, no CDN, no external fonts or icons, and no calls to any live service.

## Opening it

1. Unzip the folder anywhere.
2. Double-click `index.html`. It works over `file://` because there is no `fetch()` and no ES-module loading.
3. Choose a synthetic agency profile and role, then select **Continue to demo console**. The sign-in is a demo only: static files cannot authenticate anyone.
4. Every page has a **Prototype controls** button in the bottom-left corner. Use it to switch:
   - agency, menu preset (A/B/C) and brand (GNB/Acquaint)
   - role
   - environment
   - individual features, for example 117 AMC Pro, 209 Soluto and 212 Maintenance v3
   - runtime settings, for example `diary_dynamic_enabled` and `disable_sales_progression_tabs`
   - the screen state: populated, loading, empty, error/retry, validation, read-only, permission denied or feature unavailable

   The same panel resets this prototype's stored data for the current demo agency.
5. `coverage.html` lists every catalogue declaration, every destination page, every commented/dormant declaration and every feature. It shows each item's classification, conditions, destination link, visibility for the current profile and any unresolved issue.

You can also serve the folder with any static web server. All links are relative.

## Structure

```
index.html                 demo sign-in + profile chooser
coverage.html              coverage of every inventory item (live from the catalogue)
pages/<module>/<key>.html  one real file per destination (844), e.g. pages/properties/notices--c-44--s-0.html
assets/css/amc.css         design tokens + components + responsive + print
assets/js/catalogue.js     GENERATED from the menu spec: rows, rules, bindings, features, capabilities, dormant rows
assets/js/config.js        central configuration model + visibility engine (presets, rules, roles, access, nav trees, launchpad)
assets/js/fixtures.js      deterministic synthetic data per demo agency (pence integers)
assets/js/data-adapter.js  data boundary (AMCData) — replace with Laravel API calls
assets/js/shell.js         header, sidebar, search, launchpad, Add menu, bookmarks, breadcrumbs, page guard
assets/js/components.js    elements, icons, dialogs, drawers, toasts, tables, forms, drafts, CSV
assets/js/screens*.js      workflow screens + router (legacy filename → screen)
assets/js/prototype-controls.js   PREVIEW ONLY — remove this file and its script tag for production
tools/build.py             regenerates catalogue.js, pages/, ROUTE-MAP.json, PAGE-INVENTORY.md from the spec
reference/                 the supplied specifications (inputs)
PAGE-INVENTORY.md  ROUTE-MAP.json  BUILD-STATUS.md  ASSUMPTIONS.md
```

To regenerate after the spec changes, run `python3 tools/build.py reference/AMC-MENU-AND-AGENCY-INTERFACE-SPEC.md`. Node is optional; the build uses it to validate the translated rule expressions.

## How visibility works

- `config.js` evaluates the source predicates (R001…R325) against the selected profile. It handles agency allow-lists and exclusions, features, brand, settings and agency fields, and dynamic labels and destinations, with the latest applicable binding winning.
- Parent gates apply to all descendants, and empty groups are removed.
- The same model drives the sidebar, global search, launchpad, Add menu, workspace tabs, bookmarks, row and page actions, and direct page opening. A blocked page shows **permission denied**, **feature unavailable** or **not in this preset/agency**.
- Navigation keys are composite (`preset:surface:parent:id:destination`). Numeric IDs are never treated as unique.
- Three predicates use runtime-only data that could not be translated. Their effect is set by the "Treat runtime-configured conditions as met" switch.
- **This is a simulation.** Hiding things in the browser is not authorization and does not isolate tenants. The Laravel backend must enforce every check (see `reference/AMC-LARAVEL-SECURE-REBUILD-PLAN.md`, SEC-01 to SEC-03).

## Moving to Laravel

- Screens only call `AMCData` (list, get, create, update, remove, load). Replace `data-adapter.js` with API calls; the screens can stay as they are.
- Replace the client-side `AMC.access()` and `navTree()` with a server-returned list of permitted navigation keys and capabilities.
- Delete `prototype-controls.js` and the demo sign-in.
- `ROUTE-MAP.json` maps each legacy file plus its meaningful query parameters to the new destination. It includes related-route (highlight) mappings and dormant declarations.

## Safety

- All people, addresses and numbers are invented.
- Phone numbers use the 07700 900xxx drama range, and email addresses use `example.test`.
- Payments, BACS, Soluto, e-sign, portal sync and messaging are simulated and labelled as such. Nothing is sent or charged.
