From 14905930ea2fad8609857264cea58e766e78ea88 Mon Sep 17 00:00:00 2001 From: Aaron Chong Date: Thu, 11 Jul 2024 01:25:45 +0800 Subject: [PATCH] Remove cart ID fields in double compose delivery form Signed-off-by: Aaron Chong --- .../lib/tasks/types/delivery-custom.tsx | 108 ++---------------- 1 file changed, 7 insertions(+), 101 deletions(-) diff --git a/packages/react-components/lib/tasks/types/delivery-custom.tsx b/packages/react-components/lib/tasks/types/delivery-custom.tsx index 1a0320c13..77451d8d9 100644 --- a/packages/react-components/lib/tasks/types/delivery-custom.tsx +++ b/packages/react-components/lib/tasks/types/delivery-custom.tsx @@ -197,14 +197,12 @@ export function makeDoubleComposeDeliveryTaskBookingLabel( const pickups = `${firstPickupDescription.pickup_lot}(1), ${secondPickupDescription.pickup_lot}(2)`; const dropoffs = `${task_description.phases[1].activity.description.activities[0].description}(1), ${task_description.phases[4].activity.description.activities[0].description}(2)`; - const cartIds = `${firstPickupDescription.pickup_lot}(1), ${secondPickupDescription.cart_id}(2)`; return { description: { task_definition_id: task_description.category, pickup: pickups, destination: dropoffs, - cart_id: cartIds, }, }; } @@ -244,19 +242,15 @@ export function makeDoubleComposeDeliveryTaskShortDescription( try { const firstGoToPickup: GoToPlaceActivity = desc.phases[0].activity.description.activities[0]; const firstPickup: LotPickupActivity = desc.phases[0].activity.description.activities[1]; - const firstCartId = firstPickup.description.description.cart_id; const firstGoToDropoff: GoToPlaceActivity = desc.phases[1].activity.description.activities[0]; const secondGoToPickup: GoToPlaceActivity = desc.phases[3].activity.description.activities[0]; const secondPickup: LotPickupActivity = desc.phases[3].activity.description.activities[1]; - const secondCartId = secondPickup.description.description.cart_id; const secondGoToDropoff: GoToPlaceActivity = desc.phases[4].activity.description.activities[0]; - return `[${ - taskDisplayName ?? DeliveryPickupTaskDefinition.taskDisplayName - }] payload [${firstCartId}] from [${firstGoToPickup.description}] to [${ - firstGoToDropoff.description - }], then payload [${secondCartId}] from [${secondGoToPickup.description}] to [${ + return `[${taskDisplayName ?? DeliveryPickupTaskDefinition.taskDisplayName}] from [${ + firstGoToPickup.description + }] to [${firstGoToDropoff.description}], then from [${secondGoToPickup.description}] to [${ secondGoToDropoff.description }]`; } catch (e) { @@ -348,14 +342,12 @@ const isDoubleComposeDeliveryTaskDescriptionValid = ( firstGoToPickup.description.length > 0 && Object.keys(pickupPoints).includes(firstGoToPickup.description) && pickupPoints[firstGoToPickup.description] === firstPickup.description.description.pickup_lot && - firstPickup.description.description.cart_id.length > 0 && firstGoToDropoff.description.length > 0 && Object.keys(dropoffPoints).includes(firstGoToDropoff.description) && secondGoToPickup.description.length > 0 && Object.keys(pickupPoints).includes(secondGoToPickup.description) && pickupPoints[secondGoToPickup.description] === secondPickup.description.description.pickup_lot && - secondPickup.description.description.cart_id.length > 0 && secondGoToDropoff.description.length > 0 && Object.keys(dropoffPoints).includes(secondGoToDropoff.description) ); @@ -630,7 +622,7 @@ export function DoubleComposeDeliveryTaskForm({ return ( - + - + - - option} - onInputChange={(_ev, newValue) => { - const newTaskDesc = { ...taskDesc }; - newTaskDesc.phases[0] = cartPickupPhaseInsertCartId(newTaskDesc.phases[0], newValue); - onInputChange(newTaskDesc); - }} - onBlur={(ev) => { - const newTaskDesc = { ...taskDesc }; - newTaskDesc.phases[0] = cartPickupPhaseInsertCartId( - newTaskDesc.phases[0], - (ev.target as HTMLInputElement).value, - ); - onInputChange(newTaskDesc); - }} - sx={{ - '& .MuiOutlinedInput-root': { - height: isScreenHeightLessThan800 ? '3rem' : '3.5rem', - fontSize: isScreenHeightLessThan800 ? 14 : 20, - }, - }} - renderInput={(params) => ( - - )} - /> - - + - + - - option} - onInputChange={(_ev, newValue) => { - const newTaskDesc = { ...taskDesc }; - newTaskDesc.phases[3] = cartPickupPhaseInsertCartId(newTaskDesc.phases[3], newValue); - onInputChange(newTaskDesc); - }} - onBlur={(ev) => { - const newTaskDesc = { ...taskDesc }; - newTaskDesc.phases[3] = cartPickupPhaseInsertCartId( - newTaskDesc.phases[3], - (ev.target as HTMLInputElement).value, - ); - onInputChange(newTaskDesc); - }} - sx={{ - '& .MuiOutlinedInput-root': { - height: isScreenHeightLessThan800 ? '3rem' : '3.5rem', - fontSize: isScreenHeightLessThan800 ? 14 : 20, - }, - }} - renderInput={(params) => ( - - )} - /> - ); }