updates on the orders page about four kpis

This commit is contained in:
2026-06-23 18:23:48 +05:30
parent e184cd2d3b
commit 055975d702
2 changed files with 9 additions and 4 deletions

View File

@@ -27,8 +27,11 @@ export const fetchAppLocations = async () => {
// ==============================|| fetchPercentageData (orders) ||============================== //
export const fetchPercentageData = async (appId) => {
const response = await axios.get(`${process.env.REACT_APP_URL}/orders/getordersummary/?applocationid=${appId}`);
export const fetchPercentageData = async ({ queryKey }) => {
const [, appId, startdate, enddate, tenantid, locationid] = queryKey;
const response = await axios.get(
`${process.env.REACT_APP_URL}/orders/getordersummary/?applocationid=${appId}&tenantid=${tenantid}&locationid=${locationid}&fromdate=${startdate}&todate=${enddate}`
);
const details = response.data.details;
return {
@@ -42,6 +45,7 @@ export const fetchPercentageData = async (appId) => {
percentage4: (Math.round((details.cancelled / details.total) * 100) || 0).toString()
};
};
// ===================================================== || getTenants || =====================================================
export const getTenants = async (appId) => {

View File

@@ -369,11 +369,12 @@ const Orders = () => {
error: fetchpercentageError,
refetch: percentagedataRefetch
} = useQuery({
queryKey: ['percentageData', appId],
queryFn: () => fetchPercentageData(appId), // Ensure appId is passed
queryKey: ['percentageData', appId, startdate, enddate, tenantid, locationid],
queryFn: fetchPercentageData,
enabled: true
});
// ==============================|| getTenants ||============================== //
const {