diff --git a/src/modules/01_exam/components/ExamForm.vue b/src/modules/01_exam/components/ExamForm.vue
index fe8e8ad..f75b5f6 100644
--- a/src/modules/01_exam/components/ExamForm.vue
+++ b/src/modules/01_exam/components/ExamForm.vue
@@ -241,6 +241,7 @@ const saveData = async () => {
notifyError($q, 'กรุณาอัพโหลดรูปถ่าย')
return
}
+ console.log(defaultInformation.value.tel)
await formInformation.value.validate().then(async (suc: boolean) => {
if (suc) {
await formAddress.value.validate().then(async (suc: boolean) => {
diff --git a/src/modules/01_exam/components/Form/Education.vue b/src/modules/01_exam/components/Form/Education.vue
index c67daaa..9430fdd 100644
--- a/src/modules/01_exam/components/Form/Education.vue
+++ b/src/modules/01_exam/components/Form/Education.vue
@@ -27,9 +27,10 @@
v-model="defaultEducation.educationLevelExamId"
:rules="[(val) => !!val || `${'กรุณาเลือก วุฒิที่ใช้สมัครสอบ'}`]"
:label="`${'วุฒิที่ใช้สมัครสอบ'}`"
+ @update:model-value="(value) => checkInputName()"
/>
-
+
@@ -200,6 +205,7 @@ const props = defineProps({
const $q = useQuasar()
const edit = ref(true)
+const showEducationName = ref(true)
const myform = ref({})
const route = useRoute()
const examId = ref(route.params.id.toString())
@@ -245,9 +251,11 @@ const fetchData = async () => {
defaultEducation.value.educationMajor = data.educationMajor
defaultEducation.value.educationLocation = data.educationLocation
defaultEducation.value.educationType = data.educationType
- defaultEducation.value.educationEndDate = new Date(data.educationEndDate)
+ defaultEducation.value.educationEndDate =
+ data.educationEndDate == null ? null : new Date(data.educationEndDate)
defaultEducation.value.educationScores = data.educationScores
defaultEducation.value.educationLevelHighId = data.educationLevelHighId
+ checkInputName()
})
.catch((e) => {
// messageError($q, e)
@@ -257,6 +265,17 @@ const fetchData = async () => {
})
}
+const checkInputName = () => {
+ showEducationName.value =
+ props.educationLevelOptions.filter(
+ (x) =>
+ x.id == defaultEducation.value.educationLevelExamId &&
+ (x.name == 'ปริญญาตรี' || x.name == 'ปริญญาโท' || x.name == 'ปริญญาเอก')
+ ).length == 0
+ ? false
+ : true
+}
+
const getClass = (val: boolean) => {
return {
'full-width inputgreen cursor-pointer': val,
diff --git a/src/modules/01_exam/components/Form/Information.vue b/src/modules/01_exam/components/Form/Information.vue
index 7b38316..08b6440 100644
--- a/src/modules/01_exam/components/Form/Information.vue
+++ b/src/modules/01_exam/components/Form/Information.vue
@@ -224,6 +224,7 @@
v-model="defaultInformation.tel"
:label="`${'โทรศัพท์'}`"
:rules="[
+ (val) => !!val || `${'กรุณากรอก โทรศัพท์'}`,
(val) => val.length == 10 || `${'กรุณากรอก โทรศัพท์'}`,
(val) => /^[0-9]*$/.test(val) || `${'กรุณากรอกข้อมูลโทรศัพท์ให้ถูกต้อง'}`
]"
@@ -424,6 +425,7 @@ const img = ref('')
const fileProfile = ref([])
const cardid1 = ref('')
const cardid2 = ref('')
+const registerEndDate = ref(new Date())
const opNat = ref(['ไทย'])
const idModel = ref(false)
@@ -441,6 +443,7 @@ onMounted(async () => {
await fetchImgData()
if (defaultInformation.value.provinceId != null)
await fetchDistrict(defaultInformation.value.provinceId)
+ candidateCheck()
})
const fetchData = async () => {
@@ -454,8 +457,8 @@ const fetchData = async () => {
if (data.lastName == null || data.lastName == '') {
data.lastName = keycloak.tokenParsed == null ? '' : keycloak.tokenParsed.family_name
}
- if (data.firstname == null || data.firstname == '') {
- data.firstname = keycloak.tokenParsed == null ? '' : keycloak.tokenParsed.given_name
+ if (data.firstName == null || data.firstName == '') {
+ data.firstName = keycloak.tokenParsed == null ? '' : keycloak.tokenParsed.given_name
}
if (data.email == null || data.email == '') {
data.email = keycloak.tokenParsed == null ? '' : keycloak.tokenParsed.email
@@ -521,17 +524,33 @@ const selectPrefix = async () => {
}
const selectBirthDate = async () => {
if (defaultInformation.value.birthDate != null) {
- console.log(calAgeYear(defaultInformation.value.birthDate))
- if (calAgeYear(defaultInformation.value.birthDate) < 18) {
+ if (calAgeYear(defaultInformation.value.birthDate, registerEndDate.value) < 18) {
defaultInformation.value.birthDate = null
notifyError($q, 'อายุไม่ถึง18')
- } else if (calAgeYear(defaultInformation.value.birthDate) > 60) {
+ } else if (calAgeYear(defaultInformation.value.birthDate, registerEndDate.value) > 60) {
defaultInformation.value.birthDate = null
notifyError($q, 'อายุเกิน60')
}
}
}
+const candidateCheck = async () => {
+ loaderPage(true)
+ await http
+ .get(config.API.candidateCheckCreate(examId.value, positionId.value))
+ .then(async (res) => {
+ const data = res.data.result
+ registerEndDate.value =
+ data.registerEndDate == null ? new Date() : new Date(data.registerEndDate)
+ })
+ .catch((e) => {
+ messageError($q, e)
+ })
+ .finally(() => {
+ loaderPage(false)
+ })
+}
+
const fetchImgData = async () => {
loaderPage(true)
await http
diff --git a/src/modules/01_exam/components/Form/Occupation.vue b/src/modules/01_exam/components/Form/Occupation.vue
index a72417a..3f958f1 100644
--- a/src/modules/01_exam/components/Form/Occupation.vue
+++ b/src/modules/01_exam/components/Form/Occupation.vue
@@ -126,6 +126,7 @@
:borderless="!(status == 'register' || status == 'rejectRegister')"
v-model="defaultOccupation.tel"
:rules="[
+ (val) => !!val || `${'กรุณากรอก เบอร์โทรที่ทำงาน'}`,
(val) => val.length == 10 || `${'กรุณากรอก เบอร์โทรที่ทำงาน'}`,
(val) => /^[0-9]*$/.test(val) || 'กรุณากรอก เบอร์โทรที่ทำงานให้ถูกต้อง'
]"
diff --git a/src/modules/01_exam/interface/index/Main.ts b/src/modules/01_exam/interface/index/Main.ts
index f5f1b80..86af222 100644
--- a/src/modules/01_exam/interface/index/Main.ts
+++ b/src/modules/01_exam/interface/index/Main.ts
@@ -85,7 +85,7 @@ interface Education {
educationMajor: string | null
educationLocation: string | null
educationType: string | null
- educationEndDate: Date
+ educationEndDate: Date | null
educationScores: number | null
educationLevelHighId: string | null
}
@@ -154,7 +154,7 @@ const defaultInformation = ref({
prefixId: null,
firstname: null,
lastname: null,
- birthDate: new Date(),
+ birthDate: null,
genderId: null,
bloodId: null,
nationality: 'ไทย',
@@ -219,7 +219,7 @@ const defaultEducation = ref({
educationMajor: null,
educationLocation: null,
educationType: null,
- educationEndDate: new Date(),
+ educationEndDate: null,
educationScores: null,
educationLevelHighId: null
})
diff --git a/src/modules/01_exam/views/ExamDetail.vue b/src/modules/01_exam/views/ExamDetail.vue
index a5babd7..9bff0e7 100644
--- a/src/modules/01_exam/views/ExamDetail.vue
+++ b/src/modules/01_exam/views/ExamDetail.vue
@@ -6,9 +6,7 @@
{{ tittle }}
{{ `ครั้งที่${round}/${yearly == null ? '' : yearly + 543}` }}
-
- {{ position }} ระดับ{{ positionLevel }}
-
+
{{ position }} ระดับ{{ positionLevel }}