# Flow — SM Approval (Approve → OH / Send-back → Filler) (Store Manager)

> Persona: **Rohit Shah** (SM, level 2), Game Zone Ahmedabad-1. Source: `WORKFLOW_GUIDE` Stage F (F2) + `PROJECT_PLAN §4b`, `§9 #3/#5/#8`, `FOUNDATION_SPEC §4`. Screens: `SM-CHK-OVERVIEW` → `SM-CHK-APPROVE`. Modal: `modals/sendback-reason.html`.

---

## Preconditions
- A floor filler (Ramesh, MON) submitted **Trampoline Daily** with a completion photo + an issue photo on every A item. The **Team Leader (Priya) has approved** (level 1) → instance state `TL_APPROVED`. It now sits in Rohit's **SM approval queue**.

## Steps

1. **See the queue.** `SM-DASH` shows **Awaiting my approval · N**; `SM-CHK-OVERVIEW` lists the instance with a compact cascade pill and `StatusBadge` = **Pending** (derived for the SM viewer — it is not yet `SM_APPROVED`). `GET /me/approvals?level=SM&status=pending`.

2. **Open the approval.** Rohit clicks the row → `SM-CHK-APPROVE`. `GET /checklist-instances/:id` + `…/timeline` + `…/photos`.
   - Left: the filled checklist — sections → `ChecklistItem` rows showing **G/A**, the note, and **server time + auto initials** (read-only — Rohit cannot edit them, `§9 #9`). Each **A** item shows its **issue photo** thumbnail.
   - A **completion-photo gallery**; any thumbnail opens the **lightbox** (full-screen, swipe, item-context caption, uploader/timestamp).
   - Right: the `ApprovalTimeline` — `Filled by Ramesh ✓ → TL Priya ✓ → Store Manager (you) ● → Operation Head`.

3. **Decide.**
   - **Approve:** Rohit clicks **Approve** (green) → confirm → `POST /checklist-instances/:id/approve { level:"SM" }` (`If-Match`). State → `SM_APPROVED`; `ApprovalLog` + `ApprovalStep[2].APPROVE`; **Anjali (OH) is notified**. The row leaves Rohit's queue; to Rohit it now reads "awaiting OH" (no longer Pending to him).
   - **Send-back:** Rohit clicks **Send-back** (red-orange) → the **send-back-reason modal** (`sendback-reason.html`) **requires a non-empty reason** → `POST /checklist-instances/:id/sendback { level:"SM", reason }`. State → `SENT_BACK`. It returns to **Ramesh, the original filler — NOT to Priya the TL** (`§9 #3`). Ramesh gets a red banner + Re-fill on `MON-CHK-STATUS` + a `SENT_BACK` notification. When Ramesh re-submits, the cascade **restarts from TL** (Priya → Rohit → Anjali), fresh (`§9 #8`).

4. **Track to Done.** After Rohit approves, Anjali (OH) does the final approve → `OH_APPROVED (Done)`. Until then, OH/SM see **Pending** for it (derived). Rohit sees the true climbing state on `SM-CHK-OVERVIEW`.

## Rules enforced in this flow
- **SM is level 2 only.** The resolver rejects an SM `approve`/`sendback` at the TL or OH level (403). SM can only act on **own-GZ** instances.
- **Send-back reason is mandatory** (`§4b`) — empty reason → 422; the modal blocks submit until filled.
- **Send-back always returns to the original filler** (`§9 #3`), and **re-fill restarts the cascade from TL** (`§9 #8`) — Rohit's approval does not "stick" across a re-fill.
- **Pending is derived** (`§9 #5`): the same instance reads Pending to Rohit until SM-approved, then climbs; it never becomes a stored status.
- **Concurrency:** a second approver acting first → 409 ("already decided — reload").

## Result
- The checklist either passes to the Operation Head for final approval (`SM_APPROVED`) or returns to Ramesh to re-fill (`SENT_BACK`), with Rohit's decision logged and the right party notified.
