diff --git a/teressa-copeland-homes/src/app/portal/(protected)/clients/[id]/page.tsx b/teressa-copeland-homes/src/app/portal/(protected)/clients/[id]/page.tsx index e459618..d224bc1 100644 --- a/teressa-copeland-homes/src/app/portal/(protected)/clients/[id]/page.tsx +++ b/teressa-copeland-homes/src/app/portal/(protected)/clients/[id]/page.tsx @@ -20,6 +20,7 @@ export default async function ClientProfilePage({ name: documents.name, status: documents.status, sentAt: documents.sentAt, + signedAt: documents.signedAt, clientId: documents.clientId, clientName: sql`${clients.name}`, }) diff --git a/teressa-copeland-homes/src/app/portal/(protected)/dashboard/page.tsx b/teressa-copeland-homes/src/app/portal/(protected)/dashboard/page.tsx index dfc072b..24e9172 100644 --- a/teressa-copeland-homes/src/app/portal/(protected)/dashboard/page.tsx +++ b/teressa-copeland-homes/src/app/portal/(protected)/dashboard/page.tsx @@ -22,6 +22,7 @@ export default async function DashboardPage({ name: documents.name, status: documents.status, sentAt: documents.sentAt, + signedAt: documents.signedAt, clientName: clients.name, clientId: documents.clientId, }) @@ -38,16 +39,18 @@ export default async function DashboardPage({ return (
-
-

+
+

Welcome back, {firstName}

+

All documents across your clients

-
- Filter by status: - -
-
+ +
+
+ Filter by status: + +
diff --git a/teressa-copeland-homes/src/app/portal/(protected)/documents/[docId]/page.tsx b/teressa-copeland-homes/src/app/portal/(protected)/documents/[docId]/page.tsx index 4e96594..7613009 100644 --- a/teressa-copeland-homes/src/app/portal/(protected)/documents/[docId]/page.tsx +++ b/teressa-copeland-homes/src/app/portal/(protected)/documents/[docId]/page.tsx @@ -6,6 +6,7 @@ import { eq } from 'drizzle-orm'; import Link from 'next/link'; import { PdfViewerWrapper } from './_components/PdfViewerWrapper'; import { PreparePanel } from './_components/PreparePanel'; +import { createAgentDownloadToken } from '@/lib/signing/token'; export default async function DocumentPage({ params, @@ -29,6 +30,12 @@ export default async function DocumentPage({ if (!doc) redirect('/portal/dashboard'); + // Generate agent download URL server-side for Signed documents + // Must be done here (server component) — PreparePanel is 'use client' and cannot call createAgentDownloadToken + const agentDownloadUrl = doc.signedFilePath + ? `/api/documents/${docId}/download?adt=${await createAgentDownloadToken(docId)}` + : null; + return (
@@ -56,6 +63,8 @@ export default async function DocumentPage({ defaultEmail={docClient?.email ?? ''} clientName={docClient?.name ?? ''} currentStatus={doc.status} + agentDownloadUrl={agentDownloadUrl} + signedAt={doc.signedAt ?? null} />
diff --git a/teressa-copeland-homes/src/app/portal/_components/ClientProfileClient.tsx b/teressa-copeland-homes/src/app/portal/_components/ClientProfileClient.tsx index 9035189..6d712e8 100644 --- a/teressa-copeland-homes/src/app/portal/_components/ClientProfileClient.tsx +++ b/teressa-copeland-homes/src/app/portal/_components/ClientProfileClient.tsx @@ -15,6 +15,7 @@ type DocumentRow = { clientName: string | null; status: "Draft" | "Sent" | "Viewed" | "Signed"; sentAt: Date | null; + signedAt: Date | null; clientId: string; }; diff --git a/teressa-copeland-homes/src/app/portal/_components/DocumentsTable.tsx b/teressa-copeland-homes/src/app/portal/_components/DocumentsTable.tsx index b0be365..0e7b7b5 100644 --- a/teressa-copeland-homes/src/app/portal/_components/DocumentsTable.tsx +++ b/teressa-copeland-homes/src/app/portal/_components/DocumentsTable.tsx @@ -7,6 +7,7 @@ type DocumentRow = { clientName: string | null; status: "Draft" | "Sent" | "Viewed" | "Signed"; sentAt: Date | null; + signedAt: Date | null; clientId: string; }; @@ -39,6 +40,9 @@ export function DocumentsTable({ rows, showClientColumn = true }: Props) { Date Sent + + Date Signed + @@ -64,6 +68,16 @@ export function DocumentsTable({ rows, showClientColumn = true }: Props) { ? new Date(row.sentAt).toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" }) : "—"} + + {row.signedAt + ? new Date(row.signedAt).toLocaleDateString("en-US", { + timeZone: "America/Denver", + month: "short", + day: "numeric", + year: "numeric", + }) + : "—"} + ))}