diff --git a/src/app/dashboard/purchasing/[poId]/page.tsx b/src/app/dashboard/purchasing/[poId]/page.tsx index 0c45da5..6b6694c 100644 --- a/src/app/dashboard/purchasing/[poId]/page.tsx +++ b/src/app/dashboard/purchasing/[poId]/page.tsx @@ -89,6 +89,7 @@ export default async function PurchaseOrderDetailPage({ isVerified: !!d.is_verified, slipImage: d.slip_image, rawOcrData: d.raw_ocr_data ?? null, + processingStatus: d.processing_status ?? "", receivedItems: (receivedByDn.get(d.id) ?? []).map((r) => ({ id: r.id, purchaseOrderItemId: r.purchase_order_item, diff --git a/src/app/dashboard/purchasing/[poId]/po-detail-view.tsx b/src/app/dashboard/purchasing/[poId]/po-detail-view.tsx index e22a56c..2ea2be7 100644 --- a/src/app/dashboard/purchasing/[poId]/po-detail-view.tsx +++ b/src/app/dashboard/purchasing/[poId]/po-detail-view.tsx @@ -46,6 +46,7 @@ export interface PoDetailDn { isVerified: boolean; slipImage: string; rawOcrData: unknown; + processingStatus: string; receivedItems: { id: string; purchaseOrderItemId: string; @@ -317,6 +318,31 @@ export function PoDetailView({ detail }: { detail: PoDetail }) { ); } +function DnStatusPill({ status }: { status: string }) { + if (status === "needs-review" || status === "pending") { + return ( + + + {status === "needs-review" ? "Needs review" : "Pending"} + + ); + } + if (status === "processed") { + return ( + + Processed + + ); + } + return null; +} + function DeliveryNoteCard({ dn, items, @@ -337,9 +363,12 @@ function DeliveryNoteCard({
-

- {dn.deliveryNoteNumber || "(no DN number)"} -

+
+

+ {dn.deliveryNoteNumber || "(no DN number)"} +

+ +
{dn.dateReceived diff --git a/src/app/dashboard/purchasing/purchasing-view.tsx b/src/app/dashboard/purchasing/purchasing-view.tsx index d2f234e..a58a0d6 100644 --- a/src/app/dashboard/purchasing/purchasing-view.tsx +++ b/src/app/dashboard/purchasing/purchasing-view.tsx @@ -302,17 +302,31 @@ export function PurchasingView({ function PoListItem({ po }: { po: PoRow }) { const href = `${PO_BASE}/${po.id}`; + const hasPending = po.pendingDnCount > 0; return (
  • - +
    @@ -328,6 +342,15 @@ function PoListItem({ po }: { po: PoRow }) { Required {format(parseISO(po.requiredByDate), "yyyy-MM-dd")} )} + {hasPending && ( + + + Pending DNs: {po.pendingDnCount} + + )}

    {po.itemCount} line item{po.itemCount === 1 ? "" : "s"} ยท{" "}