'use client'; import { useState } from 'react'; import { Button } from '@/components/ui/button'; import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger, } from '@/components/ui/dialog'; import { ChevronDown, GitBranch, Info } from 'lucide-react'; const flowSteps = [ { step: '1', icon: '📝', title: 'Create Correspondence Master', table: 'correspondences', detail: 'Create parent record with number, type, project, originator, and recipients (TO/CC).', }, { step: '2', icon: '📋', title: 'Create Current Revision', table: 'correspondence_revisions', detail: 'Create revision 0 as current revision (is_current=true) with subject/body/date fields and initial status.', }, { step: '3', icon: '⬆️', title: 'Two-Phase Attachment', table: 'attachments (temp) -> correspondence_revision_attachments', detail: 'Upload files into temporary storage first, then commit and link each file to a specific revision.', }, { step: '4', icon: '✉️', title: 'Submit and Workflow', table: 'correspondence_routing / workflow', detail: 'Submit document and move through routing/workflow actions (review/approve/reject) with status transitions.', }, { step: '5', icon: '🔄', title: 'New Revision Cycle', table: 'correspondence_revisions', detail: 'When editing after response, create a new revision and switch previous current revision to non-current.', }, { step: '6', icon: '🧩', title: 'RFA Extension Path', table: 'rfas + rfa_revisions + rfa_items', detail: 'RFA list is unified in Correspondences (?type=RFA), while RFA new/detail/edit remain specialized routes.', }, ]; const keyRules = [ 'Only one current revision is allowed per correspondence at any time.', 'Recipients (TO/CC) are linked at correspondence master level, not per revision.', 'References and tags are correspondence-level relations for search and traceability.', 'Attachment links are revision-level using correspondence_revision_attachments.', 'Use publicId as API identifier in frontend routing and payload handling.', ]; const relationshipChips = [ 'correspondence_recipients (M:N)', 'correspondence_tags (M:N)', 'correspondence_references (M:N)', 'correspondence_revision_attachments (Junction)', ]; const statusLegend = [ { code: 'DRAFT', label: 'Draft' }, { code: 'SUB*', label: 'Submitted' }, { code: 'REP*', label: 'Reply' }, { code: 'RSB*', label: 'Resubmitted' }, { code: 'CLB*', label: 'Closed' }, { code: 'CCB*', label: 'Cancelled' }, ]; export function CorrespondenceUxFlowDialog() { const [openStep, setOpenStep] = useState(flowSteps[0]?.step ?? '1'); return ( Correspondence UX Flow Diagram Master-Revision lifecycle, two-phase attachment model, and RFA extension behavior.
Table Relationship (Master-Revision Pattern)
correspondences 1:N correspondence_revisions M:N attachments
{relationshipChips.map((chip) => ( {chip} ))}
{flowSteps.map((item) => (
{openStep === item.step && (
{item.table}

{item.detail}

)}
))}
Status Legend
{statusLegend.map((item) => ( {item.code} - {item.label} ))}
Key UX Rules
    {keyRules.map((rule) => (
  • - {rule}
  • ))}
); }