think
16px
820px

Correspondence letters in a document-style detail view — design spec (DRAFT)

Status: DRAFT for review. Requested 2026-07-24 ("correspondence system also uses document view (but no version, no share, no access, and others that are not used [suggest me])"). Not yet approved.

Goal

Replace the cramped letter detail modal with a full document-style detail page — the large hero PDF preview on the left, a tabbed metadata/action column on the right — so a letter reads and acts like a first-class record, not a popup. Reuse the DocumentDetailView layout and its building blocks (RestrictedPDFViewer, the tab shell, the action row) rather than rebuilding them.

Why

The current LetterDetailModal stacks metadata + a small preview + a row of buttons in a medium modal. Letters have grown (docx authoring, numbering, disposisi, attachments, and — with the workflow-chain spec — approval/sign/meterai/stamp). That's too much for a modal, and it's inconsistent with how documents are presented. The inline preview just added is a stopgap; this is the real home.

Which document-view tabs apply to a letter (my recommendation)

Document view has: Overview · Versions · Access · Share · Signatures · Workflow · Activity · Related · Comments. For a letter:

Tab Keep? Why
Overview ✅ Keep (adapted) Letter fields: number, type, sifat, status, direction, dates, counterparty. Plus the disposisi timeline + attachments (lampiran) that live in the modal today.
Versions ❌ Drop A letter has ONE content (draft docx → numbered PDF), no version chain. (If the workflow-chain spec lands, a small "Seal history" replaces this — see below.)
Access ❌ Drop Letters use mayReadLetter (creator / disposition-recipient / correspondence.admin / confidential rules), NOT document ACLs. There's nothing to edit here.
Share ❌ Drop External share links are a document feature; letters route via disposisi, not public share.
Signatures ⚠️ Conditional Only once letters can be signed (the workflow-chain spec). Until then, drop.
Workflow ✅ Keep The approval run already exists (SubmitLetter → workflow). Show the step-flow graph + who it waits for, exactly like a document. Grows into the full chain with the other spec.
Activity ✅ Keep (light) The letter's audit trail (created, submitted, approved, numbered, disposed). Reuse the activity component if the letter subject is in the audit stream; else defer.
Related ❌ Drop Document-to-document linking; letters don't link this way. (A future "reply-to / in-response-to" letter link could reuse it, but out of scope.)
Comments ⚠️ Optional Internal discussion on a letter could be useful, but it's a new surface (letters aren't in the comments model today). Defer unless wanted.

So v1 keeps: Overview (letter fields + disposisi + attachments), Workflow, Activity. Adds (with the chain spec): Signatures + a Seal-history panel. Drops: Versions, Access, Share, Related, Comments.

Proposed design

  • A route /letters/:id (standalone detail page, like /documents/d/:id), replacing the modal. The register row navigates there; the Word-editor "Done" returns there (instead of ?open= opening the modal).
  • Left column: the hero PDF preview (RestrictedPDFViewer fed by the letter preview endpoint just built — numbered → official PDF, draft → rendered draft), plus the top action row: Edit/View (Word), Submit for approval, Assign number, Dispose, Download.
  • Right column: the reduced tab set above. Overview holds the letter metadata + the disposisi timeline + attachments (moved out of the modal). Workflow reuses the document workflow tab component (subject=letter). Activity reuses the audit stream if available.
  • Reuse, don't fork: parameterize the shared preview/tab-shell/action-row pieces by subject where practical; letters get their own thin container that composes them with letter data + actions. Avoid copy-pasting DocumentDetailView wholesale — extract the genuinely shared bits.

What does NOT change

Numbering, disposisi, attachments, the approval workflow semantics, mayReadLetter access rules — all unchanged; this is a presentation re-home. The letter data model is untouched (no new columns for the view itself).

Migration / rollout

  • Keep the register list as-is; change the row click + editor-return to navigate to /letters/:id instead of opening the modal.
  • The modal can be retired once the page reaches parity, or kept as a fallback briefly.

Open questions

  1. Signatures/Comments tabs — include now (needs the workflow-chain spec + a letter comments model) or defer? (Recommend: defer both to a follow-up; ship Overview/Workflow/Activity first.)
  2. Seal-history panel — only meaningful with the workflow-chain spec; gate its appearance on that feature.
  3. Standalone page vs. slide-over panel — a full route (like documents) vs. a wide right-side drawer. (Recommend: full route, for consistency + deep-linking.)
  4. How much of DocumentDetailView to extract vs. re-implement — decide during planning; aim to share the preview + tab shell + action row, not the document-specific logic.

Relationship to the other draft

Pairs with 2026-07-24-letter-workflow-chain-design.md (the backend chain that fills the Signatures/Workflow tabs and the Seal-history panel). This spec is the UI home; that one is the capability. They can ship independently — this view is valuable even with just Overview/Workflow/Activity.