updates on the api integration and the design changes on the whole website

This commit is contained in:
2026-08-11 11:18:40 +05:30
parent d144ff71a9
commit bf28249528
48 changed files with 2888 additions and 6361 deletions

View File

@@ -329,7 +329,6 @@ const Deliveries = () => {
const handleMenuOpen = (event, row) => {
setSelectedRow(row);
console.log('selectedRow', row);
setMenuAnchorEl(event.currentTarget);
};
@@ -346,7 +345,6 @@ const Deliveries = () => {
opentoast('Delivery Cancelled Successfully', 'success');
setCancelDeliveryOpen(false);
fetchCountRefetch(); // Refresh count data
fetchDeliveriesRefetch(); // Refresh deliveries
countSourceRefetch(); // Refresh the all-statuses dataset feeding table + chips
},
onError: (error) => {
@@ -357,14 +355,12 @@ const Deliveries = () => {
// ==============================|| cancelridernotification ||============================== //
const cancelridernotification = async () => {
console.log('cancelridernotification', selectedRow);
try {
// /admin/milers/:id/notify keys off milerprofileid, not the userid
// stored on the booking (confirmed live) — see fetchDeliveries in api.js.
return await notifyMiler(selectedRow.milerprofileid, 'DoormileXpress', `${selectedRow.orderid} have been Cancelled`);
} catch (err) {
opentoast(err.message, 'error', 2000);
console.log(err);
}
};
@@ -425,7 +421,6 @@ const Deliveries = () => {
opentoast('Rider Changed Successfully', 'success');
}
fetchCountRefetch(); // Refresh count data
fetchDeliveriesRefetch(); // Refresh deliveries
countSourceRefetch(); // Refresh the all-statuses dataset feeding table + chips
// notifyMiler wants a miler profile id, not an FCM token — the new API
// looks the device token up server-side. selectedRider comes straight
@@ -507,7 +502,6 @@ const Deliveries = () => {
setCurrentStatus('cancelled');
setTotalCount(countData?.cancelLength);
}
console.log(i);
setSearchword('');
};
@@ -515,31 +509,6 @@ const Deliveries = () => {
setOpen(false);
};
/* ============================================= || fetchDeliveries | ============================================= */
const {
isLoading: fetchDeliveriesIsLoading,
isError: fetchDeliveriesIsError,
error: fetchDeliveriesError,
refetch: fetchDeliveriesRefetch
} = useInfiniteQuery({
queryKey: [
'fetchdeliveries',
appId,
userid,
currentStatus,
startdate,
enddate,
rowsPerPage,
debouncedSearch,
tenantid,
locationid,
riderid
],
queryFn: fetchDeliveries,
getNextPageParam: (lastPage) => lastPage.nextPage ?? undefined
});
// (filteredRows is defined below, after countSourceRows / countSourceLoading
// are in scope — they're the single source of truth for both the table and
// the per-status chip counts.)
@@ -740,7 +709,6 @@ const Deliveries = () => {
queryFn: () => fetchCountAPI(appId, userid, startdate, enddate, rowsPerPage, debouncedSearch, tenantid, locationid, riderid)
});
useEffect(() => {
console.log('countData', countData);
if (tabvalue === 0 && countData) {
setTotalCount(countData.uncoveredLength);
}
@@ -755,11 +723,11 @@ const Deliveries = () => {
error: ridersListError
} = useQuery({
queryKey: ['ridersList', appId], // Unique key for caching & re-fetching
// fetchRidersList now toasts + returns [] internally on failure (was
// throwing after already toasting there too, which showed this same
// error twice) — no onError needed here anymore.
queryFn: fetchRidersList,
enabled: Boolean(appId),
onError: (err) => {
OpenToast(err.message, 'error', 2000);
}
enabled: Boolean(appId)
});
/* ============================================= || updatedelivery | ============================================= */
@@ -767,26 +735,21 @@ const Deliveries = () => {
const updateDeliveryMutation = useMutation({
mutationFn: (orderData) => updateDeliveryAPI(orderData),
onSuccess: (res) => {
console.log(res);
if (res.success) {
opentoast('Updated Successfully', 'success');
setDeliveryamount('');
setNotes('');
setDialogopen(false);
fetchDeliveriesRefetch();
fetchCountRefetch();
countSourceRefetch();
}
},
onError: (err) => {
console.log(err);
opentoast(err.message, 'success');
}
});
const errorMessage = fetchDeliveriesIsError
? `Error fetching deliveries: ${fetchDeliveriesError?.message}`
: fetchCountIsError
const errorMessage = fetchCountIsError
? `Error fetching count summary: ${fetchCountError?.message}`
: ridersListIsError
? `Error fetching riders: ${ridersListError?.message}`
@@ -797,7 +760,6 @@ const Deliveries = () => {
: null;
if (errorMessage) {
console.log('errorMessage', errorMessage);
OpenToast(errorMessage, 'error', 2000);
return null; // or return <></> if inside a component
}
@@ -816,7 +778,7 @@ const Deliveries = () => {
color: '#fff',
zIndex: (theme) => theme.zIndex.drawer + 1
}}
open={fetchCountIsLoading || fetchDeliveriesIsLoading || fetchtenantsIsLoading || fetchlocationsIsLoading || riderListIsLoading}
open={fetchCountIsLoading || fetchtenantsIsLoading || fetchlocationsIsLoading || riderListIsLoading}
>
{/* <CircularLoader color="inherit" /> */}
</Backdrop>
@@ -1736,8 +1698,8 @@ const Deliveries = () => {
{showAction && <TableCell align="right">Action</TableCell>}
</TableRow>
</TableHead>
{(loading1 || countSourceIsLoading) && <OrdersTableSkeleton col={8} />}
<TableBody>
{(loading1 || countSourceIsLoading) && <OrdersTableSkeleton col={8} />}
{filteredRows.length == 0 && !loading1 && !countSourceLoading && (
<TableRow>
<TableCell colSpan={totalCols} sx={{ py: 6 }}>
@@ -1816,7 +1778,6 @@ const Deliveries = () => {
setDeliverylist([...arr]);
}
}
console.log('list', deliverylist);
}}
checked={deliverylist.find((res1) => res1.orderheaderid == row.orderheaderid)}
/>
@@ -2696,7 +2657,6 @@ const Deliveries = () => {
setDatestatus('');
}
}
console.log(range);
}}
definedRanges={[
{