fix: update booking data structure to use meta.total and add null coalescing for checkbox states

This commit is contained in:
marshal
2026-06-17 21:14:00 +03:00
parent ca7d5cb92b
commit 507758ea39
2 changed files with 5 additions and 5 deletions

View File

@@ -235,7 +235,7 @@ function useStatusCount(statuses: string | undefined): number | undefined {
staleTime: 30_000,
}),
);
return data?.total;
return data?.meta?.total;
}
function StatCard({
@@ -354,7 +354,7 @@ export default function MyBookings() {
};
const allItems = data?.items ?? [];
const total = data?.total ?? allItems.length;
const total = data?.meta?.total ?? allItems.length;
// Server handles status + pagination; reference search is applied on the page.
const rows = useMemo(() => {

View File

@@ -115,7 +115,7 @@ export function Step2ServiceType({
icon={<Truck size={18} />}
title="First Mile — Pick-up"
description="Truck pick-up from your premises (Door to Port) to the origin rail yard."
checked={field.value}
checked={field.value ?? false}
onChange={(value) => {
field.onChange(value);
if (!value) {
@@ -157,7 +157,7 @@ export function Step2ServiceType({
icon={<Truck size={18} />}
title="Last Mile — Delivery"
description="Truck delivery from the destination rail yard to the final address (Port to Door)."
checked={field.value}
checked={field.value ?? false}
onChange={(value) => {
field.onChange(value);
if (!value) {
@@ -225,7 +225,7 @@ export function Step2ServiceType({
icon={<FileText size={18} />}
title="Customs Clearing Service"
description="EDR handles customs documentation and clearance on your behalf."
checked={field.value}
checked={field.value ?? false}
onChange={(v) => field.onChange(v)}
/>
)}