Skip to content

Commit

Permalink
First iteration of double compose delivery task
Browse files Browse the repository at this point in the history
Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
  • Loading branch information
aaronchongth committed Jul 2, 2024
1 parent 105628b commit f921e1a
Show file tree
Hide file tree
Showing 5 changed files with 908 additions and 113 deletions.
3 changes: 3 additions & 0 deletions packages/dashboard/src/managers/resource-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ export default class ResourceManager {
this.logos = new LogoResourceManager(resources.logos || {});
this.tasks = new TaskResourceManager(
resources.allowedTasks || [
{
task_definition_id: 'double-compose-delivery',
},
{
task_definition_id: 'patrol',
},
Expand Down
29 changes: 29 additions & 0 deletions packages/react-components/lib/tasks/create-task.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ import {
DeliveryPickupTaskDefinition,
DeliverySequentialLotPickupTaskDefinition,
DeliveryAreaPickupTaskDefinition,
DoubleComposeDeliveryTaskDescription,
DoubleComposeDeliveryTaskDefinition,
makeDoubleComposeDeliveryTaskBookingLabel,
DoubleComposeDeliveryTaskForm,
} from './types/delivery-custom';
import {
makePatrolTaskBookingLabel,
Expand All @@ -89,6 +93,7 @@ export interface TaskDefinition {
export type TaskDescription =
| DeliveryPickupTaskDescription
| DeliveryCustomTaskDescription
| DoubleComposeDeliveryTaskDescription
| PatrolTaskDescription
| DeliveryTaskDescription
| ComposeCleanTaskDescription;
Expand Down Expand Up @@ -585,6 +590,27 @@ export function CreateTaskForm({
onValidate={onValidate}
/>
);
case DoubleComposeDeliveryTaskDefinition.taskDefinitionId:
return (
<DoubleComposeDeliveryTaskForm
taskDesc={taskRequest.description as DoubleComposeDeliveryTaskDescription}
pickupPoints={pickupPoints}
cartIds={cartIds}
dropoffPoints={dropoffPoints}
onChange={(desc: DoubleComposeDeliveryTaskDescription) => {
desc.category = taskRequest.description.category;
desc.phases[0].activity.description.activities[1].description.category =
taskRequest.description.category;
desc.phases[3].activity.description.activities[1].description.category =
taskRequest.description.category;
handleTaskDescriptionChange(
DoubleComposeDeliveryTaskDefinition.requestCategory,
desc,
);
}}
onValidate={onValidate}
/>
);
case CustomComposeTaskDefinition.taskDefinitionId:
return (
<CustomComposeTaskForm
Expand Down Expand Up @@ -659,6 +685,9 @@ export function CreateTaskForm({
case DeliveryAreaPickupTaskDefinition.taskDefinitionId:
requestBookingLabel = makeDeliveryCustomTaskBookingLabel(request.description);
break;
case DoubleComposeDeliveryTaskDefinition.taskDefinitionId:
requestBookingLabel = makeDoubleComposeDeliveryTaskBookingLabel(request.description);
break;
case PatrolTaskDefinition.taskDefinitionId:
requestBookingLabel = makePatrolTaskBookingLabel(request.description);
break;
Expand Down
Loading

0 comments on commit f921e1a

Please sign in to comment.