mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
fix(warehouses): truck weighing modal resolves bookingId without the relation
The modal read the booking id only from item.booking?.id, but inventory- workbench rows carry bookingId without the booking relation. Result: the container-weights and assigned-trucks queries never ran, so "Recorded net weight (system)" fell back to the inventory row's weight (often 0), the container MultiSelect never appeared, and the truck dropdown showed "not assigned" even when trucks existed - while the server correctly computed the cargo weight and rejected the mismatch. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -112,7 +112,9 @@ const parseInspectionNote = (notes: string | null | undefined) => {
|
||||
export function ReleaseOrderModal({ opened, onClose, item, truckPrefill }: ReleaseOrderModalProps) {
|
||||
const { toast } = useToast();
|
||||
const releaseMutation = useMutation(api.warehouses.release.mutationOptions());
|
||||
const bookingId = item?.booking?.id;
|
||||
// Some openers (inventory workbench) supply bookingId without the booking
|
||||
// relation — fall back to it, or the truck/container-weight queries never run.
|
||||
const bookingId = item?.booking?.id ?? item?.bookingId ?? undefined;
|
||||
// Customer self-haul trucks assigned to this booking via the portal.
|
||||
const { data: customerTrucks = [] } = useQuery({
|
||||
queryKey: ['release-customer-trucks', bookingId],
|
||||
|
||||
Reference in New Issue
Block a user