> Part of the PWA DevGuide (split from pwa_dev_style.md on 2026-07-02 — see that file for the index; ADR-099).

## 24. Admin PWA — Extending with New Management Sections

Pattern for adding a new management section to `/admin/` without breaking existing structure.

### 24.1 Existing Admin PWA Structure

- PIN auth (harish/pramod only) via `verify_pin` RPC
- Home screen: Company tile + Employee tile
- Routes via `showSection(name)` or equivalent screen switcher
- All admin actions guarded by `ADMIN_IDS = ['harish','pramod']`

### 24.2 Adding a New Section (e.g. `/admin/client`)

1. Add a new tile to the Admin home screen
2. Add new screen `<div id="screen-xxx">` with back → admin home
3. New section fetches from whatever DB schema it manages
4. Keep the same PIN session guard — if `adminSession` is null, redirect to login

### 24.3 Client Management Section (planned)

Target: move company + client_access management out of Activity PWA's Manage screen into `/admin/`.

DB targets:
- `activity.companies` — CRUD (name, code, active)
- `activity.client_access` — list by company; add/revoke per person
- `client.accounts` + `client.access_grants` — same as existing Admin Client screen but in dedicated section

API headers needed:
```js
const ACT_H  = {'Content-Type':'application/json','Accept-Profile':'activity','Content-Profile':'activity','Prefer':'return=representation'};
const ACT_RD = {'Content-Type':'application/json','Accept-Profile':'activity'};
const CL_H   = {'Content-Type':'application/json','Accept-Profile':'client','Content-Profile':'client','Prefer':'return=representation'};
```
