From 94019980bbf206b1cb331f3465ac03d4d6b584fe Mon Sep 17 00:00:00 2001 From: Thomas Joise Date: Fri, 17 Jul 2026 02:55:22 +0530 Subject: [PATCH] feat(hq-web): document view record header + composer line cards Co-Authored-By: Claude Opus 4.8 (1M context) --- apps/hq-web/src/pages/DocumentView.tsx | 94 +++++++++++++++----------- apps/hq-web/src/pages/NewDocument.tsx | 4 +- 2 files changed, 58 insertions(+), 40 deletions(-) diff --git a/apps/hq-web/src/pages/DocumentView.tsx b/apps/hq-web/src/pages/DocumentView.tsx index 5480ff5..eaf898f 100644 --- a/apps/hq-web/src/pages/DocumentView.tsx +++ b/apps/hq-web/src/pages/DocumentView.tsx @@ -1,7 +1,7 @@ import { useEffect, useState } from 'react' -import { useNavigate, useParams } from 'react-router-dom' +import { Link, useNavigate, useParams } from 'react-router-dom' import { formatINR } from '@sims/domain' -import { Badge, Button, DataTable, EmptyState, Notice, PageHeader, Toolbar } from '@sims/ui' +import { Badge, Button, DataTable, EmptyState, ErrorState, Notice, RecordHeader, Skeleton, Toolbar } from '@sims/ui' import { createShare, documentAction, downloadDocumentPdf, fetchPdfBlob, getClient, getDocumentFull, revokeShare, type Client, type Doc, type Share, @@ -56,8 +56,8 @@ export function DocumentView() { } }, [id, doc?.docNo, doc?.status]) - if (full.error !== undefined) return {full.error} - if (doc === undefined || full.data === undefined) return Loading… + if (full.error !== undefined) return
+ if (doc === undefined || full.data === undefined) return
/** POST an action; convert/credit-note navigate to the new document. */ const act = (action: string, body?: Record, navigateToResult = false) => { @@ -87,11 +87,23 @@ export function DocumentView() { return (
- {doc.status}} +
+ Clients/ + {client.data !== undefined ? {client.data.name} : } + /{doc.docNo ?? 'draft'} +
+ {doc.status}} + meta={ + <> + {doc.docNo ?? '(draft)'} + · {doc.fy} + · {doc.docDate} + · Payable {formatINR(doc.payablePaise)} + + } /> @@ -160,36 +172,42 @@ export function DocumentView() { /> )} -

Timeline

- {full.data.events.length === 0 ? No events. : ( - ({ - at: new Date(ev.atWall).toLocaleString(), - kind: {ev.kind}, - meta: Object.keys(ev.meta).length > 0 ? JSON.stringify(ev.meta) : '—', - }))} - /> - )} +
+
+

Timeline

+ {full.data.events.length === 0 ? No events. : ( + ({ + at: new Date(ev.atWall).toLocaleString(), + kind: {ev.kind}, + meta: Object.keys(ev.meta).length > 0 ? JSON.stringify(ev.meta) : '—', + }))} + /> + )} +
-

Email log

- {full.data.emails.length === 0 ? Not emailed yet. : ( - ({ - at: new Date(e.at_wall).toLocaleString(), - to: e.to_addr, subject: e.subject, - status: {e.status}, - error: e.error ?? '—', - }))} - /> - )} +
+

Email log

+ {full.data.emails.length === 0 ? Not emailed yet. : ( + ({ + at: new Date(e.at_wall).toLocaleString(), + to: e.to_addr, subject: e.subject, + status: {e.status}, + error: e.error ?? '—', + }))} + /> + )} +
+
) } diff --git a/apps/hq-web/src/pages/NewDocument.tsx b/apps/hq-web/src/pages/NewDocument.tsx index 4a473c5..b328b5d 100644 --- a/apps/hq-web/src/pages/NewDocument.tsx +++ b/apps/hq-web/src/pages/NewDocument.tsx @@ -169,7 +169,7 @@ export function NewDocument() {
setQ(e.target.value)} /> {hits.length > 0 && ( -
+
{hits.slice(0, 8).map((c) => (