# Repair Intake — 3-Step Wizard Redesign

**Date:** 2026-11-07 · **Branch:** `techtitans/repair-r1` · **Scope:** Frontend UI reorganization only. No backend/API/schema change; all R1 features preserved. Not pushed/deployed.

## What changed
The long single-scroll **New Repair** page was reorganized into a **3-step wizard** — one step visible at a time — for a fast front-counter experience:

1. **Customer & Device** — search/select or add a customer; pick an existing customer-owned device or register a new one (category, brand, model, optional IMEI/serial). The rest of the form is hidden until the employee continues.
2. **Problem, Photos & AI** — a **single** reported-fault field (the old duplicate "Describe the fault" + "Reported fault" boxes are now one), with Voice, Take/Choose Photo, and "Analyze with AI" embedded inline; repair type beside it; advanced fields (device condition, accessories, priority, technician, promised date, bin) in a **collapsed "More details (optional)"** disclosure.
3. **Review & Create** — one concise summary (customer, device, reported fault, photos, repair type, initial status, priority, technician, accessories, promised date) with per-field **Edit** jumps and an explicit **Create repair** confirmation.

A progress stepper (Customer & Device → Problem & Photos → Review) and a sticky bottom action bar (Back / Continue / Create) are always visible.

## Files
- `frontend/src/pages/repairs/NewRepairPage.tsx` — rewritten as the wizard (steps kept mounted, only the active one shown; all state lifted to the page so data, photos & AI draft survive step navigation).
- `frontend/src/components/repairs/SmartDraftPanel.tsx` — additive props so its textarea is the single unified reported-fault field.
- `frontend/src/pages/repairs/repairs.css` — stepper/step-panel/disclosure/review styles; responsive (stepper stacks ≤640px). **Fix:** `.repairs-step-panel[hidden]{display:none!important}` so the active-step-only behavior wins over the panel's `display:flex` (otherwise all steps rendered at once).
- `frontend/src/pages/repairs/{NewRepairPage,NewRepairIntake}.test.tsx` — updated to drive the wizard.

## Validation (intake-specific, client-only — API unchanged)
`StoreRepairTicketRequest` still requires only `customer_id` + `repair_type_id` (device/fault/priority remain nullable — preserving the historical-migration path and other API consumers). The wizard adds stricter **front-end** gating: Step 1 needs a customer + a device; Step 2 needs a non-empty reported fault + a valid repair type. The create request body is identical to R1 (same idempotency + audit path).

## UX requirements — all met
Short steps/minimal scroll; progress stepper; clean white/light layout; sticky bottom actions; obvious Back/Continue; **state preserved across steps** (steps kept mounted); validation errors shown by the field; autofocus the first field per step; Enter advances only when valid; responsive mobile/tablet; unsaved-change warning (`useUnsavedChangesGuard` + discard dialog); safe manual path when AI is unavailable; no duplicated fault input; optional fields collapsed; permissions + customer/device relationships unchanged.

## Verification
- `npm run test -- --run src/pages/repairs src/components/repairs` → **25 passed (7 files)**. `tsc --noEmit` clean. `lint` 0 errors (3 pre-existing warnings in unrelated files). `build` succeeds.
- **Real browser** (Playwright + Chromium fake media, live stack fe:5180 / be:8010 → `techpos`, login `techtitans`/`vmadmin2026`): desktop + mobile walkthrough — step gating, state persistence, photo upload + webcam capture, voice record, AI mock draft, review Edit jumps, and create (ticket **R-2026-0003**). Screenshots in `docs/techtitans/screenshots/repair-wizard/` (`01-step1-empty` … `09-created-detail`, `01-mobile-step1` … `03-mobile-step2`).

## AI status (unchanged from R1)
Draft = **mock** (works; naive; never fabricates IMEI/serial/price); vision + transcription = **not configured** (honest inline notes; fail-closed). Manual flow works fully with AI off. Enable real AI via `AI_REPAIR_{DRAFT,VISION,TRANSCRIPTION}_DRIVER=openai` + keys.

## Not changed / not in scope
Backend code, APIs, DB schema, R1 features, permissions, and legacy-migration compatibility are all untouched. No R2 work started.
