overall commit
This commit is contained in:
@@ -89,6 +89,9 @@ const Orders = () => {
|
||||
|
||||
const [searchword, setSearchword] = useState('');
|
||||
const [debouncedSearch, setDebouncedSearch] = useState('');
|
||||
const getValueColor = (value) => {
|
||||
return value !== 0 ? 'red' : 'inherit';
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
const handler = setTimeout(() => {
|
||||
@@ -162,7 +165,7 @@ const Orders = () => {
|
||||
anchorOrigin: { vertical: 'top', horizontal: 'right' },
|
||||
autoHideDuration: 2000
|
||||
});
|
||||
getOrders();
|
||||
refetchOrders();
|
||||
fetchorderscount();
|
||||
setCancelOpen(false);
|
||||
}
|
||||
@@ -215,7 +218,8 @@ const Orders = () => {
|
||||
fetchNextPage,
|
||||
isLoading: isLoadingGeyOrders,
|
||||
hasNextPage,
|
||||
isFetchingNextPage
|
||||
isFetchingNextPage,
|
||||
refetch: refetchOrders
|
||||
// status: rowdataStatus
|
||||
} = useInfiniteQuery({
|
||||
queryKey: [tabstatus, startdate, enddate, page, rowsPerPage, debouncedSearch, locationId],
|
||||
@@ -528,7 +532,7 @@ const Orders = () => {
|
||||
sx={{ visibility: searchword ? 'visible' : 'hidden' }}
|
||||
onClick={() => {
|
||||
setSearchword('');
|
||||
getOrders();
|
||||
refetchOrders();
|
||||
fetchorderscount();
|
||||
}}
|
||||
>
|
||||
@@ -574,9 +578,16 @@ const Orders = () => {
|
||||
<TableHead>
|
||||
<TableRow sx={{}}>
|
||||
<TableCell sx={{ position: 'sticky !important', backgroundColor: theme.palette.secondary.light }}> S.No</TableCell>
|
||||
<TableCell sx={{ position: 'sticky !important', backgroundColor: theme.palette.secondary.light }}> Orders</TableCell>
|
||||
<TableCell sx={{ position: 'sticky !important', backgroundColor: theme.palette.secondary.light }}>
|
||||
{' '}
|
||||
Orders 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 }}> 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 }}> Charges </TableCell>
|
||||
<TableCell sx={{ position: 'sticky !important', backgroundColor: theme.palette.secondary.light }}> Notes</TableCell>
|
||||
<TableCell sx={{ position: 'sticky !important', backgroundColor: theme.palette.secondary.light }}> Status </TableCell>
|
||||
{currentStatus == 'created' && (
|
||||
@@ -623,9 +634,9 @@ const Orders = () => {
|
||||
<TableBody>
|
||||
{rows?.length == 0 && (
|
||||
<>
|
||||
<TableCell colSpan={7}>
|
||||
<TableCell colSpan={tabstatus === 'Created' ? 11 : 10}>
|
||||
<Stack width={'100%'} direction={'row'} justifyContent={'center'}>
|
||||
<Empty />
|
||||
<Empty description={' Orders not found in this status'} />
|
||||
</Stack>
|
||||
</TableCell>
|
||||
</>
|
||||
@@ -645,72 +656,99 @@ const Orders = () => {
|
||||
</TableCell>
|
||||
|
||||
<TableCell align="left">
|
||||
<Typography variant="subtitle1" noWrap>
|
||||
{row.locationname} {row.locationsuburb && `- ${row.locationsuburb}`}
|
||||
</Typography>
|
||||
<Typography variant="body2" noWrap>
|
||||
{row.orderid}
|
||||
</Typography>
|
||||
<Typography noWrap sx={{ fontSize: '11px' }}>
|
||||
{dayjs(row.deliverydate).utc().format('DD/MM/YYYY')}
|
||||
</Typography>
|
||||
<Typography noWrap sx={{ fontSize: '11px' }} variant="h5">
|
||||
{dayjs(row.deliverydate).utc().format('hh:mm A')}
|
||||
</Typography>
|
||||
<Stack direction={'row'} spacing={1} alignItems="center">
|
||||
<Typography noWrap sx={{ fontSize: '11px' }}>
|
||||
{dayjs(row.pickupslot).format('DD/MM/YYYY')}
|
||||
</Typography>
|
||||
<Tooltip title={'Pickup Slot'}>
|
||||
<Typography noWrap sx={{ fontSize: '11px' }} variant="h5">
|
||||
{dayjs(row.pickupslot).format('hh:mm A')}
|
||||
</Typography>
|
||||
</Tooltip>
|
||||
</Stack>{' '}
|
||||
{/* <Stack direction={'row'} spacing={1} alignItems="center">
|
||||
<Stack>
|
||||
<Typography noWrap sx={{ fontSize: '11px' }}>
|
||||
{dayjs(row.orderdate).utc().format('DD/MM/YYYY')}
|
||||
</Typography>
|
||||
<Typography noWrap sx={{ fontSize: '11px' }} variant="h5">
|
||||
{dayjs(row.orderdate).utc().format('hh:mm A')}
|
||||
</Typography>
|
||||
</Stack>
|
||||
-
|
||||
<Stack>
|
||||
<Typography noWrap sx={{ fontSize: '11px' }}>
|
||||
{dayjs(row.deliverydate).utc().format('DD/MM/YYYY')}
|
||||
</Typography>
|
||||
<Typography noWrap sx={{ fontSize: '11px' }} variant="h5">
|
||||
{dayjs(row.deliverydate).utc().format('hh:mm A')}
|
||||
</Typography>
|
||||
</Stack>
|
||||
</Stack> */}
|
||||
</TableCell>
|
||||
|
||||
<TableCell align="left">
|
||||
<Stack direction={'row'} spacing={1}>
|
||||
<Avatar
|
||||
alt=""
|
||||
size="sm"
|
||||
sx={{
|
||||
width: '25px',
|
||||
height: '25px'
|
||||
}}
|
||||
></Avatar>
|
||||
<Stack direction="column">
|
||||
<Typography variant="caption">{row.pickupcustomer}</Typography>
|
||||
<Typography variant="caption" color="textSecondary">
|
||||
{row.pickupcontactno}
|
||||
</Typography>
|
||||
<Typography variant="subtitle2">{row.pickupcustomer}</Typography>
|
||||
<Typography variant="caption">{row.pickupcontactno}</Typography>
|
||||
<Tooltip title={row.pickupaddress}>
|
||||
<Typography variant="caption" color="textSecondary">
|
||||
{row.pickupsuburb || row.pickupaddress.slice(0, 20)}
|
||||
</Typography>
|
||||
<Typography variant="caption">{row.pickupsuburb || row.pickupaddress.slice(0, 20)}</Typography>
|
||||
</Tooltip>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</TableCell>
|
||||
<TableCell align="left">
|
||||
<Stack direction={'row'} spacing={1}>
|
||||
<Avatar
|
||||
alt=""
|
||||
size="sm"
|
||||
sx={{
|
||||
width: '25px',
|
||||
height: '25px'
|
||||
}}
|
||||
></Avatar>
|
||||
<Stack direction="column">
|
||||
<Typography variant="caption">{row.deliverycustomer}</Typography>
|
||||
<Typography variant="caption" color="textSecondary">
|
||||
{row.deliverycontactno}
|
||||
</Typography>
|
||||
<Typography variant="subtitle2">{row.deliverycustomer}</Typography>
|
||||
<Typography variant="caption">{row.deliverycontactno}</Typography>
|
||||
<Tooltip title={row.deliveryaddress}>
|
||||
<Typography variant="caption" color="textSecondary">
|
||||
{/* {row.pickupaddress.slice(0, 20)} */}
|
||||
{row.deliverysuburb || row.deliveryaddress.slice(0, 20)}
|
||||
<Typography variant="caption">
|
||||
{row.deliverysuburb ||
|
||||
(row.deliveryaddress?.length > 20 ? `${row.deliveryaddress.slice(0, 20)}...` : row.deliveryaddress)}
|
||||
</Typography>
|
||||
</Tooltip>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</TableCell>
|
||||
<TableCell align="left">{row.ordernotes}</TableCell>
|
||||
{/* <TableCell align="left"><Chip label={row.itemcount} color="primary" variant="light" size="small" /></TableCell> */}
|
||||
|
||||
<TableCell align="left">
|
||||
<Typography variant="subtitle1" sx={{ color: getValueColor(row.quantity), textAlign: 'center' }}>
|
||||
{row.quantity}
|
||||
</Typography>
|
||||
</TableCell>
|
||||
<TableCell align="left">
|
||||
<Typography variant="subtitle1" sx={{ color: getValueColor(row.collectionamt), textAlign: 'center' }}>
|
||||
₹{row.collectionamt.toFixed(2)}
|
||||
</Typography>
|
||||
</TableCell>
|
||||
<TableCell align="left">
|
||||
<Typography variant="subtitle1" sx={{ color: getValueColor(row.kms), textAlign: 'center' }}>
|
||||
{row.kms}
|
||||
</Typography>
|
||||
</TableCell>
|
||||
|
||||
<TableCell align="left">
|
||||
<Typography variant="subtitle1" sx={{ color: getValueColor(row.deliverycharge), textAlign: 'center' }}>
|
||||
₹{row.deliverycharge.toFixed(2)}
|
||||
</Typography>
|
||||
</TableCell>
|
||||
<TableCell align="left">
|
||||
<Typography>{row.ordernotes}</Typography>
|
||||
</TableCell>
|
||||
<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="primary" size="small" />}
|
||||
{row.orderstatus === 'delivered' && <Chip label="Delivered" 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" />}
|
||||
@@ -777,6 +815,16 @@ const Orders = () => {
|
||||
</Typography>
|
||||
</Stack>
|
||||
<Stack direction="row" spacing={2} sx={{ width: 1 }}>
|
||||
<Button
|
||||
fullWidth
|
||||
onClick={() => {
|
||||
setCancelOpen(false);
|
||||
}}
|
||||
color="secondary"
|
||||
variant="outlined"
|
||||
>
|
||||
No
|
||||
</Button>{' '}
|
||||
<Button
|
||||
fullWidth
|
||||
color="error"
|
||||
@@ -788,16 +836,6 @@ const Orders = () => {
|
||||
>
|
||||
Yes, Cancel
|
||||
</Button>
|
||||
<Button
|
||||
fullWidth
|
||||
onClick={() => {
|
||||
setCancelOpen(false);
|
||||
}}
|
||||
color="secondary"
|
||||
variant="outlined"
|
||||
>
|
||||
No
|
||||
</Button>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</DialogContent>
|
||||
|
||||
Reference in New Issue
Block a user