From cadaecdaf8f649ae20a4fcff8f543dbee83fd0bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9?= Date: Sat, 16 May 2026 11:02:10 +0300 Subject: [PATCH] =?UTF-8?q?feat(dashboard):=20DashboardView=20=D0=BD=D0=B0?= =?UTF-8?q?=20real=20API=20/api/dashboard/summary=20(audit=20C1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.7 (1M context) --- app/resources/js/api/dashboard.ts | 26 +++++ app/resources/js/views/DashboardView.vue | 139 +++++++++++++++-------- app/tests/Frontend/DashboardView.spec.ts | 90 +++++++++------ 3 files changed, 176 insertions(+), 79 deletions(-) create mode 100644 app/resources/js/api/dashboard.ts diff --git a/app/resources/js/api/dashboard.ts b/app/resources/js/api/dashboard.ts new file mode 100644 index 00000000..20fd89f6 --- /dev/null +++ b/app/resources/js/api/dashboard.ts @@ -0,0 +1,26 @@ +import { apiClient } from './client'; + +/** + * API-клиент дашборда (audit C1/J3). Эндпоинт GET /api/dashboard/summary. + * На MVP без auth — tenant_id параметром (на prod возьмётся из middleware). + */ + +export type DeltaDir = 'up' | 'down' | 'neutral'; +export type DashboardRange = 'today' | '7d' | '30d'; + +export interface DashboardSummary { + range: string; + leads_received: { value: number; delta_pct: number; delta_dir: DeltaDir }; + conversion: { value: number; delta_pp: number; delta_dir: DeltaDir }; + active_projects: { active: number; limit: number }; + balance: { amount_rub: string; runway_days: number; runway_leads: number }; + activity: { points: number[]; labels: string[]; max: number }; + funnel: Record; +} + +export async function getDashboardSummary(tenantId: number, range: DashboardRange): Promise { + const { data } = await apiClient.get('/api/dashboard/summary', { + params: { tenant_id: tenantId, range }, + }); + return data; +} diff --git a/app/resources/js/views/DashboardView.vue b/app/resources/js/views/DashboardView.vue index 349b2d9c..b7123ec6 100644 --- a/app/resources/js/views/DashboardView.vue +++ b/app/resources/js/views/DashboardView.vue @@ -1,60 +1,94 @@