feat(dashboard): filter quotes by clicking status cards in StatsBar

This commit is contained in:
Behrad
2026-09-20 14:40:27 +03:30
parent 3c7ae80b02
commit d2b9af5278
3 changed files with 96 additions and 32 deletions
+12 -2
View File
@@ -288,8 +288,13 @@ export function filterQuotes(
"پیشنهاد شده": "offered",
"پذیرفته شده": "accepted",
"رسیده": "arrived",
"باز": "offered",
"پذیرفته": "accepted",
"offered": "offered",
"accepted": "accepted",
"arrived": "arrived",
};
const stKey = STATUS_BY_LABEL[stVal] || "";
const stKey = STATUS_BY_LABEL[stVal] || stVal;
return store.quotes.filter((quote) => {
const supObj = supplierById(store.suppliers, quote.supplier_id);
@@ -313,11 +318,16 @@ export function filterQuotes(
export function isExpired(q: Quote): boolean {
return (
q.status === "offered" &&
!quoteHasArrivedOrAccepted(q) &&
!!q.expiry_date &&
new Date(q.expiry_date) < new Date(new Date().toDateString())
);
}
function quoteHasArrivedOrAccepted(q: Quote): boolean {
return q.status === "accepted" || q.status === "arrived";
}
// آماده‌سازی نمایش ترم‌شیت در حالت expanded
export function termSheetBlocks(
store: Store,
@@ -347,4 +357,4 @@ export function termSheetBlocks(
});
return { ts, isAccepted, isUsed, itemsDesc, milestones };
});
}
}