feat(panel): connect dashboard page to representation monthly stats
تبدیل صفحه dashboard پنل به Server Component که آمار ماهانه نماینده را از API میگیرد (year/month میلادی جاری) و با adaptRepresentationDashboard به propهای کامپوننت map میکند. حذف داده mock. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -696,3 +696,18 @@ export function adaptRepresentationInfo(representationInfo) {
|
||||
chart_amount_income: [],
|
||||
};
|
||||
}
|
||||
|
||||
export function adaptRepresentationDashboard(dashboard) {
|
||||
const stats = dashboard?.data?.stats ?? dashboard?.stats ?? {};
|
||||
const daily = Array.isArray(stats.daily) ? stats.daily : [];
|
||||
|
||||
return {
|
||||
number_of_patients: stats.total_appointments ?? 0,
|
||||
today_turns: daily.length ? daily[daily.length - 1].appointments ?? 0 : 0,
|
||||
payments: stats.total_revenue_rials ?? 0,
|
||||
commission_rials: stats.commission_rials ?? 0,
|
||||
chart_amount_income: daily.map((d) => d.revenue ?? 0),
|
||||
list_of_doctors_appointments: [],
|
||||
todays_activities: [],
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user