updates on the deliveries page and the order creation page
This commit is contained in:
@@ -152,13 +152,27 @@ export const finalCreatedeliveries = async (deliveryData) => {
|
||||
export const createAutomationDeliveries = async (variables) => {
|
||||
console.log('variables', variables);
|
||||
|
||||
// optimse the orders and auto rider assign
|
||||
const response = await axios.post(
|
||||
const absentRiders = Array.isArray(variables.absent_riders) ? variables.absent_riders : [];
|
||||
|
||||
// Bike mode (routes.workolik) historically accepted just the deliveries
|
||||
// array as the body. To carry the operator's "Absent Riders" picks
|
||||
// through to the AI assignment, we now wrap the body as
|
||||
// { deliveries: [...], absent_riders: [...] }
|
||||
// for that endpoint. Auto mode (routemate) already uses a structured
|
||||
// body via `variables.data`, so we just merge absent_riders into it.
|
||||
const url =
|
||||
variables.selectedMode.value == 1
|
||||
? `https://routes.workolik.com/api/v1/optimization/riderassign?hypertuning_params=${variables.hypertuning_params}`
|
||||
: `https://routemate.workolik.com/api/v1/optimization/riderassign?strategy=multi_trip`,
|
||||
variables.selectedMode.value == 1 ? variables.deliveries : variables.data
|
||||
);
|
||||
: `https://routemate.workolik.com/api/v1/optimization/riderassign?strategy=multi_trip`;
|
||||
|
||||
const body =
|
||||
variables.selectedMode.value == 1
|
||||
? { deliveries: variables.deliveries, absent_riders: absentRiders }
|
||||
: { ...(variables.data || {}), absent_riders: absentRiders };
|
||||
|
||||
console.log('createAutomationDeliveries body', body);
|
||||
|
||||
const response = await axios.post(url, body);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user