fix translation switching close #47 close #46

This commit is contained in:
Adrian Zürcher
2026-02-13 12:28:26 +01:00
parent 0026f68320
commit 55b6305a5e
2 changed files with 13 additions and 8 deletions

View File

@@ -6,7 +6,7 @@
<q-item dense> <q-item dense>
<q-item-section> <q-item-section>
<q-item-label class="text-bold text-primary text-center"> <q-item-label class="text-bold text-primary text-center">
{{ opt.name }} {{ $t(opt.name) }}
</q-item-label> </q-item-label>
</q-item-section> </q-item-section>
</q-item> </q-item>
@@ -46,7 +46,7 @@ import type { PropType } from 'vue';
const props = defineProps({ const props = defineProps({
amounts: { amounts: {
type: Object as PropType<Amount[]>, type: Array as PropType<Amount[]>,
required: true, required: true,
}, },
}); });

View File

@@ -16,7 +16,7 @@
:label="$t('selectDates')" :label="$t('selectDates')"
@show="loadSettings" @show="loadSettings"
> >
<DateDaySelect @update:dates="updateReport" /> <DateDaySelect @update:dates="updateReport" v-model:weekdays="weekdays" />
<div class="column justify-end q-pa-md"> <div class="column justify-end q-pa-md">
<div class="row q-ma-md"> <div class="row q-ma-md">
<q-input <q-input
@@ -136,6 +136,7 @@ import ReportStat from 'src/components/ReportStat.vue';
import type { Group, Groups } from 'src/vueLib/models/group'; import type { Group, Groups } from 'src/vueLib/models/group';
import { getLocalPageDefaults, setLocalPageDefaults } from 'src/localstorage/localStorage'; import { getLocalPageDefaults, setLocalPageDefaults } from 'src/localstorage/localStorage';
import html2pdf from 'html2pdf.js'; import html2pdf from 'html2pdf.js';
import type { PageDefault } from 'src/vueLib/models/pagedefaults';
const filter = ref<string>(''); const filter = ref<string>('');
const group = ref<Group[]>([]); const group = ref<Group[]>([]);
@@ -148,6 +149,7 @@ const dropdownRef = ref();
const loading = ref(false); const loading = ref(false);
const amounts = ref<Amount[]>([]); const amounts = ref<Amount[]>([]);
const reportExportRef = ref<HTMLElement | null>(null); const reportExportRef = ref<HTMLElement | null>(null);
const weekdays = ref<number[]>([0, 3]);
const columns = computed(() => [ const columns = computed(() => [
{ {
@@ -186,10 +188,13 @@ onMounted(() => {
}); });
function loadSettings() { function loadSettings() {
const settings = getLocalPageDefaults('report'); const settings = getLocalPageDefaults('report') as PageDefault;
if (!settings) return; if (!settings) return;
if (settings.filteredValues.length > 0) { if (settings.groups) {
group.value = JSON.parse(settings?.filteredValues[0] || '') as Groups; group.value = settings.groups;
}
if (settings.weekdays) {
weekdays.value = settings.weekdays;
} }
} }
function applyDateChoice() { function applyDateChoice() {
@@ -214,7 +219,7 @@ function applyDateChoice() {
} }
payload.date = allDates.value; payload.date = allDates.value;
setLocalPageDefaults('report', filter.value || '', [JSON.stringify(group.value || '')]); setLocalPageDefaults('report', <PageDefault>{ groups: group.value, weekdays: weekdays.value });
appApi appApi
.post('report', payload) .post('report', payload)
@@ -248,7 +253,7 @@ function applyDateChoice() {
.filter((day) => data.data[day]) // Only include days that exist in the response .filter((day) => data.data[day]) // Only include days that exist in the response
.map((day) => ({ .map((day) => ({
...data.data[day], ...data.data[day],
name: i18n.global.t(day), // Dynamically translate the name name: day, // Dynamically translate the name
})); }));
if (amounts.value.length == 2) { if (amounts.value.length == 2) {
amounts.value.splice(1); amounts.value.splice(1);