From 1271d1eb6195c86e5ad808ad87a833ba3c1a2643 Mon Sep 17 00:00:00 2001 From: Nic D Date: Tue, 10 Mar 2026 15:52:40 -0400 Subject: [PATCH] fix(timesheet): fix issue with expense not updating properly in approval module Also rework expense item appearance in list to better divide space between components for visual clarity. --- quasar.config.ts | 7 +- .../components/details-dialog.vue | 40 +- .../components/overview-report.vue | 2 +- .../components/expense-dialog-form.vue | 479 +++++++++--------- .../components/expense-dialog-list-item.vue | 175 +++---- .../components/expense-dialog-list.vue | 8 +- .../timesheets/components/expense-dialog.vue | 15 +- .../timesheets/composables/use-expense-api.ts | 29 +- src/stores/expense-store.ts | 4 +- src/stores/timesheet-store.ts | 9 +- src/utils/date-and-time-utils.ts | 20 +- 11 files changed, 411 insertions(+), 377 deletions(-) diff --git a/quasar.config.ts b/quasar.config.ts index 205b2f3..7a69943 100644 --- a/quasar.config.ts +++ b/quasar.config.ts @@ -66,10 +66,13 @@ export default defineConfig((ctx) => { // polyfillModulePreload: true, // distDir - extendViteConf: (_config) => ({ + extendViteConf: (config) => ({ optimizeDeps: { exclude: ['tesseract.js'] - } + }, + define: { + __VUE_PROD_DEVTOOLS__: config.mode !== 'production' + }, }), // viteVuePluginOptions: {}, diff --git a/src/modules/timesheet-approval/components/details-dialog.vue b/src/modules/timesheet-approval/components/details-dialog.vue index 0c3f08a..93136b7 100644 --- a/src/modules/timesheet-approval/components/details-dialog.vue +++ b/src/modules/timesheet-approval/components/details-dialog.vue @@ -2,20 +2,21 @@ setup lang="ts" > - import { useI18n } from 'vue-i18n'; - import { computed, ref } from 'vue'; - import { useTimesheetStore } from 'src/stores/timesheet-store'; import DetailsDialogChartHoursWorked from 'src/modules/timesheet-approval/components/details-dialog-chart-hours-worked.vue'; import DetailsDialogChartShiftTypes from 'src/modules/timesheet-approval/components/details-dialog-chart-shift-types.vue'; import DetailsDialogChartExpenses from 'src/modules/timesheet-approval/components/details-dialog-chart-expenses.vue'; import TimesheetWrapper from 'src/modules/timesheets/components/timesheet-wrapper.vue'; import ExpenseDialogList from 'src/modules/timesheets/components/expense-dialog-list.vue'; import ExpenseDialogForm from 'src/modules/timesheets/components/expense-dialog-form.vue'; + + import { date } from 'quasar'; + import { useI18n } from 'vue-i18n'; + import { computed, ref } from 'vue'; + import { useTimesheetStore } from 'src/stores/timesheet-store'; import { useTimesheetApprovalApi } from '../composables/use-timesheet-approval-api'; import { useShiftApi } from 'src/modules/timesheets/composables/use-shift-api'; import { useExpensesStore } from 'src/stores/expense-store'; import { Expense } from 'src/modules/timesheets/models/expense.models'; - import { date } from 'quasar'; // ========== state ======================================== @@ -25,6 +26,7 @@ const timesheetApprovalApi = useTimesheetApprovalApi(); const shiftApi = useShiftApi(); const isDialogOpen = ref(false); + const refreshKey = ref(0); // ========== computed ======================================== @@ -34,9 +36,9 @@ t('shared.label.unlock') : t('shared.label.lock') ); - + const approveButtonIcon = computed(() => isApproved.value ? 'las la-lock' : 'las la-unlock'); - + const hasExpenses = computed(() => timesheetStore.timesheets.some(timesheet => Object.values(timesheet.weekly_expenses).some(hours => hours > 0)) ); @@ -60,13 +62,22 @@ expenseStore.is_showing_create_form = false; } - const onClickExpenseCreate = () => { + const onClickNewExpense = () => { expenseStore.mode = 'create'; if (timesheetStore.pay_period) expenseStore.current_expense = new Expense(timesheetStore.pay_period.period_start); else expenseStore.current_expense = new Expense(date.formatDate(new Date(), 'YYYY-MM-DD')); } + + const onClickSaveNewExpense = () => { + expenseStore.is_showing_create_form = false; + } + + const onShowDetailsDialog = () => { + isDialogOpen.value = true; + expenseStore.is_showing_create_form = false; + }