refactor: แจ้งเตือนถ้าสร้างบุคลากรก่อนที่จะสร้างสาขา

This commit is contained in:
Net 2024-07-12 11:07:45 +07:00
parent f0fadfdc1b
commit 6b25dff32a

View file

@ -266,7 +266,30 @@ async function openDialog(
agencyFileList.value = result;
}
}
} else hqId.value = userStore.userOption.hqOpts[0].value;
} if(userStore.userOption.hqOpts.length !== 0) {
hqId.value = userStore.userOption.hqOpts[0].value;
}
if(userStore.userOption.hqOpts.length === 0) {
console.log('no hq');
dialog({
color: 'warning',
icon: 'mdi-alert',
title: t('warning'),
actionText: t('agree'),
persistent: true,
message: t('headquartersNotEstablished'),
action: async () => {
},
});
return
}
if (action === 'FORM') {
modal.value = true;
@ -407,10 +430,10 @@ async function onDelete(id: string) {
dialog({
color: 'negative',
icon: 'mdi-trash-can-outline',
title: 'ยืนยันการลบข้อมูล',
actionText: 'ตกลง',
title: t('deleteConfirmTitle'),
actionText: t('agree'),
persistent: true,
message: 'คุณต้องการลบข้อมูล ใช่หรือไม่',
message: t('deleteConfirmMessage'),
action: async () => {
await userStore.deleteById(id);