From ce00f5f446b80a7f4cab67042a01536b8b6df98a Mon Sep 17 00:00:00 2001 From: Gregor Vostrak Date: Wed, 22 May 2024 16:13:08 +0200 Subject: [PATCH] fix employee reporting request, fix billable update, fix start of week in reporting --- resources/js/Pages/Reporting.vue | 8 ++++++++ resources/js/utils/time.ts | 2 +- resources/js/utils/useUser.ts | 7 +++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/resources/js/Pages/Reporting.vue b/resources/js/Pages/Reporting.vue index 68df08fc..8ef777a3 100644 --- a/resources/js/Pages/Reporting.vue +++ b/resources/js/Pages/Reporting.vue @@ -27,6 +27,7 @@ import ReportingGroupBySelect from '@/Components/Common/Reporting/ReportingGroup import ReportingRow from '@/Components/Common/Reporting/ReportingRow.vue'; import { formatCents } from '@/utils/money'; import ReportingPieChart from '@/Components/Common/Reporting/ReportingPieChart.vue'; +import { getCurrentMembershipId, getCurrentRole } from '@/utils/useUser'; const startDate = ref( getDayJsInstance()().subtract(14, 'd').format('YYYY-MM-DD') @@ -87,6 +88,9 @@ function updateGraphReporting() { 'd' ); const params = getFilterAttributes(); + if (getCurrentRole() === 'employee') { + params.member_id = getCurrentMembershipId(); + } params.fill_gaps_in_time_groups = 'true'; params.group = getOptimalGroupingOption(diffInDays); useReportingStore().fetchGraphReporting(params); @@ -94,6 +98,9 @@ function updateGraphReporting() { function updateTableReporting() { const params = getFilterAttributes(); + if (getCurrentRole() === 'employee') { + params.member_id = getCurrentMembershipId(); + } params.group = group.value; params.sub_group = subGroup.value; useReportingStore().fetchTableReporting(params); @@ -185,6 +192,7 @@ onMounted(() => { team.id === getCurrentOrganizationId() + )?.membership.role; +} + function getUserTimezone() { return page.props.auth.user.timezone; } @@ -34,4 +40,5 @@ export { getUserTimezone, getWeekStart, getCurrentMembershipId, + getCurrentRole, };