diff --git a/src/modules/05_placement/components/probation/FormAppoint/FormAppoint.vue b/src/modules/05_placement/components/probation/FormAppoint/FormAppoint.vue index e1043ffe4..2320af0d5 100644 --- a/src/modules/05_placement/components/probation/FormAppoint/FormAppoint.vue +++ b/src/modules/05_placement/components/probation/FormAppoint/FormAppoint.vue @@ -64,6 +64,27 @@ const countRowLength = computed(() => { : false; }); +const findPerson = computed(() => { + const roles = ["chairman", "committee", "caregiver"]; + return roles.every((role) => rows.value.some((row) => row.role === role)); +}); + +const textAlert = computed(() => { + const roles = [ + { key: "chairman", label: "ประธาน" }, + { key: "committee", label: "ผู้บังคับบัญชา" }, + { key: "caregiver", label: "ผู้ดูแล" }, + ]; + + const missingRoles = roles + .filter((role) => !rows.value.some((row) => row.role === role.key)) + .map((role) => role.label); + + return missingRoles.length > 0 + ? `กรุณาเพิ่มรายชื่อ : ${missingRoles.join(", ")}` + : ""; +}); + const optionsTypeMain = ref([]); const optionsType = ref([ { id: "chairman", value: "ประธาน" }, @@ -599,7 +620,15 @@ onMounted(async () => { - + {{ textAlert }} + บันทึก @@ -657,7 +686,6 @@ onMounted(async () => { v-model="filterKeyword" ref="filterRef" outlined - placeholder="ค้นหา" @keydown.enter.prevent="(pagination.page = 1), getPerson()" >