implementation on the dispatch and some change in the deliveries page

This commit is contained in:
2026-05-19 19:55:36 +05:30
parent 5a80256856
commit 4cd1b2212d
13 changed files with 19188 additions and 326 deletions

View File

@@ -484,16 +484,16 @@ const Deliveries = () => {
const errorMessage = fetchDeliveriesIsError
? `Error fetching percentages: ${fetchDeliveriesError?.message}`
: fetchPercentageIsError
? `Error fetching percentages: ${fetchPercentageError?.message}`
: fetchCountIsError
? `Error fetching percentages: ${fetchCountError?.message}`
: ridersListIsError
? `Error fetching percentages: ${ridersListError?.message}`
: fetchtenantsIsError
? `Error tenant list: ${fetchtenantsError?.message}`
: fetchlocationsIsError
? `Error location list: ${fetchlocationsError?.message}`
: null;
? `Error fetching percentages: ${fetchPercentageError?.message}`
: fetchCountIsError
? `Error fetching percentages: ${fetchCountError?.message}`
: ridersListIsError
? `Error fetching percentages: ${ridersListError?.message}`
: fetchtenantsIsError
? `Error tenant list: ${fetchtenantsError?.message}`
: fetchlocationsIsError
? `Error location list: ${fetchlocationsError?.message}`
: null;
if (errorMessage) {
console.log('errorMessage', errorMessage);
@@ -509,11 +509,11 @@ const Deliveries = () => {
fetchtenantsIsLoading ||
fetchlocationsIsLoading ||
riderListIsLoading) && (
<>
<Loader />
{/* <CircularLoader /> */}
</>
)}
<>
<Loader />
{/* <CircularLoader /> */}
</>
)}
{
<Backdrop
sx={{
@@ -872,6 +872,7 @@ const Deliveries = () => {
sx={{
maxHeight: 'calc(100vh - 190px)',
overflow: 'auto',
overflowX: 'auto',
'&::-webkit-scrollbar': {
width: '12px', // scroll bar width
cursor: 'pointer'
@@ -891,11 +892,11 @@ const Deliveries = () => {
}
}}
>
<Table stickyHeader>
<Table stickyHeader sx={{ minWidth: 1400 }}>
<TableHead>
<TableRow>
{tabstatus == 'Created' && (
<TableCell>
<TableCell sx={{ whiteSpace: 'nowrap' }}>
<Checkbox
indeterminate={deliverylist.length > 0 && deliverylist.length != rows.length}
onChange={(e) => {
@@ -909,26 +910,29 @@ const Deliveries = () => {
/>
</TableCell>
)}
<TableCell sx={{ position: 'sticky !important', backgroundColor: theme.palette.secondary.light }}>S.No </TableCell>
<TableCell sx={{ position: 'sticky !important', backgroundColor: theme.palette.secondary.light }}>Tenant </TableCell>
<TableCell sx={{ position: 'sticky !important', backgroundColor: theme.palette.secondary.light }}>
<TableCell sx={{ position: 'sticky !important', backgroundColor: theme.palette.secondary.light, whiteSpace: 'nowrap', border: 'none' }}>S.No </TableCell>
<TableCell sx={{ position: 'sticky !important', backgroundColor: theme.palette.secondary.light, whiteSpace: 'nowrap', border: 'none' }}>Tenant </TableCell>
<TableCell sx={{ position: 'sticky !important', backgroundColor: theme.palette.secondary.light, whiteSpace: 'nowrap', border: 'none' }}>
Order Location{' '}
</TableCell>
<TableCell sx={{ position: 'sticky !important', backgroundColor: theme.palette.secondary.light }}>Pickup </TableCell>
<TableCell sx={{ position: 'sticky !important', backgroundColor: theme.palette.secondary.light }}>Drop </TableCell>
<TableCell sx={{ position: 'sticky !important', backgroundColor: theme.palette.secondary.light }}>Rider </TableCell>
<TableCell sx={{ position: 'sticky !important', backgroundColor: theme.palette.secondary.light }}>Notes </TableCell>
<TableCell sx={{ position: 'sticky !important', backgroundColor: theme.palette.secondary.light }}>Qty</TableCell>
<TableCell sx={{ position: 'sticky !important', backgroundColor: theme.palette.secondary.light }}>COD </TableCell>
<TableCell sx={{ position: 'sticky !important', backgroundColor: theme.palette.secondary.light }}> Kms</TableCell>
<TableCell sx={{ position: 'sticky !important', backgroundColor: theme.palette.secondary.light }}>Amount </TableCell>
{/* <TableCell sx={{ position: 'sticky !important', backgroundColor: theme.palette.secondary.light }}>Status </TableCell> */}
<TableCell sx={{ position: 'sticky !important', backgroundColor: theme.palette.secondary.light, whiteSpace: 'nowrap', border: 'none' }}>Pickup </TableCell>
<TableCell sx={{ position: 'sticky !important', backgroundColor: theme.palette.secondary.light, whiteSpace: 'nowrap', border: 'none' }}>Drop </TableCell>
<TableCell sx={{ position: 'sticky !important', backgroundColor: theme.palette.secondary.light, whiteSpace: 'nowrap', border: 'none' }}>Rider </TableCell>
<TableCell sx={{ position: 'sticky !important', backgroundColor: theme.palette.secondary.light, whiteSpace: 'nowrap', border: 'none' }}>Est. Delivery Time</TableCell>
<TableCell sx={{ position: 'sticky !important', backgroundColor: theme.palette.secondary.light, whiteSpace: 'nowrap', border: 'none' }}>Transit</TableCell>
<TableCell sx={{ position: 'sticky !important', backgroundColor: theme.palette.secondary.light, whiteSpace: 'nowrap', border: 'none' }}> Kms</TableCell>
<TableCell sx={{ position: 'sticky !important', backgroundColor: theme.palette.secondary.light, whiteSpace: 'nowrap', border: 'none' }}>Amount </TableCell>
<TableCell sx={{ position: 'sticky !important', backgroundColor: theme.palette.secondary.light, whiteSpace: 'nowrap', border: 'none' }}>Notes </TableCell>
<TableCell sx={{ position: 'sticky !important', backgroundColor: theme.palette.secondary.light, whiteSpace: 'nowrap', border: 'none' }}>Qty</TableCell>
<TableCell sx={{ position: 'sticky !important', backgroundColor: theme.palette.secondary.light, whiteSpace: 'nowrap', border: 'none' }}>COD </TableCell>
{tabstatus !== 'Cancelled' && tabstatus !== 'Delivered' && (
<TableCell
align="right"
sx={{
position: 'sticky',
backgroundColor: theme.palette.secondary.light
position: 'sticky !important',
backgroundColor: theme.palette.secondary.light,
whiteSpace: 'nowrap',
border: 'none'
}}
>
Action
@@ -936,11 +940,11 @@ const Deliveries = () => {
)}
</TableRow>
</TableHead>
{(loading1 || fetchDeliveriesIsLoading) && <OrdersTableSkeleton col={6} />}
{(loading1 || fetchDeliveriesIsLoading) && <OrdersTableSkeleton col={8} />}
<TableBody>
{rows.length == 0 && !loading1 && (
<>
<TableCell colSpan={11}>
<TableCell colSpan={13}>
{/* <Stack width={'100%'} direction={'row'} justifyContent={'center'}> */}
<Empty description={`No ${tabstatus} Orders`} styles={{ description: { color: theme.palette.error.main } }} />
</TableCell>
@@ -1087,6 +1091,40 @@ const Deliveries = () => {
<Typography variant="subtitle2"> {`ID: ${row.userid}`}</Typography>
<Typography variant="subtitle2"> {row.ridercontact}</Typography>
</TableCell>
{/* Estimated Delivery Time */}
<TableCell align="left">
<Typography variant="subtitle1" noWrap>
{row.expecteddeliverytime ? dayjs(row.expecteddeliverytime).format('hh:mm A') : 'N/A'}
</Typography>
</TableCell>
{/* Transit Minutes */}
<TableCell align="left">
<Typography variant="subtitle1" noWrap>
{row.transitminutes || 0} min
</Typography>
</TableCell>
{/* kms */}
<TableCell>
<Stack direction={'column'} spacing={1}>
<Tooltip title=" KMS" placement="top">
<Chip label={row.kms || 0} size="small" variant="light" color="error" />
</Tooltip>
<Tooltip title="Actual KMS">
<Chip label={row.cumulativekms || 0} size="small" color="success" variant="light" />
</Tooltip>
</Stack>
</TableCell>
{/* amount */}
<TableCell align="left">
<Stack direction={'column'} spacing={1}>
<Tooltip title=" Delivery Charge" placement="top">
<Chip label={`${row.deliverycharges?.toFixed(2)}` || 0} size="small" variant="light" color="error" />
</Tooltip>
<Tooltip title="Delivery Amount">
<Chip label={`${row.deliveryamt?.toFixed(2)}` || 0} size="small" color="success" variant="light" />
</Tooltip>
</Stack>
</TableCell>
{/* {qty} */}
<TableCell>
<Typography>{row.notes}</Typography>
@@ -1117,52 +1155,6 @@ const Deliveries = () => {
</Typography>
)}
</TableCell>
{/* kms */}
<TableCell>
<Stack direction={'column'} spacing={1}>
<Tooltip title=" KMS" placement="top">
<Chip label={row.kms || 0} size="small" variant="light" color="error" />
</Tooltip>
<Tooltip title="Actual KMS">
<Chip label={row.cumulativekms || 0} size="small" color="success" variant="light" />
</Tooltip>
</Stack>
</TableCell>
{/* amount */}
<TableCell align="left">
{' '}
<Stack direction={'column'} spacing={1}>
<Tooltip title=" Delivery Charge" placement="top">
<Chip label={`${row.deliverycharges?.toFixed(2)}` || 0} size="small" variant="light" color="error" />
</Tooltip>
<Tooltip title="Delivery Amount">
<Chip label={`${row.deliveryamt?.toFixed(2)}` || 0} size="small" color="success" variant="light" />
</Tooltip>
</Stack>
</TableCell>
{/* status */}
{/* <TableCell align="left">
<Stack direction="row">
{row.orderstatus === 'pending' && <Chip label="Pending" color="warning" size="small" />}
{row.orderstatus === 'modified' && <Chip label="Confirmed" color="success" size="small" />}
{row.orderstatus === 'cancelled' && <Chip label="Cancelled" color="error" size="small" />}
{row.orderstatus === 'delivered' && <Chip label="Completed" color="success" size="small" />}
{row.orderstatus === 'processing' && <Chip label="Processing" color="primary" size="small" />}
{row.orderstatus === 'ready' && <Chip label="Accepted" color="info" size="small" />}
{row.orderstatus === 'confirmed' && <Chip label="Confirmed" color="success" size="small" />}
{row.orderstatus === 'active' && <Chip label="Active" color="info" size="small" />}
{row.orderstatus === 'closed' && <Chip label="Closed" color="info" size="small" />}
{row.orderstatus === 'created' && <Chip label="Created" color="primary" size="small" />}
{row.orderstatus === 'picked' && <Chip label="Picked" color="info" size="small" />}
{row.orderstatus === 'skipped' && <Chip label="Skipped" color="secondary" size="small" />}
{row.orderstatus === 'accepted' && (
<Chip label="Accepted" size="small" sx={{ bgcolor: theme.palette.chip.accept, color: 'white' }} />
)}
{row.orderstatus === 'arrived' && (
<Chip label="Arrived" size="small" sx={{ bgcolor: theme.palette.chip.arrive, color: 'white' }} />
)}
</Stack>
</TableCell> */}
{/* Action */}
{tabstatus !== 'Cancelled' && tabstatus !== 'Delivered' && (
<TableCell>