mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 16:28:12 +00:00
feat(warehouses): prefill receive-to-warehouse from existing booking data
The receive form now arrives filled with everything the booking already knows, instead of the operator re-typing it: - container numbers come from the per-unit records (booking_container_units) entered at booking time, falling back to the line-level aggregate - customs seal number prefilled from the units' seal numbers - net weight prefilled from the booking's declared cargo weight (tonnes) - driver signatory defaults to the arriving driver's name Existing prefills (owner, TIN, phone, booking ref, cargo, packaging, unit count, first-mile / customer truck + driver) unchanged; all fields stay editable where they were editable before. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -296,6 +296,10 @@ const truckEntranceFromBookings = (bookings: EligibleBooking[]): {
|
||||
const truckType = commonNonEmptyValue(
|
||||
bookings.map((booking) => booking.firstMileTruckType || booking.customerTruckType),
|
||||
);
|
||||
const customsSealNumber = commonNonEmptyValue(bookings.map((booking) => booking.sealNumbers));
|
||||
// Booking's declared cargo weight (tonnes) — the receive-time net until re-weighed.
|
||||
const bookingWeight = bookings.length === 1 ? Number(bookings[0]?.weight ?? '') : NaN;
|
||||
const netWeightKg: number | '' = Number.isFinite(bookingWeight) && bookingWeight > 0 ? bookingWeight : '';
|
||||
const edrDigitalBookingId =
|
||||
bookings.length === 1
|
||||
? bookings[0]?.reference ?? bookings[0]?.id ?? ''
|
||||
@@ -321,9 +325,11 @@ const truckEntranceFromBookings = (bookings: EligibleBooking[]): {
|
||||
customerPhone,
|
||||
edrDigitalBookingId,
|
||||
assignedEquipmentNumber,
|
||||
customsSealNumber,
|
||||
itemDescription,
|
||||
packagingType,
|
||||
unitCount,
|
||||
netWeightKg,
|
||||
grossWeightKg: '',
|
||||
truckPlateNumber,
|
||||
trailerPlateNumber,
|
||||
@@ -331,6 +337,7 @@ const truckEntranceFromBookings = (bookings: EligibleBooking[]): {
|
||||
driverPhone,
|
||||
driverLicenseNumber,
|
||||
truckType,
|
||||
driverSignatoryName: driverName,
|
||||
},
|
||||
lockedFields: {
|
||||
ownerName: Boolean(ownerName),
|
||||
|
||||
Reference in New Issue
Block a user