From 82bf7d5282abda5bcc063335234db3c87c77e8ac Mon Sep 17 00:00:00 2001 From: Nicolas Drolet Date: Mon, 24 Nov 2025 09:01:49 -0500 Subject: [PATCH] fix(approvals): refactor to work with staging db which has partial user and employee info. --- .../components/employee-list-table-item.vue | 78 +++++++----- .../components/employee-list-table.vue | 116 ++++++++++-------- .../models/employee-profile.models.ts | 43 ++++++- .../services/employee-list-service.ts | 4 +- .../details-dialog-chart-expenses.vue | 31 +++-- .../details-dialog-chart-hours-worked.vue | 32 ++--- .../details-dialog-chart-shift-types.vue | 31 ++--- .../services/timesheet-approval-service.ts | 2 +- src/stores/employee-store.ts | 6 +- 9 files changed, 206 insertions(+), 137 deletions(-) diff --git a/src/modules/employee-list/components/employee-list-table-item.vue b/src/modules/employee-list/components/employee-list-table-item.vue index 745f69d..d7472d0 100644 --- a/src/modules/employee-list/components/employee-list-table-item.vue +++ b/src/modules/employee-list/components/employee-list-table-item.vue @@ -1,4 +1,7 @@ - \ No newline at end of file diff --git a/src/modules/employee-list/components/employee-list-table.vue b/src/modules/employee-list/components/employee-list-table.vue index 6f3cc09..c6b9390 100644 --- a/src/modules/employee-list/components/employee-list-table.vue +++ b/src/modules/employee-list/components/employee-list-table.vue @@ -1,31 +1,21 @@ - @@ -55,7 +55,6 @@ :options="({ indexAxis: $q.screen.lt.md ? 'y' : 'x', plugins: { - title: { display: true, text: t('timesheet_approvals.chart.expenses_title'), diff --git a/src/modules/timesheet-approval/components/details-dialog-chart-hours-worked.vue b/src/modules/timesheet-approval/components/details-dialog-chart-hours-worked.vue index 09d21aa..fa23900 100644 --- a/src/modules/timesheet-approval/components/details-dialog-chart-hours-worked.vue +++ b/src/modules/timesheet-approval/components/details-dialog-chart-hours-worked.vue @@ -2,11 +2,11 @@ setup lang="ts" > - import { ref, computed, onMounted } from 'vue'; + import { ref, onMounted } from 'vue'; import { useI18n } from 'vue-i18n'; import { colors, useQuasar } from 'quasar'; import { Bar } from 'vue-chartjs'; - import { Chart as ChartJS, Title, Tooltip, Legend, BarElement, CategoryScale, LinearScale, type ChartData, type ChartDataset } from 'chart.js'; + import { Chart as ChartJS, Title, Tooltip, Legend, BarElement, CategoryScale, LinearScale, TimeScale, type ChartDataset } from 'chart.js'; import { useTimesheetStore } from 'src/stores/timesheet-store'; import type { TotalHours } from 'src/modules/timesheets/models/timesheet.models'; @@ -19,14 +19,14 @@ const { t } = useI18n(); const $q = useQuasar(); - ChartJS.register(Title, Tooltip, Legend, BarElement, CategoryScale, LinearScale); + ChartJS.register(Title, Tooltip, Legend, BarElement, CategoryScale, LinearScale, TimeScale); ChartJS.defaults.font.family = '"Roboto", sans-serif'; - // ChartJS.defaults.maintainAspectRatio = false; + ChartJS.defaults.maintainAspectRatio = false; ChartJS.defaults.color = $q.dark.isActive ? '#F5F5F5' : '#616161'; const timesheet_store = useTimesheetStore(); - const all_days = computed(() => timesheet_store.timesheets.flatMap(week => week.days)); + const all_days = timesheet_store.timesheets.flatMap(week => week.days); const datasetConfig: ChartConfigHoursWorked[] = [ { @@ -42,36 +42,38 @@ { key: 'emergency', label: t('shared.shift_type.emergency'), - color: getComputedStyle(document.body).getPropertyValue('--q-warning').trim(), + color: colors.getPaletteColor('warning'), }, { key: 'overtime', label: t('shared.shift_type.overtime'), - color: getComputedStyle(document.body).getPropertyValue('--q-negative').trim(), + color: colors.getPaletteColor('negative'), }, ]; - const hours_worked_labels = ref(all_days.value.map(day => day.date.slice(-5,))); + const hours_worked_labels = ref(all_days.map(day => day.date.slice(-5,))); const hours_worked_dataset = ref[]>([]); onMounted(() => { - hours_worked_dataset.value = datasetConfig.map(cfg => ({ - label: cfg.label, - data: all_days.value.map(day => day.daily_hours[cfg.key]), - backgroundColor: cfg.color, - })); + setTimeout(() => { + hours_worked_dataset.value = datasetConfig.map(cfg => ({ + label: cfg.label, + data: all_days.map(day => day.daily_hours[cfg.key]), + backgroundColor: cfg.color, + })); + }, 100); });