refactor: handle young worker 18
This commit is contained in:
parent
f54ca1bd68
commit
c6c0b6e78e
3 changed files with 33 additions and 7 deletions
|
|
@ -708,7 +708,7 @@ watch(
|
|||
let currentFormDate = toISOStringWithTimezone(new Date(v));
|
||||
let currentDate: string = '';
|
||||
|
||||
if (isEdit) {
|
||||
if (isEdit && employeeFormState.value.currentEmployee) {
|
||||
currentDate = toISOStringWithTimezone(
|
||||
new Date(employeeFormState.value.currentEmployee.dateOfBirth),
|
||||
);
|
||||
|
|
@ -726,10 +726,10 @@ watch(
|
|||
dialog({
|
||||
color: 'warning',
|
||||
icon: 'mdi-alert',
|
||||
title: t('dialog.title.youngWorker'),
|
||||
title: t('dialog.title.youngWorker15'),
|
||||
cancelText: t('general.edit'),
|
||||
persistent: true,
|
||||
message: t('dialog.message.youngWorker'),
|
||||
message: t('dialog.message.youngWorker15'),
|
||||
|
||||
cancel: async () => {
|
||||
currentFromDataEmployee.value.dateOfBirth = null;
|
||||
|
|
@ -737,6 +737,27 @@ watch(
|
|||
},
|
||||
});
|
||||
}
|
||||
|
||||
if (
|
||||
currentFromDataEmployee.value.dateOfBirth &&
|
||||
Number(age) > 15 &&
|
||||
Number(age) <= 18
|
||||
) {
|
||||
dialog({
|
||||
color: 'warning',
|
||||
icon: 'mdi-alert',
|
||||
title: t('dialog.title.youngWorker18'),
|
||||
cancelText: t('general.cancel'),
|
||||
actionText: t('general.confirm'),
|
||||
persistent: true,
|
||||
message: t('dialog.message.youngWorker18'),
|
||||
action: () => {},
|
||||
cancel: async () => {
|
||||
currentFromDataEmployee.value.dateOfBirth = null;
|
||||
return;
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue