From b0de761645064869df9df1001bc04eb250fd7ce5 Mon Sep 17 00:00:00 2001 From: "Nic D." <91558719+Venti-Bear@users.noreply.github.com> Date: Mon, 26 Jan 2026 12:16:52 -0500 Subject: [PATCH] fix(timesheet-approval): overview list now updates when closing details dialog. Graphs at top of details dialog now update dynamically if user makes changes to employee timesheet. --- .../details-dialog-chart-expenses.vue | 36 ++++++------- .../details-dialog-chart-hours-worked.vue | 32 +++++------- .../details-dialog-chart-shift-types.vue | 52 ++++++++++--------- .../components/details-dialog.vue | 1 + .../components/expense-dialog-form.vue | 2 - 5 files changed, 56 insertions(+), 67 deletions(-) diff --git a/src/modules/timesheet-approval/components/details-dialog-chart-expenses.vue b/src/modules/timesheet-approval/components/details-dialog-chart-expenses.vue index 2147d13..aac41f0 100644 --- a/src/modules/timesheet-approval/components/details-dialog-chart-expenses.vue +++ b/src/modules/timesheet-approval/components/details-dialog-chart-expenses.vue @@ -2,12 +2,12 @@ setup lang="ts" > - import { onMounted, ref } from 'vue'; + import { computed, ref } from 'vue'; import { Bar } from 'vue-chartjs'; import { useI18n } from 'vue-i18n'; import { useQuasar, colors } from 'quasar'; import { useTimesheetStore } from 'src/stores/timesheet-store'; - import { Chart as ChartJS, Title, Tooltip, Legend, BarElement, CategoryScale, LinearScale, TimeScale, type ChartDataset } from 'chart.js'; + import { Chart as ChartJS, Title, Tooltip, Legend, BarElement, CategoryScale, LinearScale, TimeScale } from 'chart.js'; const { t } = useI18n(); const $q = useQuasar(); @@ -19,27 +19,21 @@ const timesheet_store = useTimesheetStore(); - const all_days = timesheet_store.timesheets.flatMap(week => week.days.flatMap(day => day.daily_expenses)); + const all_days = computed(() => timesheet_store.timesheets.flatMap(week => week.days.flatMap(day => day.daily_expenses))); const expenses_labels = ref(timesheet_store.timesheets.flatMap(week => week.days.map(day => day.date.slice(-5,)))); - const expenses_dataset = ref[]>([]); - - onMounted(() => { - setTimeout(() => { - expenses_dataset.value = [ - { - label: t('timesheet_approvals.table.expenses'), - data: all_days.map(day => (day.expenses + day.on_call + day.per_diem)), - backgroundColor: colors.getPaletteColor('accent'), - }, - { - label: t('timesheet_approvals.table.mileage'), - data: all_days.map(day => day.mileage), - backgroundColor: colors.getPaletteColor('info'), - } - ] - }, 100) - }); + const expenses_dataset = computed(() => [ + { + label: t('timesheet_approvals.table.expenses'), + data: all_days.value.map(day => (day.expenses + day.on_call + day.per_diem)), + backgroundColor: colors.getPaletteColor('accent'), + }, + { + label: t('timesheet_approvals.table.mileage'), + data: all_days.value.map(day => day.mileage), + backgroundColor: colors.getPaletteColor('info'), + } + ]);