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 = —; }