เลือกวุฒิการศึกษา

This commit is contained in:
Kittapath 2023-10-06 17:33:13 +07:00
parent 07dad32620
commit 96f92a5b69
6 changed files with 55 additions and 17 deletions

View file

@ -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<string>('')
const fileProfile = ref<File[]>([])
const cardid1 = ref<string | null>('')
const cardid2 = ref<string | null>('')
const registerEndDate = ref<Date>(new Date())
const opNat = ref(['ไทย'])
const idModel = ref<boolean>(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