mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
fix
This commit is contained in:
@@ -34,6 +34,9 @@ export class FirstMile extends BaseEntity {
|
||||
@Column({ name: 'remaining_payment', type: 'numeric', precision: 14, scale: 2, default: 0 })
|
||||
remainingPayment!: number;
|
||||
|
||||
@Column({ type: 'boolean', default: false })
|
||||
isPostPaymentCompleted!: boolean;
|
||||
|
||||
@Column({ name: 'estimated_km', type: 'numeric', precision: 10, scale: 2, nullable: true })
|
||||
estimatedKm?: number | null;
|
||||
|
||||
|
||||
@@ -34,6 +34,9 @@ export class LastMile extends BaseEntity {
|
||||
@Column({ name: 'remaining_payment', type: 'numeric', precision: 14, scale: 2, default: 0 })
|
||||
remainingPayment!: number;
|
||||
|
||||
@Column({ type: 'boolean', default: false })
|
||||
isPostPaymentCompleted!: boolean;
|
||||
|
||||
@Column({ name: 'estimated_km', type: 'numeric', precision: 10, scale: 2, nullable: true })
|
||||
estimatedKm?: number | null;
|
||||
|
||||
|
||||
@@ -314,6 +314,7 @@ const FirstMilePage = () => {
|
||||
|
||||
const [search, setSearch] = useState("");
|
||||
const [statusFilter, setStatusFilter] = useState<StatusFilter>("ALL");
|
||||
const [filterPostPaymentPending, setFilterPostPaymentPending] = useState(false);
|
||||
const [rowSelection, setRowSelection] = useState<Record<string, boolean>>({});
|
||||
|
||||
const [assignOpen, setAssignOpen] = useState(false);
|
||||
@@ -529,6 +530,7 @@ const FirstMilePage = () => {
|
||||
};
|
||||
|
||||
const matchesFilter = (r: FirstMileRecord) => {
|
||||
if (filterPostPaymentPending && r.isPostPaymentCompleted) return false;
|
||||
switch (statusFilter) {
|
||||
case "ALL": return true;
|
||||
case "ASSIGNED": return isAssigned(r);
|
||||
@@ -566,7 +568,7 @@ const FirstMilePage = () => {
|
||||
.includes(term);
|
||||
});
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [records, search, statusFilter]);
|
||||
}, [records, search, statusFilter, filterPostPaymentPending]);
|
||||
|
||||
const pageCount = Math.max(1, Math.ceil(filteredRecords.length / pagination.pageSize));
|
||||
const pagedRecords = useMemo(() => {
|
||||
@@ -887,6 +889,17 @@ const FirstMilePage = () => {
|
||||
</Button>
|
||||
);
|
||||
})}
|
||||
<Button
|
||||
size="xs"
|
||||
variant={filterPostPaymentPending ? "filled" : "default"}
|
||||
styles={{ label: { fontWeight: 500 } }}
|
||||
onClick={() => {
|
||||
setFilterPostPaymentPending(!filterPostPaymentPending);
|
||||
setPagination((p) => ({ ...p, pageIndex: 0 }));
|
||||
}}
|
||||
>
|
||||
Post Payment Pending
|
||||
</Button>
|
||||
</Group>
|
||||
</Stack>
|
||||
</Box>
|
||||
|
||||
@@ -298,6 +298,7 @@ const LastMilePage = () => {
|
||||
|
||||
const [search, setSearch] = useState("");
|
||||
const [statusFilter, setStatusFilter] = useState<StatusFilter>("ALL");
|
||||
const [filterPostPaymentPending, setFilterPostPaymentPending] = useState(false);
|
||||
const [rowSelection, setRowSelection] = useState<Record<string, boolean>>({});
|
||||
|
||||
const [assignOpen, setAssignOpen] = useState(false);
|
||||
@@ -508,6 +509,7 @@ const LastMilePage = () => {
|
||||
);
|
||||
|
||||
const matchesFilter = (r: LastMileRecord) => {
|
||||
if (filterPostPaymentPending && r.isPostPaymentCompleted) return false;
|
||||
switch (statusFilter) {
|
||||
case "ALL": return true;
|
||||
case "ASSIGNED": return isAssigned(r);
|
||||
@@ -545,7 +547,7 @@ const LastMilePage = () => {
|
||||
.includes(term);
|
||||
});
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [records, search, statusFilter]);
|
||||
}, [records, search, statusFilter, filterPostPaymentPending]);
|
||||
|
||||
const pageCount = Math.max(1, Math.ceil(filteredRecords.length / pagination.pageSize));
|
||||
const pagedRecords = useMemo(() => {
|
||||
@@ -866,6 +868,17 @@ const LastMilePage = () => {
|
||||
</Button>
|
||||
);
|
||||
})}
|
||||
<Button
|
||||
size="xs"
|
||||
variant={filterPostPaymentPending ? "filled" : "default"}
|
||||
styles={{ label: { fontWeight: 500 } }}
|
||||
onClick={() => {
|
||||
setFilterPostPaymentPending(!filterPostPaymentPending);
|
||||
setPagination((p) => ({ ...p, pageIndex: 0 }));
|
||||
}}
|
||||
>
|
||||
Post Payment Pending
|
||||
</Button>
|
||||
</Group>
|
||||
</Stack>
|
||||
</Box>
|
||||
|
||||
Reference in New Issue
Block a user