diff --git a/apps/edr-freight-web/backoffice/src/pages/operations/LastMilePage.tsx b/apps/edr-freight-web/backoffice/src/pages/operations/LastMilePage.tsx index 60b11758c..e5b4b7643 100644 --- a/apps/edr-freight-web/backoffice/src/pages/operations/LastMilePage.tsx +++ b/apps/edr-freight-web/backoffice/src/pages/operations/LastMilePage.tsx @@ -1,9 +1,7 @@ import { useMemo, useState } from "react"; import { ArrowRight, - Check, Eye, - Filter, MoreHorizontal, RefreshCw, Truck, @@ -217,6 +215,22 @@ const LastMilePage = () => { } }; + const statusCounts = useMemo(() => { + const counts: Record = { + ALL: jobs.length, + PAYMENT_PENDING: 0, + READY_TO_TRANSIT: 0, + DELIVERED: 0, + ASSIGNED: 0, + UNASSIGNED: 0, + }; + for (const job of jobs) { + counts[job.deliveryStatus] += 1; + counts[job.status] += 1; + } + return counts; + }, [jobs]); + const filteredJobs = useMemo(() => { const term = search.trim().toLowerCase(); return jobs.filter((job) => { @@ -433,46 +447,40 @@ const LastMilePage = () => { > - - + + setSearch(e.currentTarget.value)} w={260} /> - - - - - - {FILTER_OPTIONS.map((option) => ( - : null - } - onClick={() => { - setStatusFilter(option.value); - setPagination((p) => ({ ...p, pageIndex: 0 })); - }} - > - {option.label} - - ))} - - + - - + + {FILTER_OPTIONS.map((option) => { + const active = statusFilter === option.value; + return ( + + ); + })} + +