From 4943baa236c65a2bde1f3a0fddca562ef8b7dc20 Mon Sep 17 00:00:00 2001 From: Gregor Vostrak Date: Fri, 31 May 2024 02:18:19 +0200 Subject: [PATCH] add reporting client aggregation --- .../Common/Reporting/ReportingGroupBySelect.vue | 11 ++++++++++- resources/js/utils/useReporting.ts | 7 +++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/resources/js/Components/Common/Reporting/ReportingGroupBySelect.vue b/resources/js/Components/Common/Reporting/ReportingGroupBySelect.vue index e4cc576a..73a48eaa 100644 --- a/resources/js/Components/Common/Reporting/ReportingGroupBySelect.vue +++ b/resources/js/Components/Common/Reporting/ReportingGroupBySelect.vue @@ -3,7 +3,11 @@ import { FolderIcon } from '@heroicons/vue/16/solid'; import SelectDropdown from '@/Components/Common/SelectDropdown.vue'; import Badge from '@/Components/Common/Badge.vue'; import { computed } from 'vue'; -import { CheckCircleIcon, UserGroupIcon } from '@heroicons/vue/20/solid'; +import { + CheckCircleIcon, + UserCircleIcon, + UserGroupIcon, +} from '@heroicons/vue/20/solid'; import BillableIcon from '@/Components/Common/Icons/BillableIcon.vue'; const groupByOptions = [ @@ -22,6 +26,11 @@ const groupByOptions = [ value: 'task', icon: CheckCircleIcon, }, + { + label: 'Clients', + value: 'client', + icon: UserCircleIcon, + }, { label: 'Billable', value: 'billable', diff --git a/resources/js/utils/useReporting.ts b/resources/js/utils/useReporting.ts index 854d7a37..5b7ac402 100644 --- a/resources/js/utils/useReporting.ts +++ b/resources/js/utils/useReporting.ts @@ -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(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';