From 55b6305a5e642e9a3a6b2b822ef49fe7cceb97d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Z=C3=BCrcher?= Date: Fri, 13 Feb 2026 12:28:26 +0100 Subject: [PATCH] fix translation switching close #47 close #46 --- src/components/ReportStat.vue | 4 ++-- src/pages/ReportPage.vue | 17 +++++++++++------ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/components/ReportStat.vue b/src/components/ReportStat.vue index fb50d7f..1a99c68 100644 --- a/src/components/ReportStat.vue +++ b/src/components/ReportStat.vue @@ -6,7 +6,7 @@ - {{ opt.name }} + {{ $t(opt.name) }} @@ -46,7 +46,7 @@ import type { PropType } from 'vue'; const props = defineProps({ amounts: { - type: Object as PropType, + type: Array as PropType, required: true, }, }); diff --git a/src/pages/ReportPage.vue b/src/pages/ReportPage.vue index 7e78add..0b8a4da 100644 --- a/src/pages/ReportPage.vue +++ b/src/pages/ReportPage.vue @@ -16,7 +16,7 @@ :label="$t('selectDates')" @show="loadSettings" > - +
(''); const group = ref([]); @@ -148,6 +149,7 @@ const dropdownRef = ref(); const loading = ref(false); const amounts = ref([]); const reportExportRef = ref(null); +const weekdays = ref([0, 3]); const columns = computed(() => [ { @@ -186,10 +188,13 @@ onMounted(() => { }); function loadSettings() { - const settings = getLocalPageDefaults('report'); + const settings = getLocalPageDefaults('report') as PageDefault; if (!settings) return; - if (settings.filteredValues.length > 0) { - group.value = JSON.parse(settings?.filteredValues[0] || '') as Groups; + if (settings.groups) { + group.value = settings.groups; + } + if (settings.weekdays) { + weekdays.value = settings.weekdays; } } function applyDateChoice() { @@ -214,7 +219,7 @@ function applyDateChoice() { } payload.date = allDates.value; - setLocalPageDefaults('report', filter.value || '', [JSON.stringify(group.value || '')]); + setLocalPageDefaults('report', { groups: group.value, weekdays: weekdays.value }); appApi .post('report', payload) @@ -248,7 +253,7 @@ function applyDateChoice() { .filter((day) => data.data[day]) // Only include days that exist in the response .map((day) => ({ ...data.data[day], - name: i18n.global.t(day), // Dynamically translate the name + name: day, // Dynamically translate the name })); if (amounts.value.length == 2) { amounts.value.splice(1);