{filteredRows.length === 0 && !loading1 && !countSourceLoading && (
No deliveries to show
{selectedBatch === 'all'
? `No ${(STATUS_META[currentStatus]?.label || tabstatus).toLowerCase()} orders for this filter.`
: `No ${(STATUS_META[currentStatus]?.label || tabstatus).toLowerCase()} orders in ${BATCH_OPTIONS.find((b) => b.id === selectedBatch)?.label || 'this batch'}.`}
)}
{filteredRows.length === 0 && countSourceLoading && (
Loading deliveries…
)}
{filteredRows.map((row, index) => {
const rowStatusMeta = STATUS_META[String(row.status || '').toLowerCase()] || {
label: row.status || '—',
color: '#94a3b8',
icon: MdHistoryToggleOff
};
const RowStatusIcon = rowStatusMeta.icon;
const isSelected = !!deliverylist.find((res1) => res1.orderheaderid == row.orderheaderid);
const isOpen = productCollapse?.orderid === row?.orderid;
return (
{showSelect && (
{
if (e.target.checked) {
let arr = deliverylist;
arr.push({ ...row, sno: deliverylist.length + 1 });
setDeliverylist([...arr]);
} else {
let res = deliverylist.find((res1) => res1.orderheaderid == row.orderheaderid);
if (res) {
let arr = deliverylist;
arr.splice(res.sno - 1, 1);
arr.map((val, i) => {
val.sno = i + 1;
});
setDeliverylist([...arr]);
}
}
}}
checked={!!deliverylist.find((res1) => res1.orderheaderid == row.orderheaderid)}
/>
)}
{String(page * rowsPerPage + index + 1).padStart(2, '0')}
{rowStatusMeta.label}
{row.deliverytype == 'C' && (
{
if (productCollapse?.orderid === row.orderid) {
setProductCollapse(null);
setOrderHeaderId(null);
} else {
setProductCollapse(row);
setOrderHeaderId(row.orderheaderid);
}
}}
sx={{ borderRadius: 999, bgcolor: tint('#06b6d4'), color: '#06b6d4', border: `1px solid ${edge('#06b6d4')}`, '&:hover': { bgcolor: soft('#06b6d4') } }}
>
{isOpen ? : }
)}
{showAction && (
handleMenuOpen(e, row)}
sx={{ borderRadius: 999, bgcolor: tint('#C01227'), color: '#C01227', border: `1px solid ${edge('#C01227')}`, '&:hover': { bgcolor: soft('#C01227') } }}
>
)}
{row.bookingreference || `#${row.bookingid}`}
{row.createdat ? dayjs(row.createdat).format('DD/MM/YYYY hh:mm A') : '—'}
}
>
{row.pickupaddress || '—'}
{row.deliveryaddress || '—'}
{row.assignedmileruserid ? (
#{row.assignedmileruserid}
) : (
Unassigned
)}
{isOpen && (
Product Details
{orderdetails?.details?.map((product, idx2) => (
{product?.productname || 'Unnamed'}
Qty {product?.orderqty || 0} · ₹ {product?.price || 0}
₹ {(product?.productsumprice + product?.taxamount).toFixed(2) || 0}
))}
Total Amount
₹ {orderdetails?.pricedetails?.orderamount?.toFixed(2)}
)}
);
})}
{countSourceRows?.length != 0 && (
{countIsFetchingNext || countHasNext ? (
) : (
· End of list ·
)}
)}
) : (