diff --git a/teressa-copeland-homes/src/app/portal/(protected)/documents/[docId]/_components/PreparePanel.tsx b/teressa-copeland-homes/src/app/portal/(protected)/documents/[docId]/_components/PreparePanel.tsx index 16778ac..9956035 100644 --- a/teressa-copeland-homes/src/app/portal/(protected)/documents/[docId]/_components/PreparePanel.tsx +++ b/teressa-copeland-homes/src/app/portal/(protected)/documents/[docId]/_components/PreparePanel.tsx @@ -8,6 +8,8 @@ interface PreparePanelProps { defaultEmail: string; clientName: string; currentStatus: string; + agentDownloadUrl?: string | null; + signedAt?: Date | null; } function parseEmails(raw: string | undefined): string[] { @@ -18,7 +20,7 @@ function isValidEmail(email: string): boolean { return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email); } -export function PreparePanel({ docId, defaultEmail, clientName, currentStatus }: PreparePanelProps) { +export function PreparePanel({ docId, defaultEmail, clientName, currentStatus, agentDownloadUrl, signedAt }: PreparePanelProps) { const router = useRouter(); const [recipients, setRecipients] = useState(defaultEmail ?? ''); // Sync if defaultEmail arrives after initial render (streaming / hydration timing) @@ -29,9 +31,51 @@ export function PreparePanel({ docId, defaultEmail, clientName, currentStatus }: const [loading, setLoading] = useState(false); const [result, setResult] = useState<{ ok: boolean; message: string } | null>(null); + if (currentStatus === 'Signed') { + return ( +
+

+ Document Signed +

+ {signedAt && ( +

+ Signed on{' '} + {new Date(signedAt).toLocaleString('en-US', { + timeZone: 'America/Denver', + month: 'short', + day: 'numeric', + year: 'numeric', + hour: 'numeric', + minute: '2-digit', + })} +

+ )} + {agentDownloadUrl ? ( + + Download Signed PDF + + ) : ( +

Signed PDF not available.

+ )} +
+ ); + } + if (currentStatus !== 'Draft') { return ( -
+
Document status is {currentStatus} — preparation is only available for Draft documents.
);