feat(i18n): fixed some translation variables

This commit is contained in:
Matthieu Haineault 2025-09-09 09:02:45 -04:00
parent 7bc9b45ef0
commit 757013bd8e
5 changed files with 27 additions and 17 deletions

View File

@ -32,12 +32,12 @@
expenses_dataset.value = [ expenses_dataset.value = [
{ {
label: t('timeSheet.refund'), label: t('timesheet.refund'),
data: all_costs, data: all_costs,
backgroundColor: getComputedStyle(document.body).getPropertyValue('--q-primary').trim(), backgroundColor: getComputedStyle(document.body).getPropertyValue('--q-primary').trim(),
}, },
{ {
label: t('timeSheet.mileage'), label: t('timesheet.mileage'),
data: all_mileage, data: all_mileage,
backgroundColor: getComputedStyle(document.body).getPropertyValue('--q-info').trim(), backgroundColor: getComputedStyle(document.body).getPropertyValue('--q-info').trim(),
} }

View File

@ -40,16 +40,16 @@ import { colors } from 'quasar';
const shift_type_legend: shiftColor[] = [ const shift_type_legend: shiftColor[] = [
{ {
type: t('timeSheet.shiftRegular'), type: t('timesheet.shift_types.REGULAR'),
color: 'secondary', color: 'secondary',
text_color: 'grey-8', text_color: 'grey-8',
}, },
{ {
type: t('timeSheet.shiftEvening'), type: t('timesheet.shift_types.EVENING'),
color: 'warning', color: 'warning',
}, },
{ {
type: t('timeSheet.shiftEmergency'), type: t('timesheet.shift_types.EMERGENCY'),
color: 'amber-10', color: 'amber-10',
}, },
{ {
@ -57,15 +57,15 @@ import { colors } from 'quasar';
color: 'negative', color: 'negative',
}, },
{ {
type: t('timeSheet.shiftVacation'), type: t('timesheet.shift_types.VACATION'),
color: 'purple-10', color: 'purple-10',
}, },
{ {
type: t('timeSheet.shiftHoliday'), type: t('timesheet.shift_types.HOLIDAY'),
color: 'purple-8', color: 'purple-8',
}, },
{ {
type: t('timeSheet.shiftSick'), type: t('timesheet.shift_types.SICK'),
color: 'grey-8', color: 'grey-8',
}, },
] ]

View File

@ -48,7 +48,7 @@
class="text-grey-8 text-uppercase q-mx-md" class="text-grey-8 text-uppercase q-mx-md"
:class="$q.screen.lt.md ? 'text-weight-medium text-caption' : 'text-weight-bold'" :class="$q.screen.lt.md ? 'text-weight-medium text-caption' : 'text-weight-bold'"
> >
{{ $t('timeSheet.dateRangesTo') }} {{ $t('timesheet.dateRangesTo') }}
</div> </div>
<div <div
class="text-primary text-uppercase text-center text-weight-bold" class="text-primary text-uppercase text-center text-weight-bold"

View File

@ -5,7 +5,7 @@ import { useI18n } from 'vue-i18n';
import { useTimesheetStore } from 'src/stores/timesheet-store'; import { useTimesheetStore } from 'src/stores/timesheet-store';
import TimesheetShiftComment from '../shift/timesheet-shift-comment.vue'; import TimesheetShiftComment from '../shift/timesheet-shift-comment.vue';
import TimesheetSavePayload from './timesheet-save-payload.vue'; import TimesheetSavePayload from './timesheet-save-payload.vue';
import type { Shift } from '../../types/timesheet-shift-interface'; import { Shift } from '../../types/timesheet-shift-interface';
import type { CreateShiftPayload } from '../../types/timesheet-shift-interface'; import type { CreateShiftPayload } from '../../types/timesheet-shift-interface';
const timesheet_store = useTimesheetStore(); const timesheet_store = useTimesheetStore();
@ -23,7 +23,7 @@ const shift_options = computed(()=> {
return SHIFT_KEY.map(key => ({ value: key, label: t(`timesheet.shift_types.${key}`)})) return SHIFT_KEY.map(key => ({ value: key, label: t(`timesheet.shift_types.${key}`)}))
}); });
const empty_row = { type: '', start_time: '', end_time: '', comment: '', is_approved: false, is_remote: false }; const empty_row = { date:'', type: '', start_time: '', end_time: '', comment: '', is_approved: false, is_remote: false };
//Week dates //Week dates
const week_dates = computed(() => { const week_dates = computed(() => {
const start_date = timesheet_store.current_timesheet.start_day; const start_date = timesheet_store.current_timesheet.start_day;
@ -53,6 +53,7 @@ const rows = ref<Shift[]>(
const date_ISO = week_dates.value[index]; const date_ISO = week_dates.value[index];
const shift = timesheet_store.current_timesheet.shifts.find(sh => sh.date === date_ISO); const shift = timesheet_store.current_timesheet.shifts.find(sh => sh.date === date_ISO);
return shift ? { return shift ? {
date:shift.date || '',
type: shift.bank_type || '', type: shift.bank_type || '',
start_time: shift.start_time || '', start_time: shift.start_time || '',
end_time: shift.end_time || '', end_time: shift.end_time || '',
@ -88,6 +89,7 @@ const clearRow = (index: number) => {
const emit = defineEmits<{ (e: 'save', payload: CreateShiftPayload[]): void }>(); const emit = defineEmits<{ (e: 'save', payload: CreateShiftPayload[]): void }>();
//onMounted?
watch( watch(
() => [timesheet_store.current_timesheet.start_day, timesheet_store.current_timesheet.shifts], () => [timesheet_store.current_timesheet.start_day, timesheet_store.current_timesheet.shifts],
() => { () => {
@ -95,14 +97,16 @@ watch(
rows.value = days.value.map((_, idx)=> { rows.value = days.value.map((_, idx)=> {
const shift = timesheet_store.current_timesheet.shifts.find(sh => sh.date === dates[idx]); const shift = timesheet_store.current_timesheet.shifts.find(sh => sh.date === dates[idx]);
return shift return shift
? { type: shift.bank_type || '', ? { date: shift.date || '',
type: shift.bank_type || '',
start_time: shift.start_time || '', start_time: shift.start_time || '',
end_time: shift.end_time || '', end_time: shift.end_time || '',
comment: shift.description || '', comment: shift.description || '',
is_approved: shift.is_approved, is_approved: shift.is_approved,
is_remote: shift.is_remote, is_remote: shift.is_remote,
} }
: { type: '', : { date: '',
type: '',
start_time: '', start_time: '',
end_time: '', end_time: '',
comment: '', comment: '',
@ -132,10 +136,16 @@ watch(
/> />
</q-dialog> </q-dialog>
<q-form id="timesheet_shifts" autofocus class="bg-white q-pa-sm q-pt-lg rounded-10"> <q-form
autofocus
class="bg-white q-pa-sm q-pt-lg rounded-10">
<div v-for="(row, index) in rows" :key="week_dates[index] ?? index" class="q-gutter-sm q-mb-sm" :class="$q.screen.lt.md ? 'column' : 'row'" > <div
<!--Week days--> v-for="(row, index) in rows"
:key="week_dates[index] ?? index"
class="q-gutter-sm q-mb-sm"
:class="$q.screen.lt.md ? 'column' : 'row'" >
<!--Week days-->
<span class="text-weight-bold text-primary col-1">{{ days[index] }}</span> <span class="text-weight-bold text-primary col-1">{{ days[index] }}</span>
<!-- remote work toggle --> <!-- remote work toggle -->
<q-toggle <q-toggle

View File

@ -16,7 +16,7 @@ export interface TimesheetDetailsDailySchedule {
break_duration?: number; break_duration?: number;
} }
interface Expense { export interface Expense {
is_approved: boolean; is_approved: boolean;
amount: number; amount: number;
}; };