updates on the dispatch page

This commit is contained in:
2026-05-28 19:37:04 +05:30
parent 8cc7cc75f9
commit 39b562ddb5
8 changed files with 3937 additions and 1714 deletions

View File

@@ -1096,13 +1096,11 @@
}
.gradient-btn-create:hover {
transform: translateY(-1px) !important;
filter: brightness(1.04);
box-shadow: 0 8px 18px -4px rgba(24, 144, 255, 0.40), 0 3px 8px rgba(101, 56, 122, 0.18) !important;
}
.gradient-btn-create:active {
transform: translateY(0) !important;
filter: brightness(0.98);
}

File diff suppressed because it is too large Load Diff

View File

@@ -142,6 +142,10 @@ const Orders = () => {
const [finaldeliveryList, setFinalDeliveryList] = useState([]);
const aiModeRef = useRef(0);
// Caches the inputs of the most recent AI Assign call so we can forward them
// to the /nearle/dispatch/preview page via navigate state (the page re-uses
// them for its Re-Assign button).
const aiMutationContextRef = useRef(null);
const rowsPerPage = 100;
const transportOptions = [
@@ -417,19 +421,25 @@ const Orders = () => {
setZoneData(data?.zones);
setMetaData(data?.meta);
setDispatchPreviewData(data);
setAiDialog(true);
// navigate('/nearle/orders/optimisedpreview', {
// state: {
// zoneSummary: data?.zone_analysis,
// deliverylist: data?.details, // to deliveryDetails
// zoneData: data?.zones,
// metaData: data?.meta,
// riderToken: rider.userfcmtoken,
// appId,
// aiMode: aiModeRef.current,
// reassignOrders
// }
// });
// Route the AI Assign result to the dedicated Preview page (Dispatch
// view + Reconcile tab + Change Rider). The previous in-page dialog
// (aiDialog) is left intact but no longer opened — the page replaces
// it. All inputs needed for Re-Assign / Assign Orders are forwarded.
const ctx = aiMutationContextRef.current || {};
navigate('/nearle/dispatch/preview', {
state: {
dispatchPreviewData: data,
aiMode: ctx.aiMode ?? aiModeRef.current,
selectedMode: ctx.selectedMode || selectedMode,
deliveryData: ctx.deliveryData || [],
autoRiders: ctx.autoRiders || autoRiders || [],
absentRidersPayload: ctx.absentRidersPayload || [],
rider: ctx.rider || rider,
appId: ctx.appId ?? appId,
tenantId: ctx.tenantid ?? tenantid,
startdate
}
});
}
},
onError: (error) => {
@@ -562,6 +572,19 @@ const Orders = () => {
`Rider ${r.userid}`
}));
// Remember the inputs so the Preview page can re-run Re-Assign with the
// same payload without us having to re-derive it from current Orders state.
aiMutationContextRef.current = {
deliveryData,
absentRidersPayload,
autoRiders,
selectedMode,
aiMode: aiModeRef.current,
rider,
appId,
tenantid
};
if (aiModeRef.current == 0) {
// manual assign
createDeliveryMutation.mutate({