# Flow — Route → Assign → Fix → Close (Maintenance Team Leader)

> Persona: **Vikram Rana** (MTL), scoped to **Game Zone Ahmedabad-1**. The happy path: an A-item is routed to maintenance, Vikram assigns it, the Technician fixes it with a photo, and it **closes internally** — never reaching the Store Manager. Source: `FOUNDATION_SPEC §4 / §4a` (WorkOrder state machine + single-track hold), `CHANGE_LIST_v1.1.md CL-2`. Screens: `MTL-WO-QUEUE` → `MTL-WO-DETAIL` → `MTL-WO-ASSIGN`. Modals: `modals/assign-technician.html`, `modals/photo-lightbox.html`.

---

## Preconditions
- Vikram is logged in (`/me` resolved role = MTL, scope = own = Ahmedabad-1). An operations Team Leader (Priya Nair) verified a submitted **Trampoline Daily** that had an A-item; on routing, the system spawned **WO-1042** (`state = ROUTED`) and put the parent checklist into **HELD**. Vikram is notified (in-app + companion push).

## Steps

1. **Spot it.** On `MTL-DASH`, the **New / Routed** KPI is non-zero and the attention strip flags held source checklists. Vikram opens **Work-Order Queue** (`MTL-WO-QUEUE`) and filters to **Routed**.
   → `GET /work-orders?scope=own&state=ROUTED` — every routed A-item WO for Ahmedabad-1 with its `wo-*` `StatusBadge`, source checklist/ride, A-item text, age/SLA.

2. **Open the WO.** Vikram clicks **WO-1042** → `MTL-WO-DETAIL`.
   → `GET /work-orders/:id` + `GET …/timeline`. The detail shows the **source A-item**, its **issue photos** (click → photo-lightbox), the **HELD banner** ("source checklist held — 2 open A-items"), and the **WorkOrder-variant ApprovalTimeline** (`Routed → Maintenance TL (you, here) → Technician → Closed/Outsourced`).

3. **Assign a technician.** Vikram clicks **Assign to Technician** → `MTL-WO-ASSIGN` (or the assign-technician modal). He picks **Arjun Mehta** (eligible = on his team, in this GZ; load badge shows Arjun's open WOs) → confirm.
   → `PATCH /work-orders/:id/assign { technicianId }` → `ROUTED → ASSIGNED`; Arjun is notified; the WO appears on Arjun's mobile **My Work-Orders**.

4. **Technician works it (other surface).** On the Technician pack, Arjun **Starts** (`ASSIGNED → IN_PROGRESS`), does the physical fix, and marks **Done with a fix photo** (`done` is photo-gated, ≥1 `WorkOrderPhoto`).
   → `PATCH /work-orders/:id/start`, then `PATCH /work-orders/:id/done` (+ photo) → `IN_PROGRESS → DONE`.

5. **It closes internally — no SM involvement.** `DONE` is a terminal state that **closes at the maintenance level**; the Store Manager is **not** notified. The WO drops off Vikram's queue (visible under the Done/closed filter for audit). The fix photo is viewable in the timeline.

6. **Last WO closes → un-HOLD the checklist.** When **every** WorkOrder for Trampoline Daily reaches a terminal state (`DONE`/`OUTSOURCED`), the parent instance auto-releases: **HELD → TL_APPROVED**, and the inspection checklist **resumes its approval cascade** (TL → SM → OH). This handoff is the operations TL's concern again, not Vikram's.

## Rules enforced in this flow
- **Internal fix = silent close (CL-2):** `DONE` closes at maintenance; only `OUTSOURCED` reaches the SM.
- **Done is photo-gated (§4a):** the Technician cannot mark Done without ≥1 fix photo.
- **Single-track hold (CL-2):** the source checklist is **HELD** the whole time and cannot reach Done until every A-item WO closes.
- **Read-only A-item:** Vikram never edits the A-item text, its recorded time, or its initials — server-stamped at fill.
- **Own-GZ scope:** Vikram only sees / acts on WOs in Ahmedabad-1; out-of-GZ WOs return 403.

## Result
- WO-1042 is **Done** (closed internally). When its sibling WO also closes, **Trampoline Daily** un-holds and climbs the cascade to Done.
