This commit is contained in:
@@ -8,7 +8,6 @@ import type {
|
|||||||
DeliveryPerson,
|
DeliveryPerson,
|
||||||
DeliveryPersonsStats,
|
DeliveryPersonsStats,
|
||||||
Alert,
|
Alert,
|
||||||
MonthlyStats,
|
|
||||||
} from "./types";
|
} from "./types";
|
||||||
|
|
||||||
const V2 = `${API_BASE_URL}/api/v2`;
|
const V2 = `${API_BASE_URL}/api/v2`;
|
||||||
@@ -165,7 +164,38 @@ export const resetAdminStats = async (
|
|||||||
);
|
);
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
// ============================================
|
||||||
|
// STATISTIQUES MENSUELLES (jour par jour)
|
||||||
|
// ============================================
|
||||||
|
export interface MonthlyDayStat {
|
||||||
|
day: string; // "2026-06-05"
|
||||||
|
label: string; // "05/06"
|
||||||
|
count: number;
|
||||||
|
revenue: number;
|
||||||
|
quantity: number;
|
||||||
|
}
|
||||||
|
export interface MonthlyStatsSummary {
|
||||||
|
total_orders: number;
|
||||||
|
total_revenue: number;
|
||||||
|
total_quantity: number;
|
||||||
|
}
|
||||||
|
export interface MonthlyStats {
|
||||||
|
month: string; // "2026-06"
|
||||||
|
summary: MonthlyStatsSummary;
|
||||||
|
by_day: MonthlyDayStat[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getAdminStatsByMonth = async (
|
||||||
|
month?: string,
|
||||||
|
): Promise<MonthlyStats> => {
|
||||||
|
const { data } = await apiClient.get(
|
||||||
|
`${V2}/admin/protected/stats/monthly`,
|
||||||
|
{
|
||||||
|
params: month ? { month } : undefined,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
return data;
|
||||||
|
};
|
||||||
export const getAllClients = async (): Promise<ClientResponse[]> => {
|
export const getAllClients = async (): Promise<ClientResponse[]> => {
|
||||||
const { data } = await apiClient.get(`${V2}/admin/protected/all/clients`);
|
const { data } = await apiClient.get(`${V2}/admin/protected/all/clients`);
|
||||||
return data.clients || [];
|
return data.clients || [];
|
||||||
@@ -1252,15 +1282,3 @@ export const updateSettings = async (
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getAdminStatsByMonth = async (
|
|
||||||
month?: string,
|
|
||||||
): Promise<MonthlyStats> => {
|
|
||||||
const { data } = await apiClient.get(
|
|
||||||
`${V2}/admin/protected/stats/monthly`,
|
|
||||||
{
|
|
||||||
params: month ? { month } : undefined,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
return data;
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -174,21 +174,3 @@ export interface MapLinks {
|
|||||||
apple_maps: string;
|
apple_maps: string;
|
||||||
openstreetmap: string;
|
openstreetmap: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MonthlyDayStat {
|
|
||||||
day: string; // "2026-06-05"
|
|
||||||
label: string; // "05/06"
|
|
||||||
count: number;
|
|
||||||
revenue: number;
|
|
||||||
quantity: number;
|
|
||||||
}
|
|
||||||
export interface MonthlyStatsSummary {
|
|
||||||
total_orders: number;
|
|
||||||
total_revenue: number;
|
|
||||||
total_quantity: number;
|
|
||||||
}
|
|
||||||
export interface MonthlyStats {
|
|
||||||
month: string; // "2026-06"
|
|
||||||
summary: MonthlyStatsSummary;
|
|
||||||
by_day: MonthlyDayStat[];
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user