orderdetails scroll
This commit is contained in:
@@ -24,13 +24,6 @@ export const fetchOrderInsight = async () => {
|
||||
return response.data.details;
|
||||
};
|
||||
|
||||
// ==============================|| fetchDeliverySummary (delivery)||============================== //
|
||||
export const fetchDeliverySummary = async () => {
|
||||
const response = await axios.get(`${process.env.REACT_APP_URL}/deliveries/deliverysummary`);
|
||||
console.log('fetchDeliverySummary', response.data.details);
|
||||
return response.data.details;
|
||||
};
|
||||
|
||||
// ==============================|| fetchDeliveryInsight (delivery)||============================== //
|
||||
export const fetchDeliveryInsight = async () => {
|
||||
const response = await axios.get(`${process.env.REACT_APP_URL}/deliveries/getdeliveryinsight`);
|
||||
@@ -49,7 +42,7 @@ export const fetchDeliveryLocationSummary = async () => {
|
||||
// ==============================|| fetchAllTenants (clients)||============================== //
|
||||
|
||||
export const fetchAllTenants = async ({ queryKey }) => {
|
||||
const [size, status, pageno, search, rough] = queryKey;
|
||||
const [size, pageno, search] = queryKey;
|
||||
|
||||
let url = '';
|
||||
if (search) {
|
||||
@@ -95,7 +88,7 @@ export const fetchOrdersSummary = async ({ queryKey }) => {
|
||||
};
|
||||
// ==============================|| fetchLocations (orders summary))||============================== //
|
||||
|
||||
export const fetchLocations = async ({ queryKey }) => {
|
||||
export const fetchLocations = async () => {
|
||||
const response = await axios.get(`${process.env.REACT_APP_URL}/partners/getpartners`);
|
||||
const updatedLocations = [
|
||||
...response.data.details,
|
||||
@@ -105,9 +98,18 @@ export const fetchLocations = async ({ queryKey }) => {
|
||||
|
||||
return updatedLocations;
|
||||
};
|
||||
// ==============================|| fetchDeliverySummary (orders summary)||============================== //
|
||||
export const fetchDeliverySummary = async ({ queryKey }) => {
|
||||
const [, startdate, enddate, currentStatus] = queryKey;
|
||||
const response = await axios.get(
|
||||
`${process.env.REACT_APP_URL}/deliveries/deliverysummary?tenantid=${tenid}&fromdate=${startdate}&todate=${enddate}`
|
||||
);
|
||||
console.log('fetchDeliverySummary', response.data.details);
|
||||
return response.data.details;
|
||||
};
|
||||
// ==============================|| fetchAppLocations (report summary))||============================== //
|
||||
|
||||
export const fetchAppLocations = async ({ queryKey }) => {
|
||||
export const fetchAppLocations = async () => {
|
||||
const response = await axios.get(`${process.env.REACT_APP_URL}/partners/getpartners`);
|
||||
const updatedLocations = [
|
||||
...response.data.details,
|
||||
@@ -134,17 +136,38 @@ export const fetchRidersSummary = async ({ queryKey }) => {
|
||||
};
|
||||
|
||||
// ==============================|| fetchorderdetails (orders detail)||============================== //
|
||||
export const fetchorderdetails = async ({ queryKey }) => {
|
||||
console.log('queryKey of fetchorderdetails', queryKey);
|
||||
export const fetchorderdetails = async ({ pageParam = 0, queryKey }) => {
|
||||
const [startdate, enddate, currentStatus] = queryKey;
|
||||
|
||||
const limit = 10;
|
||||
const pageno = pageParam + 1; // ✅ increment page by 1 each time
|
||||
|
||||
const response = await axios.get(
|
||||
`${process.env.REACT_APP_URL}/deliveries/getdeliveries/?tenantid=${tenid}&fromdate=${startdate}&todate=${enddate}&status=${
|
||||
currentStatus == 'All' ? '' : currentStatus
|
||||
}`
|
||||
currentStatus === 'All' ? '' : currentStatus
|
||||
}&pageno=${pageno}&pagesize=${limit}`
|
||||
);
|
||||
console.log('fetchorderdetails', response.data.details);
|
||||
return response.data.details;
|
||||
|
||||
const details = response.data.details || [];
|
||||
const hasMore = details.length === limit; // ✅ only if you got full data
|
||||
|
||||
return {
|
||||
details,
|
||||
nextPage: hasMore ? pageParam + 1 : undefined // nextPage increments correctly
|
||||
};
|
||||
};
|
||||
|
||||
// export const fetchorderdetails = async ({ queryKey }) => {
|
||||
// console.log('queryKey of fetchorderdetails', queryKey);
|
||||
// const [startdate, enddate, currentStatus] = queryKey;
|
||||
// const response = await axios.get(
|
||||
// `${process.env.REACT_APP_URL}/deliveries/getdeliveries/?tenantid=${tenid}&fromdate=${startdate}&todate=${enddate}&status=${
|
||||
// currentStatus == 'All' ? '' : currentStatus
|
||||
// }`
|
||||
// );
|
||||
// console.log('fetchorderdetails', response.data.details);
|
||||
// return response.data.details;
|
||||
// };
|
||||
// ==============================|| fetchCount (orders detail)||============================== //
|
||||
export const fetchCount = async ({ queryKey }) => {
|
||||
console.log('queryKey of fetchCount', queryKey);
|
||||
|
||||
Reference in New Issue
Block a user