From f8deb0c6b9fa978b7c3006d4b4228013e95da9b1 Mon Sep 17 00:00:00 2001 From: "reza.g" Date: Tue, 8 Sep 2026 14:51:36 +0330 Subject: [PATCH] fix(quotes): show latest receipt time on partial arrivals MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For accepted quotes with PM-confirmed (partial) receipts the dashboard row only showed «رسیده X از Y — در راه Z» with no timestamp (quote header arrived_date is set only when everything arrives). The cell now also shows «آخرین رسید: » computed from the newest item receipt; arrived quotes keep the arrival date with a last-receipt fallback. --- frontend/src/pages/Dashboard/QuoteCard.tsx | 23 ++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/frontend/src/pages/Dashboard/QuoteCard.tsx b/frontend/src/pages/Dashboard/QuoteCard.tsx index 1b1575f..88fcf20 100644 --- a/frontend/src/pages/Dashboard/QuoteCard.tsx +++ b/frontend/src/pages/Dashboard/QuoteCard.tsx @@ -97,6 +97,20 @@ export function QuoteCard({ store, q, expanded, onToggleExpand, onAccept, onEdit } let arrivedCell: React.ReactNode; + // آخرین لحظه‌ی رسید ثبت‌شده بین قلم‌ها (رسیدهای جزیی توسط مدیر پروژه) + const lastReceiptAt = activeItems.reduce((acc, li) => { + if (!li.arrived_date) return acc; + const t = new Date(li.arrived_date).getTime(); + if (Number.isNaN(t)) return acc; + return !acc || t > acc.getTime() ? new Date(li.arrived_date) : acc; + }, null); + const receiptTimeLine = + lastReceiptAt != null ? ( + + آخرین رسید: {fmtDateTime(lastReceiptAt.toISOString())} + + ) : null; + if (q.status === "accepted") { if (q.arrived_date) { arrivedCell = {fmtDateTime(q.arrived_date)}; @@ -104,13 +118,18 @@ export function QuoteCard({ store, q, expanded, onToggleExpand, onAccept, onEdit arrivedCell = ( رسیده {fmtNum(receivedSum)} از {fmtNum(orderedSum)} — در راه {fmtNum(Math.max(0, orderedSum - receivedSum))} + {receiptTimeLine} ); } else { arrivedCell = در انتظار PM; } - } else if (q.arrived_date) { - arrivedCell = {fmtDateTime(q.arrived_date)}; + } else if (q.status === "arrived") { + arrivedCell = ( + + {fmtDateTime(q.arrived_date || (lastReceiptAt ? lastReceiptAt.toISOString() : ""))} + + ); } else { arrivedCell = —; }