mirror of
https://github.com/complexcaresolutions/dak.c2s.git
synced 2026-03-17 16:03:41 +00:00
Extends DashboardKPIs with total_abgerechnet/pending_abrechnung. Adds new GET /reports/dashboard/top-gutachter endpoint (admin-only). Frontend shows Abrechnungsstatus donut + Gutachter-Verteilung progress bars in a new third row, visible only to admins. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
40 lines
1.4 KiB
TypeScript
40 lines
1.4 KiB
TypeScript
import { useQuery } from '@tanstack/react-query'
|
|
import api from '@/services/api'
|
|
import type { DashboardResponse, YearlyComparisonResponse, TopIcdResponse, TopGutachterResponse, GutachtenStatistikResponse } from '@/types'
|
|
|
|
export function useDashboard(jahr: number) {
|
|
return useQuery({
|
|
queryKey: ['dashboard', jahr],
|
|
queryFn: () => api.get<DashboardResponse>('/reports/dashboard', { params: { jahr } }).then(r => r.data),
|
|
})
|
|
}
|
|
|
|
export function useYearlyComparison() {
|
|
return useQuery({
|
|
queryKey: ['dashboard', 'yearly-comparison'],
|
|
queryFn: () => api.get<YearlyComparisonResponse>('/reports/dashboard/yearly-comparison').then(r => r.data),
|
|
staleTime: 60_000,
|
|
})
|
|
}
|
|
|
|
export function useTopIcd(jahr: number) {
|
|
return useQuery({
|
|
queryKey: ['dashboard', 'top-icd', jahr],
|
|
queryFn: () => api.get<TopIcdResponse>('/reports/dashboard/top-icd', { params: { jahr } }).then(r => r.data),
|
|
})
|
|
}
|
|
|
|
export function useTopGutachter(jahr: number, enabled = true) {
|
|
return useQuery({
|
|
queryKey: ['dashboard', 'top-gutachter', jahr],
|
|
queryFn: () => api.get<TopGutachterResponse>('/reports/dashboard/top-gutachter', { params: { jahr } }).then(r => r.data),
|
|
enabled,
|
|
})
|
|
}
|
|
|
|
export function useGutachtenStatistik(jahr: number) {
|
|
return useQuery({
|
|
queryKey: ['gutachten-statistik', jahr],
|
|
queryFn: () => api.get<GutachtenStatistikResponse>('/reports/gutachten-statistik', { params: { jahr } }).then(r => r.data),
|
|
})
|
|
}
|