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:
hamed
2026-06-15 00:00:16 +03:30
co-authored by Claude Opus 4.8
parent bef36f86ca
commit 1599098b6d
2 changed files with 50 additions and 3 deletions
+15
View File
@@ -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: [],
};
}