diff --git a/src/i18n/en-ca/index.ts b/src/i18n/en-ca/index.ts index e7514ce..f256e88 100644 --- a/src/i18n/en-ca/index.ts +++ b/src/i18n/en-ca/index.ts @@ -224,6 +224,7 @@ export default { error: { no_data_found: "no data found", no_search_results: "no results matching search", + generic_error: "An error occured", }, label: { search: "search", @@ -284,6 +285,7 @@ export default { apply_preset: "auto-fill", apply_preset_day: "Apply schedule to day", apply_preset_week: "Apply schedule to week", + save_successful: "timesheets saved", nav_button: { calendar_date_picker: "Calendar", current_week: "This week", @@ -359,6 +361,7 @@ export default { SHIFT_TYPE_REQUIRED: "Shift type required", TIMESHEET_NOT_FOUND: "No timesheet found with provided data", UPDATE_ERROR: "Error while updating data", + ERROR_SAVING_SHIFTS: "Timesheet changes were not saved", }, }, diff --git a/src/i18n/fr-ca/index.ts b/src/i18n/fr-ca/index.ts index 13c402c..8ab3e7c 100644 --- a/src/i18n/fr-ca/index.ts +++ b/src/i18n/fr-ca/index.ts @@ -224,6 +224,7 @@ export default { error: { no_data_found: 'aucune donnée à afficher', no_search_results: 'aucun résultat ne correspond à la recherche', + generic_error: "Une erreur est survenue", }, label: { search: 'recherche', @@ -284,6 +285,7 @@ export default { apply_preset: "auto-remplir", apply_preset_day: "Appliquer horaire pour la journée", apply_preset_week: "Appliquer horaire pour la semaine", + save_successful: "feuilles de temps enregistrées", nav_button: { calendar_date_picker: "Calendrier", current_week: "Semaine actuelle", @@ -359,6 +361,7 @@ export default { SHIFT_TYPE_REQUIRED: "Type requis", TIMESHEET_NOT_FOUND: "Aucune feuille de temps ne correspond au détails fournis", UPDATE_ERROR: "Une erreur est survenu lors de la mise à jour", + ERROR_SAVING_SHIFTS: "les changements aux feuilles de temps n'ont pas été enregistrés", }, }, 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'), + } + ]);