diff --git a/packages/react-components/lib/tasks/create-task.tsx b/packages/react-components/lib/tasks/create-task.tsx index d1244c89f..7d9e3cfbb 100644 --- a/packages/react-components/lib/tasks/create-task.tsx +++ b/packages/react-components/lib/tasks/create-task.tsx @@ -147,302 +147,264 @@ function DeliveryTaskForm({ const theme = useTheme(); return ( - <> - - - - newValue !== null && - onChange({ - ...taskDesc, - pickup: { - ...taskDesc.pickup, - place: newValue, - }, - }) - } - onBlur={(ev) => - onChange({ - ...taskDesc, - pickup: { - ...taskDesc.pickup, - place: (ev.target as HTMLInputElement).value, - }, - }) - } - renderInput={(params) => ( - - )} - /> - - - - newValue !== null && - onChange({ - ...taskDesc, - pickup: { - ...taskDesc.pickup, - handler: newValue, - }, - }) - } - onBlur={(ev) => - onChange({ - ...taskDesc, - pickup: { - ...taskDesc.pickup, - handler: (ev.target as HTMLInputElement).value, - }, - }) - } - renderInput={(params) => } - /> - + + + + newValue !== null && + onChange({ + ...taskDesc, + pickup: { + ...taskDesc.pickup, + place: newValue, + }, + }) + } + onBlur={(ev) => + onChange({ + ...taskDesc, + pickup: { + ...taskDesc.pickup, + place: (ev.target as HTMLInputElement).value, + }, + }) + } + renderInput={(params) => } + /> - - - - newValue !== null && - onChange({ - ...taskDesc, - dropoff: { - ...taskDesc.dropoff, - place: newValue, - }, - }) - } - onBlur={(ev) => - onChange({ - ...taskDesc, - dropoff: { - ...taskDesc.dropoff, - place: (ev.target as HTMLInputElement).value, - }, - }) - } - renderInput={(params) => ( - - )} - /> - - - - newValue !== null && - onChange({ - ...taskDesc, - dropoff: { - ...taskDesc.dropoff, - handler: newValue, - }, - }) - } - onBlur={(ev) => - onChange({ - ...taskDesc, - dropoff: { - ...taskDesc.dropoff, - handler: (ev.target as HTMLInputElement).value, - }, - }) - } - renderInput={(params) => } - /> - + + + newValue !== null && + onChange({ + ...taskDesc, + pickup: { + ...taskDesc.pickup, + handler: newValue, + }, + }) + } + onBlur={(ev) => + onChange({ + ...taskDesc, + pickup: { + ...taskDesc.pickup, + handler: (ev.target as HTMLInputElement).value, + }, + }) + } + renderInput={(params) => } + /> + + + + newValue !== null && + onChange({ + ...taskDesc, + dropoff: { + ...taskDesc.dropoff, + place: newValue, + }, + }) + } + onBlur={(ev) => + onChange({ + ...taskDesc, + dropoff: { + ...taskDesc.dropoff, + place: (ev.target as HTMLInputElement).value, + }, + }) + } + renderInput={(params) => } + /> - - - - newValue !== null && - onChange({ - ...taskDesc, - pickup: { - ...taskDesc.pickup, - payload: { - ...taskDesc.pickup.payload, - sku: newValue, - }, + + + newValue !== null && + onChange({ + ...taskDesc, + dropoff: { + ...taskDesc.dropoff, + handler: newValue, + }, + }) + } + onBlur={(ev) => + onChange({ + ...taskDesc, + dropoff: { + ...taskDesc.dropoff, + handler: (ev.target as HTMLInputElement).value, + }, + }) + } + renderInput={(params) => } + /> + + + + newValue !== null && + onChange({ + ...taskDesc, + pickup: { + ...taskDesc.pickup, + payload: { + ...taskDesc.pickup.payload, + sku: newValue, }, - }) - } - onBlur={(ev) => - onChange({ - ...taskDesc, - pickup: { - ...taskDesc.dropoff, - payload: { - ...taskDesc.pickup.payload, - sku: (ev.target as HTMLInputElement).value, - }, + }, + }) + } + onBlur={(ev) => + onChange({ + ...taskDesc, + pickup: { + ...taskDesc.dropoff, + payload: { + ...taskDesc.pickup.payload, + sku: (ev.target as HTMLInputElement).value, }, - }) - } - renderInput={(params) => } - /> - - - - newValue !== null && - onChange({ - ...taskDesc, - pickup: { - ...taskDesc.pickup, - payload: { - ...taskDesc.pickup.payload, - quantity: typeof newValue == 'string' ? parseInt(newValue) : newValue, - }, + }, + }) + } + renderInput={(params) => } + /> + + + + newValue !== null && + onChange({ + ...taskDesc, + pickup: { + ...taskDesc.pickup, + payload: { + ...taskDesc.pickup.payload, + quantity: typeof newValue == 'string' ? parseInt(newValue) : newValue, }, - }) - } - onBlur={(ev) => - onChange({ - ...taskDesc, - pickup: { - ...taskDesc.pickup, - payload: { - ...taskDesc.pickup.payload, - quantity: parseInt((ev.target as HTMLInputElement).value), - }, + }, + }) + } + onBlur={(ev) => + onChange({ + ...taskDesc, + pickup: { + ...taskDesc.pickup, + payload: { + ...taskDesc.pickup.payload, + quantity: parseInt((ev.target as HTMLInputElement).value), }, - }) - } - renderInput={(params) => ( - - )} - /> - - - - newValue !== null && - onChange({ - ...taskDesc, - dropoff: { - ...taskDesc.dropoff, - payload: { - ...taskDesc.dropoff.payload, - sku: newValue, - }, + }, + }) + } + renderInput={(params) => } + /> + + + + newValue !== null && + onChange({ + ...taskDesc, + dropoff: { + ...taskDesc.dropoff, + payload: { + ...taskDesc.dropoff.payload, + sku: newValue, }, - }) - } - onBlur={(ev) => - onChange({ - ...taskDesc, - dropoff: { - ...taskDesc.dropoff, - payload: { - ...taskDesc.dropoff.payload, - sku: (ev.target as HTMLInputElement).value, - }, + }, + }) + } + onBlur={(ev) => + onChange({ + ...taskDesc, + dropoff: { + ...taskDesc.dropoff, + payload: { + ...taskDesc.dropoff.payload, + sku: (ev.target as HTMLInputElement).value, }, - }) - } - renderInput={(params) => } - /> - - - - newValue !== null && - onChange({ - ...taskDesc, - dropoff: { - ...taskDesc.dropoff, - payload: { - ...taskDesc.dropoff.payload, - quantity: typeof newValue == 'string' ? parseInt(newValue) : newValue, - }, + }, + }) + } + renderInput={(params) => } + /> + + + + newValue !== null && + onChange({ + ...taskDesc, + dropoff: { + ...taskDesc.dropoff, + payload: { + ...taskDesc.dropoff.payload, + quantity: typeof newValue == 'string' ? parseInt(newValue) : newValue, }, - }) - } - onBlur={(ev) => - onChange({ - ...taskDesc, - dropoff: { - ...taskDesc.dropoff, - payload: { - ...taskDesc.dropoff.payload, - quantity: parseInt((ev.target as HTMLInputElement).value), - }, + }, + }) + } + onBlur={(ev) => + onChange({ + ...taskDesc, + dropoff: { + ...taskDesc.dropoff, + payload: { + ...taskDesc.dropoff.payload, + quantity: parseInt((ev.target as HTMLInputElement).value), }, - }) - } - renderInput={(params) => ( - - )} - /> - + }, + }) + } + renderInput={(params) => } + /> - + ); } @@ -491,57 +453,50 @@ function LoopTaskForm({ taskDesc, loopWaypoints, onChange }: LoopTaskFormProps) const theme = useTheme(); return ( - <> - - - - newValue !== null && - onChange({ - ...taskDesc, - places: taskDesc.places.concat(newValue).filter( - (el: string) => el, // filter null and empty str in places array - ), - }) - } - renderInput={(params) => } - /> - - + + + newValue !== null && + onChange({ + ...taskDesc, + places: taskDesc.places.concat(newValue).filter( + (el: string) => el, // filter null and empty str in places array + ), + }) + } + renderInput={(params) => } + /> + + + { + onChange({ + ...taskDesc, + rounds: val, + }); }} - > - { - onChange({ - ...taskDesc, - rounds: val, - }); - }} - /> - + /> - - taskDesc.places.splice(places_index, 1) && - onChange({ - ...taskDesc, - }) - } - /> - + + + taskDesc.places.splice(places_index, 1) && + onChange({ + ...taskDesc, + }) + } + /> + + ); } @@ -567,7 +522,7 @@ function CleanTaskForm({ taskDesc, cleaningZones, onChange }: CleanTaskFormProps }) } onBlur={(ev) => onChange({ ...taskDesc, zone: (ev.target as HTMLInputElement).value })} - renderInput={(params) => } + renderInput={(params) => } /> ); } @@ -1065,22 +1020,24 @@ export function CreateTaskForm({ /> - - Clean - Loop - Delivery - - - + + + + Clean + Loop + Delivery + + + } /> - + )?.value || 0} onChange={(_ev, val) => { @@ -1127,6 +1077,11 @@ export function CreateTaskForm({ /> + {renderTaskDescriptionForm()} @@ -1243,7 +1199,7 @@ export function CreateTaskForm({ setOpenSchedulingDialog(false); }} > - +