initialised commit on the ui converted in mui to astryx and changed the design to doormile
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import axios from 'axios';
|
||||
import { OpenToast } from 'components/nearle_components/OpenToast';
|
||||
import logger from 'utils/logger';
|
||||
const tenid = localStorage.getItem('tenantid');
|
||||
|
||||
export const fetchOrders = async ({ pageParam = 1, queryKey }) => {
|
||||
@@ -55,14 +56,14 @@ export const fetchorderscount = async ({ queryKey }) => {
|
||||
// ==============================|| fetchOrderSummary (orders)||============================== //
|
||||
export const fetchOrderSummary = async () => {
|
||||
const response = await axios.get(`${process.env.REACT_APP_URL}/orders/getordersummary`);
|
||||
console.log('fetchOrderSummary', response.data.details);
|
||||
logger.info('fetchOrderSummary', response.data.details);
|
||||
return response.data.details;
|
||||
};
|
||||
|
||||
// ==============================|| fetchLocationSummary (orders)||============================== //
|
||||
export const fetchLocationSummary = async () => {
|
||||
const response = await axios.get(`${process.env.REACT_APP_URL}/orders/getlocationsummary`);
|
||||
console.log('fetchLocationSummary', response.data.details);
|
||||
logger.info('fetchLocationSummary', response.data.details);
|
||||
|
||||
return response.data.details;
|
||||
};
|
||||
@@ -70,7 +71,7 @@ export const fetchLocationSummary = async () => {
|
||||
// ==============================|| fetchOrderInsight (orders)||============================== //
|
||||
export const fetchOrderInsight = async () => {
|
||||
const response = await axios.get(`${process.env.REACT_APP_URL}/orders/getorderinsight`);
|
||||
console.log('fetchOrderInsight', response.data.details);
|
||||
logger.info('fetchOrderInsight', response.data.details);
|
||||
|
||||
return response.data.details;
|
||||
};
|
||||
@@ -78,14 +79,14 @@ export const fetchOrderInsight = async () => {
|
||||
// ==============================|| fetchDeliveryInsight (delivery)||============================== //
|
||||
export const fetchDeliveryInsight = async () => {
|
||||
const response = await axios.get(`${process.env.REACT_APP_URL}/deliveries/getdeliveryinsight`);
|
||||
console.log('fetchDeliveryInsight', response.data.details);
|
||||
logger.info('fetchDeliveryInsight', response.data.details);
|
||||
|
||||
return response.data.details;
|
||||
};
|
||||
// ==============================|| fetchDeliveryLocationSummary (delivery)||============================== //
|
||||
export const fetchDeliveryLocationSummary = async () => {
|
||||
const response = await axios.get(`${process.env.REACT_APP_URL}/deliveries/getlocationsummary`);
|
||||
console.log('fetchDeliveryLocationSummary', response.data.details);
|
||||
logger.info('fetchDeliveryLocationSummary', response.data.details);
|
||||
|
||||
return response.data.details;
|
||||
};
|
||||
@@ -121,7 +122,7 @@ export const fetchAllTenants = async ({ queryKey }) => {
|
||||
const response = await axios.get(url);
|
||||
|
||||
// tenants/search/?keyword=${search}
|
||||
console.log('fetchAllTenants', response.data.details);
|
||||
logger.info('fetchAllTenants', response.data.details);
|
||||
|
||||
return response.data.details;
|
||||
};
|
||||
@@ -129,7 +130,7 @@ export const fetchAllTenants = async ({ queryKey }) => {
|
||||
export const fetchCustomersList = async ({ queryKey }) => {
|
||||
const [pages] = queryKey;
|
||||
const response = await axios.get(`${process.env.REACT_APP_URL}/customers/getallcustomers/?pageno=${pages}&pagesize=10`);
|
||||
console.log('fetchCustomersList', response.data.details);
|
||||
logger.info('fetchCustomersList', response.data.details);
|
||||
return response.data.details;
|
||||
};
|
||||
// ==============================|| gettenantcustomers (customers)||============================== //
|
||||
@@ -158,39 +159,39 @@ export const gettenantcustomers = async ({ pageParam = 1, queryKey }) => {
|
||||
export const fetchCustomersListBySearch = async ({ queryKey }) => {
|
||||
const [search] = queryKey;
|
||||
const response = await axios.get(search.lenght > 3 && `${process.env.REACT_APP_URL}/customers/search/?keyword=${search}`);
|
||||
console.log('fetchCustomersListBySearch', response.data.details);
|
||||
logger.info('fetchCustomersListBySearch', response.data.details);
|
||||
return response.data.details;
|
||||
};
|
||||
// ==============================|| fetchOrdersSummary (rider summary)||============================== //
|
||||
export const fetchOrdersSummary = async ({ queryKey }) => {
|
||||
console.log('queryKey for fetchOrdersSummary', queryKey);
|
||||
logger.info('queryKey for fetchOrdersSummary', queryKey);
|
||||
const [startdate, enddate] = queryKey;
|
||||
const response = await axios.get(
|
||||
`${process.env.REACT_APP_URL}/deliveries/getreportsummary/?tenantid=${tenid}&fromdate=${startdate}&todate=${enddate}`
|
||||
);
|
||||
console.log('fetchOrdersSummary', response.data.details);
|
||||
logger.info('fetchOrdersSummary', response.data.details);
|
||||
|
||||
return response.data.details;
|
||||
};
|
||||
// ==============================|| getreportlocationsummary (orders summary)||============================== //
|
||||
export const getreportlocationsummary = async ({ queryKey }) => {
|
||||
console.log('queryKey for getreportlocationsummary', queryKey);
|
||||
logger.info('queryKey for getreportlocationsummary', queryKey);
|
||||
const [startdate, enddate, locationId, debouncedSearch] = queryKey;
|
||||
const response = await axios.get(
|
||||
`${process.env.REACT_APP_URL}/deliveries/getreportlocationsummary/?tenantid=${tenid}&locationid=${locationId}&fromdate=${startdate}&todate=${enddate}&keyword=${debouncedSearch}`
|
||||
);
|
||||
console.log('getreportlocationsummary', response.data.details);
|
||||
logger.info('getreportlocationsummary', response.data.details);
|
||||
|
||||
return response.data.details;
|
||||
};
|
||||
// ==============================|| getriderlocationreportsummary (orders summary)||============================== //
|
||||
export const getriderlocationreportsummary = async ({ queryKey }) => {
|
||||
console.log('queryKey for getriderlocationreportsummary', queryKey);
|
||||
logger.info('queryKey for getriderlocationreportsummary', queryKey);
|
||||
const [startdate, enddate, locationId] = queryKey;
|
||||
const response = await axios.get(
|
||||
`${process.env.REACT_APP_URL}/deliveries/getriderlocationreportsummary/?tenantid=${tenid}&locationid=${locationId}&fromdate=${startdate}&todate=${enddate}`
|
||||
);
|
||||
console.log('getriderlocationreportsummary', response.data.details);
|
||||
logger.info('getriderlocationreportsummary', response.data.details);
|
||||
|
||||
return response.data.details;
|
||||
};
|
||||
@@ -202,7 +203,7 @@ export const fetchLocations = async () => {
|
||||
...response.data.details,
|
||||
{ partnername: 'All', partnerid: -1 } // Add your new object here
|
||||
];
|
||||
console.log('fetchLocations', updatedLocations);
|
||||
logger.info('fetchLocations', updatedLocations);
|
||||
|
||||
return updatedLocations;
|
||||
};
|
||||
@@ -216,7 +217,7 @@ export const gettenantlocations = async ({ queryKey }) => {
|
||||
} catch (error) {
|
||||
// Must return an array — downstream consumers do `.map`/`.length` and a
|
||||
// string here crashes the entire Locations page.
|
||||
console.error('Error fetching tenant locations:', error);
|
||||
logger.error('Error fetching tenant locations:', error);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
@@ -227,7 +228,7 @@ export const fetchDeliverySummary = async ({ queryKey }) => {
|
||||
const response = await axios.get(
|
||||
`${process.env.REACT_APP_URL}/deliveries/deliverysummary?tenantid=${tenid}&locationid=${locationId}&fromdate=${startdate}&todate=${enddate}`
|
||||
);
|
||||
console.log('fetchDeliverySummary', response.data.details);
|
||||
logger.info('fetchDeliverySummary', response.data.details);
|
||||
return response.data.details;
|
||||
};
|
||||
// ==============================|| fetchAppLocations (report summary))||============================== //
|
||||
@@ -238,7 +239,7 @@ export const fetchAppLocations = async () => {
|
||||
...response.data.details,
|
||||
{ partnername: 'All', applocationid: -1 } // Add your new object here
|
||||
];
|
||||
console.log('fetchAppLocations', updatedLocations);
|
||||
logger.info('fetchAppLocations', updatedLocations);
|
||||
|
||||
return updatedLocations;
|
||||
};
|
||||
@@ -246,12 +247,12 @@ export const fetchAppLocations = async () => {
|
||||
// ==============================|| fetchRidersSummary (riders summary)||============================== //
|
||||
|
||||
export const fetchRidersSummary = async ({ queryKey }) => {
|
||||
console.log('queryKey for fetchRidersSummary', queryKey);
|
||||
logger.info('queryKey for fetchRidersSummary', queryKey);
|
||||
const [tenantid, startdate, enddate] = queryKey;
|
||||
const response = await axios.get(
|
||||
`${process.env.REACT_APP_URL}/deliveries/getridersummary/?tenantid=${tenantid}&fromdate=${startdate}&todate=${enddate}`
|
||||
);
|
||||
console.log('fetchRidersSummary', response.data.details);
|
||||
logger.info('fetchRidersSummary', response.data.details);
|
||||
|
||||
return response.data.details;
|
||||
};
|
||||
@@ -281,19 +282,19 @@ export const fetchorderdetails = async ({ pageParam = 0, queryKey }) => {
|
||||
};
|
||||
|
||||
// export const fetchorderdetails = async ({ queryKey }) => {
|
||||
// console.log('queryKey of fetchorderdetails', queryKey);
|
||||
// logger.info('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);
|
||||
// logger.info('fetchorderdetails', response.data.details);
|
||||
// return response.data.details;
|
||||
// };
|
||||
// ==============================|| fetchCount (orders detail)||============================== //
|
||||
export const fetchCount = async ({ queryKey }) => {
|
||||
console.log('queryKey of fetchCount', queryKey);
|
||||
logger.info('queryKey of fetchCount', queryKey);
|
||||
const [startdate, enddate] = queryKey;
|
||||
const response = await axios.get(`${process.env.REACT_APP_URL}/orders/getorders/?fromdate=${startdate}&todate=${enddate}`);
|
||||
const calculateOrderCounts = () => {
|
||||
@@ -314,7 +315,7 @@ export const fetchCount = async ({ queryKey }) => {
|
||||
|
||||
return { deliveredCount, pendingCount, cancelledCount };
|
||||
};
|
||||
console.log('fetchCount', calculateOrderCounts());
|
||||
logger.info('fetchCount', calculateOrderCounts());
|
||||
|
||||
return calculateOrderCounts();
|
||||
};
|
||||
@@ -333,7 +334,7 @@ export const fetchRidersLogs = async ({ queryKey }) => {
|
||||
startdate || ''
|
||||
}&keyword=${riderSearch || ''}`
|
||||
);
|
||||
console.log('fetchRidersLogs', riderLogsResponse.data.details);
|
||||
logger.info('fetchRidersLogs', riderLogsResponse.data.details);
|
||||
return riderLogsResponse.data.details;
|
||||
};
|
||||
|
||||
@@ -475,7 +476,7 @@ export const getallriders = async () => {
|
||||
const res = await axios.get(`${process.env.REACT_APP_URL}/partners/getallriders?partnerid=64`);
|
||||
return res.data.details;
|
||||
} catch (err) {
|
||||
console.log('getallriders', err.message);
|
||||
logger.error('getallriders', err.message);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user