diff --git a/.planning/ROADMAP.md b/.planning/ROADMAP.md index 91519cc..88b0d78 100644 --- a/.planning/ROADMAP.md +++ b/.planning/ROADMAP.md @@ -463,5 +463,5 @@ Phases execute in numeric order: 1 → 2 → 3 → 4 → 5 → 6 → 7 → 8 → | 16. Multi-Signer UI | v1.2 | 1/4 | Complete | 2026-04-03 | | 17. Docker Deployment | v1.2 | 2/2 | Complete | 2026-04-03 | | 18. Template Schema and CRUD API | v1.3 | 2/2 | Complete | 2026-04-06 | -| 19. Template Editor UI | v1.3 | 3/3 | Complete | 2026-04-06 | +| 19. Template Editor UI | v1.3 | 3/3 | Complete | 2026-04-06 | | 20. Apply Template and Portal Nav | v1.3 | 0/TBD | Not started | - | diff --git a/.planning/STATE.md b/.planning/STATE.md index 8d22edd..988e94a 100644 --- a/.planning/STATE.md +++ b/.planning/STATE.md @@ -2,9 +2,9 @@ gsd_state_version: 1.0 milestone: v1.1 milestone_name: Smart Document Preparation -status: verifying +status: completed stopped_at: Completed 19-03-PLAN.md — Phase 19 template editor UI complete, human verification passed -last_updated: "2026-04-06T19:46:16.637Z" +last_updated: "2026-04-06T19:55:02.977Z" last_activity: 2026-04-06 progress: total_phases: 21 @@ -24,8 +24,8 @@ See: .planning/PROJECT.md (updated 2026-04-03) ## Current Position -Phase: 19 (template-editor-ui) — COMPLETE -Plan: 3 of 3 (all complete, human verified) +Phase: 19 +Plan: Not started Status: Phase 19 complete — Phase 20 (apply-template-and-portal-nav) ready to begin Last activity: 2026-04-06 diff --git a/.planning/phases/19-template-editor-ui/19-VERIFICATION.md b/.planning/phases/19-template-editor-ui/19-VERIFICATION.md new file mode 100644 index 0000000..9e5d6dd --- /dev/null +++ b/.planning/phases/19-template-editor-ui/19-VERIFICATION.md @@ -0,0 +1,160 @@ +--- +phase: 19-template-editor-ui +verified: 2026-04-06T19:30:00Z +status: passed +score: 13/13 must-haves verified +re_verification: false +--- + +# Phase 19: Template Editor UI Verification Report + +**Phase Goal:** Agent can open any template in a full field-placement editor, use AI auto-place, assign signer role labels instead of real emails, set text hints on text fields, and save the template — reusing the existing FieldPlacer component without duplication +**Verified:** 2026-04-06T19:30:00Z +**Status:** passed +**Re-verification:** No — initial verification + +--- + +## Goal Achievement + +### Observable Truths — Plan 01 Must-Haves + +| # | Truth | Status | Evidence | +|---|-------|--------|----------| +| 1 | FieldPlacer accepts an onPersist callback that replaces internal persistFields when provided | VERIFIED | Lines 171, 326, 510, 577, 747 in FieldPlacer.tsx — interface declares `onPersist?`, all 4 call sites use conditional `if (onPersist)` | +| 2 | FieldPlacer accepts a fieldsUrl prop that overrides the default /api/documents/{docId}/fields endpoint | VERIFIED | Line 172 declares `fieldsUrl?: string`; line 226 uses `fieldsUrl ?? \`/api/documents/${docId}/fields\`` in loadFields fetch; `fieldsUrl` in dependency array | +| 3 | PdfViewer and PdfViewerWrapper pass through onPersist and fieldsUrl to FieldPlacer plus accept a fileUrl prop for PDF source | VERIFIED | PdfViewer lines 48-50 declare all three props; lines 91 and 118 use `fileUrl ??`; lines 114-115 pass `onPersist`/`fieldsUrl` to FieldPlacer. PdfViewerWrapper lines 32-34 declare all three; lines 48-50 pass through to PdfViewer | +| 4 | GET /api/templates/[id]/file streams the form PDF from seeds/forms/ | VERIFIED | `src/app/api/templates/[id]/file/route.ts` — `export async function GET`, uses `SEEDS_FORMS_DIR`, `readFile(filePath)`, path traversal guard, returns `application/pdf` response | +| 5 | GET /api/templates/[id]/fields returns the template signatureFields array | VERIFIED | `src/app/api/templates/[id]/fields/route.ts` — `export async function GET`, returns `template.signatureFields ?? []` | +| 6 | POST /api/templates/[id]/ai-prepare extracts blanks and classifies fields with AI then writes to DB | VERIFIED | `src/app/api/templates/[id]/ai-prepare/route.ts` — `export async function POST`, calls `extractBlanks` + `classifyFieldsWithAI(blanks, null)`, writes via `db.update(documentTemplates).set({ signatureFields: fields, updatedAt: new Date() })` | +| 7 | Templates link appears in portal nav between Clients and Profile | VERIFIED | PortalNav.tsx line 10: `{ href: "/portal/templates", label: "Templates" }` between Clients (line 9) and Profile (line 11) | + +### Observable Truths — Plan 02 Must-Haves + +| # | Truth | Status | Evidence | +|---|-------|--------|----------| +| 8 | Agent can see a list of all active templates at /portal/templates | VERIFIED | `templates/page.tsx` server component queries `documentTemplates` LEFT JOIN `formTemplates` WHERE `isNull(archivedAt)` ORDER BY `updatedAt DESC`; renders `TemplatesListClient` with results | +| 9 | Agent can create a new template by selecting a form from the library | VERIFIED | `TemplatesListClient.tsx` — "+ New Template" button, modal with name input + form `