add reporting client aggregation

This commit is contained in:
Gregor Vostrak
2024-05-31 02:18:19 +02:00
parent 4c977b5bf8
commit 4943baa236
2 changed files with 17 additions and 1 deletions

View File

@@ -11,6 +11,7 @@ import { useNotificationsStore } from '@/utils/notification';
import { useProjectsStore } from '@/utils/useProjects';
import { useMembersStore } from '@/utils/useMembers';
import { useTasksStore } from '@/utils/useTasks';
import { useClientsStore } from '@/utils/useClients';
export const useReportingStore = defineStore('reporting', () => {
const reportingGraphResponse = ref<ReportingResponse | null>(null);
@@ -75,6 +76,7 @@ export const useReportingStore = defineStore('reporting', () => {
project: 'No Project',
task: 'No Task',
billable: 'Non-Billable',
client: 'No Client',
};
return emptyPlaceholder[type as keyof typeof emptyPlaceholder];
@@ -95,6 +97,11 @@ export const useReportingStore = defineStore('reporting', () => {
const { tasks } = storeToRefs(taskStore);
return tasks.value.find((task) => task.id === key)?.name;
}
if (type === 'client') {
const clientsStore = useClientsStore();
const { clients } = storeToRefs(clientsStore);
return clients.value.find((client) => client.id === key)?.name;
}
if (type === 'billable') {
if (key === '0') {
return 'Non-Billable';