revenuechart dynamic

This commit is contained in:
hamid zarghami
2025-12-23 14:09:28 +03:30
parent 860502f160
commit 14bc394801
4 changed files with 257 additions and 136 deletions
@@ -1,5 +1,8 @@
import axios from "@/config/axios";
import type { IStatisticsResponse } from "../types/Types";
import type {
IStatisticsResponse,
IPaymentChartResponse,
} from "../types/Types";
export const getStatistics = async (): Promise<IStatisticsResponse> => {
const { data } = await axios.get<IStatisticsResponse>("/admin/orders/stats");
@@ -10,3 +13,19 @@ export const getFoodSalesPieChart = async () => {
const { data } = await axios.get("/admin/orders/food-sales-pie-chart");
return data;
};
interface GetPaymentsChartParams {
period?: "daily" | "monthly" | "yearly";
startDate?: string;
endDate?: string;
}
export const getPaymentsChart = async (
params?: GetPaymentsChartParams
): Promise<IPaymentChartResponse> => {
const { data } = await axios.get<IPaymentChartResponse>(
"/admin/payments/chart",
{ params }
);
return data;
};