improvement: time period dropdown added to appropriate dashboard charts.
This commit is contained in:
@@ -1,15 +1,33 @@
|
||||
import { apiClient } from './client';
|
||||
import type { TodaySummaryResponse } from '@/types/today';
|
||||
import type { TodayChartPeriods } from '@/components/today/chart-periods';
|
||||
|
||||
export interface TodaySummaryParams {
|
||||
from: string;
|
||||
to: string;
|
||||
utcOffsetMinutes?: number;
|
||||
chartPeriods?: TodayChartPeriods;
|
||||
}
|
||||
|
||||
function chartPeriodQuery(periods?: TodayChartPeriods) {
|
||||
if (!periods) return {};
|
||||
return {
|
||||
appointmentsWeekPeriod: periods.appointmentsWeekAll,
|
||||
appointmentsWeekMinePeriod: periods.appointmentsWeekMine,
|
||||
labTaskActivityPeriod: periods.labTaskActivity,
|
||||
casesDuePeriod: periods.casesDue,
|
||||
treatmentMixPeriod: periods.treatmentMix,
|
||||
casePartnersPeriod: periods.casePartners,
|
||||
efficiencyPeriod: periods.efficiency,
|
||||
};
|
||||
}
|
||||
|
||||
export const todayApi = {
|
||||
summary: async (params: TodaySummaryParams): Promise<TodaySummaryResponse> => {
|
||||
const response = await apiClient.get('/today/summary', { params });
|
||||
const { chartPeriods, ...range } = params;
|
||||
const response = await apiClient.get('/today/summary', {
|
||||
params: { ...range, ...chartPeriodQuery(chartPeriods) },
|
||||
});
|
||||
return response.data;
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user