# Flow — Verify & Approve a Submission (Team Leader)

> Persona: **Priya** (TL), Game Zone Ahmedabad-1, team = {Ramesh (MON), Karan (SCM), Suresh (CS)}. Source: `WORKFLOW_GUIDE Stage F1` + `PROJECT_PLAN §4b`. Screens: `TL-DASH` / `TL-CHK-OVERVIEW` → `TL-CHK-VERIFY`. Modals: `photo-viewer.html`.

---

## Preconditions
- Ramesh (MON) has filled and **submitted** Trampoline Daily (`MON-CHK-SUBMIT` → `POST …/submit`). The cascade created `ApprovalStep`s (TL/SM/OH), state = `SUBMITTED`, and **Priya was notified** (`CHECKLIST_SUBMITTED`). The instance is in Priya's verify queue.

## Steps

1. **See the queue.** Priya signs in → `TL-DASH`. The **Awaiting my approval** KPI shows a count; the verify-queue panel lists Ramesh's Trampoline Daily ("Submitted · awaiting TL"). She clicks it (or opens `TL-CHK-OVERVIEW` → tab Active → **Verify**).
   → App `GET /checklist-instances/:id`; opens `TL-CHK-VERIFY`.

2. **Review the items (read-only).** The left column shows every `ChecklistItem` with the filler's **G/A** value + note + time + initials. **A items** are highlighted red-orange with their issue-photo thumbnail; G items show green. Priya does **not** edit responses — she judges them.

3. **Inspect the photos.** Priya clicks the completion photo + each A-item photo → the **photo-viewer modal** (`photo-viewer.html`): full-size, swipe between photos, item-context caption, uploader (Ramesh) + timestamp + device (`§4a`). She confirms the evidence matches the answers.

4. **Decide.** On the right decision rail the **ApprovalTimeline** shows the TL node ringed "awaiting you". Two actions:
   - **Approve** (green) → a lightweight approve-confirm → on confirm `POST /checklist-instances/:id/approve` (`If-Match: <version>`).
   - **Send back** (red) → see `send-back-to-filler.md`.

5. **Server transition (approve).** State → `TL_APPROVED`; `ApprovalStep[1].APPROVE` + `ApprovalLog` written; **Rohit (SM) notified** (FCM + in-app). The instance leaves Priya's verify queue and enters Rohit's. The timeline node flips to `TL Approved ✓`.

6. **As the cascade moves on** (`WORKFLOW_GUIDE Stage F2–F4`):
   - Rohit (SM) **Approves** → `SM Approved`; passes to OH.
   - Anjali (OH) **Approves** → `Operation Head Approved (Done)`.
   - Until OH approves, **SM + OH see Pending**; Priya, on her own overview, sees the **real sub-state** climbing above her level (SM Approved / Done).

## Rules enforced in this flow
- **TL approves or rejects — never edits** the filler's G/A or photos (the evidence trail is immutable).
- **Scope:** Priya can only verify instances in her **own team + Game Zone**; any other id → 403 (`states/forbidden.html`).
- **Concurrency:** approve carries `If-Match: <version>` → 409 if a concurrent action already moved the instance (rare).
- **A TL cannot approve an instance she filled** — that one routes to SM (resolver-enforced).

## Result
- A submission that climbs Filled → **TL Approved** → SM → OH, with Priya having verified the items + photo evidence at the first cascade level.
