diff --git a/src/modules/02_users/components/RolePositionSalary/DialogAddPerson.vue b/src/modules/02_users/components/RolePositionSalary/DialogAddPerson.vue index 4a00cbf0..c7d911fb 100644 --- a/src/modules/02_users/components/RolePositionSalary/DialogAddPerson.vue +++ b/src/modules/02_users/components/RolePositionSalary/DialogAddPerson.vue @@ -17,8 +17,14 @@ import DialogHeader from "@/components/DialogHeader.vue"; const $q = useQuasar(); const store = useDataStoreUser(); -const { showLoader, hideLoader, messageError, success, dialogConfirm } = - useCounterMixin(); +const { + showLoader, + hideLoader, + messageError, + success, + dialogConfirm, + dialogMessageNotify, +} = useCounterMixin(); const modal = defineModel("modal", { required: true }); const orgId = defineModel("orgId", { required: true }); @@ -120,33 +126,37 @@ async function onSearchListPerson(newPage: boolean = false) { */ function onSubmitPerson() { const arrayId = selected.value.map((e: DataProfile) => e.id); - dialogConfirm( - $q, - async () => { - showLoader(); - const body = { - nodeId: orgId.value, - isEdit: isEdit.value, - isCheck: isCheck.value, - personId: arrayId, - }; - await http - .post(config.API.permissioProfileOrg, body) - .then(async () => { - await props.fetchData?.(false); - success($q, "เพิ่มราชชื่อสำเร็จ"); - onClose(); - }) - .catch((err) => { - messageError($q, err); - }) - .finally(() => { - hideLoader(); - }); - }, - "ยืนยันการเพิ่มรายชื่อ", - "ต้องการยืนยันการเพิ่มรายชื่อนี้หรือไม่ ?" - ); + if (isEdit.value == false && isCheck.value == false) { + dialogMessageNotify($q, "กรุณาเลือกสิทธิ์อย่างน้อย 1 สิทธิ์"); + } else { + dialogConfirm( + $q, + async () => { + showLoader(); + const body = { + nodeId: orgId.value, + isEdit: isEdit.value, + isCheck: isCheck.value, + personId: arrayId, + }; + await http + .post(config.API.permissioProfileOrg, body) + .then(async () => { + await props.fetchData?.(false); + success($q, "เพิ่มราชชื่อสำเร็จ"); + onClose(); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); + }, + "ยืนยันการเพิ่มรายชื่อ", + "ต้องการยืนยันการเพิ่มรายชื่อนี้หรือไม่ ?" + ); + } } /**