updates on the dispatch page preview

This commit is contained in:
2026-08-28 17:14:11 +05:30
parent 8d54a317cc
commit 3d6160e3f1
4 changed files with 224 additions and 140 deletions

View File

@@ -29,13 +29,17 @@ export const extractRiders = (previewData) => {
map.set(key, { rider_id: riderId, rider_name: riderName, orders: [] });
}
const entry = map.get(key);
(orders || []).forEach((o) => {
const oid = o?.orderid != null ? String(o.orderid) : null;
(orders || []).forEach((o, oIdx) => {
const resolvedOrderId = o?.orderid || o?.bookingno || o?.bookingid || o?.order_id || o?.booking_id || o?.consignment_id || o?.id || `ord-${oIdx + 1}`;
const oid = String(resolvedOrderId);
if (oid) {
if (seenOrderIds.has(oid)) return;
seenOrderIds.add(oid);
}
entry.orders.push(o);
entry.orders.push({
...o,
orderid: resolvedOrderId
});
});
if (!entry.rider_name && riderName) entry.rider_name = riderName;
};