diff --git a/src/modules/timesheets/components/shift-list-day-row.vue b/src/modules/timesheets/components/shift-list-day-row.vue index 94ec03a..41613bb 100644 --- a/src/modules/timesheets/components/shift-list-day-row.vue +++ b/src/modules/timesheets/components/shift-list-day-row.vue @@ -15,7 +15,7 @@ const shift = defineModel('shift', { required: true }); const shift_type_selected = ref(SHIFT_OPTIONS.find(option => option.value == shift.value.type)); const select_ref = ref(null); - const error_message = ref(''); + const error_message = ref(); const { errorMessage = undefined, isTimesheetApproved = false, holiday = false } = defineProps<{ dense?: boolean; @@ -35,7 +35,7 @@ error_message.value = 'timesheet.errors.SHIFT_TIME_REQUIRED' } else { shift.value.has_error = false; - error_message.value = ''; + error_message.value = undefined; emit('onTimeFieldBlur'); } } @@ -61,9 +61,6 @@ shift_type_selected.value = undefined; ui_store.focus_next_component = false; } - - if (errorMessage) - error_message.value = errorMessage; }); @@ -191,7 +188,7 @@ no-error-icon hide-bottom-space :error="shift.has_error" - :error-message="errorMessage || error_message !== '' ? $t(errorMessage ?? error_message) : ''" + :error-message="errorMessage ? $t(errorMessage) : (error_message ? $t(error_message) : undefined)" :label-color="!shift.is_approved ? (holiday? 'purple-5' : 'accent') : 'white'" class="col rounded-5 bg-dark q-mx-xs" :class="(shift.id === -2 ? 'bg-negative ' : ' ') + (!shift.is_approved && !isTimesheetApproved ? '' : 'cursor-not-allowed inset-shadow')" @@ -222,7 +219,7 @@ no-error-icon hide-bottom-space :error="shift.has_error" - :error-message="errorMessage || error_message !== '' ? $t(errorMessage ?? error_message) : ''" + :error-message="errorMessage ? $t(errorMessage) : (error_message ? $t(error_message) : undefined)" :label-color="!shift.is_approved ? (holiday? 'purple-5' : 'accent') : 'white'" :input-class="'text-weight-medium ' + (shift.id === -2 ? 'text-white ' : ' ') + (shift.is_approved ? 'text-white cursor-not-allowed q-px-sm' : '')" input-style="font-size: 1.2em;" diff --git a/src/modules/timesheets/components/shift-list-day.vue b/src/modules/timesheets/components/shift-list-day.vue index 3dd2b8b..aff4025 100644 --- a/src/modules/timesheets/components/shift-list-day.vue +++ b/src/modules/timesheets/components/shift-list-day.vue @@ -37,9 +37,13 @@ if (shift.id <= 0) { shift.id = 0; emit('deleteUnsavedShift'); - return; + } else { + await shift_api.deleteShiftById(shift.id); + } + + if (day.shifts.length < 2 && shift_error_message.value !== undefined) { + onTimeFieldBlur(); } - await shift_api.deleteShiftById(shift.id); }; const onTimeFieldBlur = () => {