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

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

@ -241,6 +241,7 @@ const saveData = async () => {
notifyError($q, 'กรุณาอัพโหลดรูปถ่าย') notifyError($q, 'กรุณาอัพโหลดรูปถ่าย')
return return
} }
console.log(defaultInformation.value.tel)
await formInformation.value.validate().then(async (suc: boolean) => { await formInformation.value.validate().then(async (suc: boolean) => {
if (suc) { if (suc) {
await formAddress.value.validate().then(async (suc: boolean) => { await formAddress.value.validate().then(async (suc: boolean) => {

View file

@ -27,9 +27,10 @@
v-model="defaultEducation.educationLevelExamId" v-model="defaultEducation.educationLevelExamId"
:rules="[(val) => !!val || `${'กรุณาเลือก วุฒิที่ใช้สมัครสอบ'}`]" :rules="[(val) => !!val || `${'กรุณาเลือก วุฒิที่ใช้สมัครสอบ'}`]"
:label="`${'วุฒิที่ใช้สมัครสอบ'}`" :label="`${'วุฒิที่ใช้สมัครสอบ'}`"
@update:model-value="(value) => checkInputName()"
/> />
</div> </div>
<div class="col-xs-12 col-sm-3"> <div class="col-xs-12 col-sm-3" v-if="showEducationName">
<q-input <q-input
:class="getClass(status == 'register' || status == 'rejectRegister')" :class="getClass(status == 'register' || status == 'rejectRegister')"
:outlined="status == 'register' || status == 'rejectRegister'" :outlined="status == 'register' || status == 'rejectRegister'"
@ -114,7 +115,11 @@
lazy-rules lazy-rules
:readonly="!(status == 'register' || status == 'rejectRegister')" :readonly="!(status == 'register' || status == 'rejectRegister')"
:borderless="!(status == 'register' || status == 'rejectRegister')" :borderless="!(status == 'register' || status == 'rejectRegister')"
:model-value="date2Thai(defaultEducation.educationEndDate)" :model-value="
defaultEducation.educationEndDate == null
? null
: date2Thai(defaultEducation.educationEndDate)
"
:rules="[(val) => !!val || `${'กรุณาเลือกวันที่สำเร็จการศึกษา'}`]" :rules="[(val) => !!val || `${'กรุณาเลือกวันที่สำเร็จการศึกษา'}`]"
:label="`${'วันที่สำเร็จการศึกษา'}`" :label="`${'วันที่สำเร็จการศึกษา'}`"
> >
@ -200,6 +205,7 @@ const props = defineProps({
const $q = useQuasar() const $q = useQuasar()
const edit = ref<boolean>(true) const edit = ref<boolean>(true)
const showEducationName = ref<boolean>(true)
const myform = ref<any>({}) const myform = ref<any>({})
const route = useRoute() const route = useRoute()
const examId = ref<string>(route.params.id.toString()) const examId = ref<string>(route.params.id.toString())
@ -245,9 +251,11 @@ const fetchData = async () => {
defaultEducation.value.educationMajor = data.educationMajor defaultEducation.value.educationMajor = data.educationMajor
defaultEducation.value.educationLocation = data.educationLocation defaultEducation.value.educationLocation = data.educationLocation
defaultEducation.value.educationType = data.educationType 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.educationScores = data.educationScores
defaultEducation.value.educationLevelHighId = data.educationLevelHighId defaultEducation.value.educationLevelHighId = data.educationLevelHighId
checkInputName()
}) })
.catch((e) => { .catch((e) => {
// messageError($q, 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) => { const getClass = (val: boolean) => {
return { return {
'full-width inputgreen cursor-pointer': val, 'full-width inputgreen cursor-pointer': val,

View file

@ -224,6 +224,7 @@
v-model="defaultInformation.tel" v-model="defaultInformation.tel"
:label="`${'โทรศัพท์'}`" :label="`${'โทรศัพท์'}`"
:rules="[ :rules="[
(val) => !!val || `${'กรุณากรอก โทรศัพท์'}`,
(val) => val.length == 10 || `${'กรุณากรอก โทรศัพท์'}`, (val) => val.length == 10 || `${'กรุณากรอก โทรศัพท์'}`,
(val) => /^[0-9]*$/.test(val) || `${'กรุณากรอกข้อมูลโทรศัพท์ให้ถูกต้อง'}` (val) => /^[0-9]*$/.test(val) || `${'กรุณากรอกข้อมูลโทรศัพท์ให้ถูกต้อง'}`
]" ]"
@ -424,6 +425,7 @@ const img = ref<string>('')
const fileProfile = ref<File[]>([]) const fileProfile = ref<File[]>([])
const cardid1 = ref<string | null>('') const cardid1 = ref<string | null>('')
const cardid2 = ref<string | null>('') const cardid2 = ref<string | null>('')
const registerEndDate = ref<Date>(new Date())
const opNat = ref(['ไทย']) const opNat = ref(['ไทย'])
const idModel = ref<boolean>(false) const idModel = ref<boolean>(false)
@ -441,6 +443,7 @@ onMounted(async () => {
await fetchImgData() await fetchImgData()
if (defaultInformation.value.provinceId != null) if (defaultInformation.value.provinceId != null)
await fetchDistrict(defaultInformation.value.provinceId) await fetchDistrict(defaultInformation.value.provinceId)
candidateCheck()
}) })
const fetchData = async () => { const fetchData = async () => {
@ -454,8 +457,8 @@ const fetchData = async () => {
if (data.lastName == null || data.lastName == '') { if (data.lastName == null || data.lastName == '') {
data.lastName = keycloak.tokenParsed == null ? '' : keycloak.tokenParsed.family_name data.lastName = keycloak.tokenParsed == null ? '' : keycloak.tokenParsed.family_name
} }
if (data.firstname == null || data.firstname == '') { if (data.firstName == null || data.firstName == '') {
data.firstname = keycloak.tokenParsed == null ? '' : keycloak.tokenParsed.given_name data.firstName = keycloak.tokenParsed == null ? '' : keycloak.tokenParsed.given_name
} }
if (data.email == null || data.email == '') { if (data.email == null || data.email == '') {
data.email = keycloak.tokenParsed == null ? '' : keycloak.tokenParsed.email data.email = keycloak.tokenParsed == null ? '' : keycloak.tokenParsed.email
@ -521,17 +524,33 @@ const selectPrefix = async () => {
} }
const selectBirthDate = async () => { const selectBirthDate = async () => {
if (defaultInformation.value.birthDate != null) { if (defaultInformation.value.birthDate != null) {
console.log(calAgeYear(defaultInformation.value.birthDate)) if (calAgeYear(defaultInformation.value.birthDate, registerEndDate.value) < 18) {
if (calAgeYear(defaultInformation.value.birthDate) < 18) {
defaultInformation.value.birthDate = null defaultInformation.value.birthDate = null
notifyError($q, 'อายุไม่ถึง18') notifyError($q, 'อายุไม่ถึง18')
} else if (calAgeYear(defaultInformation.value.birthDate) > 60) { } else if (calAgeYear(defaultInformation.value.birthDate, registerEndDate.value) > 60) {
defaultInformation.value.birthDate = null defaultInformation.value.birthDate = null
notifyError($q, 'อายุเกิน60') 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 () => { const fetchImgData = async () => {
loaderPage(true) loaderPage(true)
await http await http

View file

@ -126,6 +126,7 @@
:borderless="!(status == 'register' || status == 'rejectRegister')" :borderless="!(status == 'register' || status == 'rejectRegister')"
v-model="defaultOccupation.tel" v-model="defaultOccupation.tel"
:rules="[ :rules="[
(val) => !!val || `${'กรุณากรอก เบอร์โทรที่ทำงาน'}`,
(val) => val.length == 10 || `${'กรุณากรอก เบอร์โทรที่ทำงาน'}`, (val) => val.length == 10 || `${'กรุณากรอก เบอร์โทรที่ทำงาน'}`,
(val) => /^[0-9]*$/.test(val) || 'กรุณากรอก เบอร์โทรที่ทำงานให้ถูกต้อง' (val) => /^[0-9]*$/.test(val) || 'กรุณากรอก เบอร์โทรที่ทำงานให้ถูกต้อง'
]" ]"

View file

@ -85,7 +85,7 @@ interface Education {
educationMajor: string | null educationMajor: string | null
educationLocation: string | null educationLocation: string | null
educationType: string | null educationType: string | null
educationEndDate: Date educationEndDate: Date | null
educationScores: number | null educationScores: number | null
educationLevelHighId: string | null educationLevelHighId: string | null
} }
@ -154,7 +154,7 @@ const defaultInformation = ref<Information>({
prefixId: null, prefixId: null,
firstname: null, firstname: null,
lastname: null, lastname: null,
birthDate: new Date(), birthDate: null,
genderId: null, genderId: null,
bloodId: null, bloodId: null,
nationality: 'ไทย', nationality: 'ไทย',
@ -219,7 +219,7 @@ const defaultEducation = ref<Education>({
educationMajor: null, educationMajor: null,
educationLocation: null, educationLocation: null,
educationType: null, educationType: null,
educationEndDate: new Date(), educationEndDate: null,
educationScores: null, educationScores: null,
educationLevelHighId: null educationLevelHighId: null
}) })

View file

@ -6,9 +6,7 @@
{{ tittle }} {{ tittle }}
{{ `ครั้งที่${round}/${yearly == null ? '' : yearly + 543}` }} {{ `ครั้งที่${round}/${yearly == null ? '' : yearly + 543}` }}
</div> </div>
<div class="col-12"> <div class="col-12">{{ position }} ระด{{ positionLevel }}</div>
{{ position }} ระด{{ positionLevel }}
</div>
</div> </div>
</q-toolbar> </q-toolbar>
<!-- <q-toolbar class="q-pa-sm text-center"> <!-- <q-toolbar class="q-pa-sm text-center">
@ -81,7 +79,7 @@
</q-card> </q-card>
</q-dialog> </q-dialog>
<q-dialog :model-value="timeout" persistent> <q-dialog :model-value="timeout" persistent>
<q-card :style="$q.screen.gt.xs ? 'min-width: 30vw' : 'min-width: 80vw'" class=" q-pa-sm"> <q-card :style="$q.screen.gt.xs ? 'min-width: 30vw' : 'min-width: 80vw'" class="q-pa-sm">
<q-card-section class="row items-center col-12"> <q-card-section class="row items-center col-12">
<div class="column col-12 text-center"> <div class="column col-12 text-center">
<div><q-icon name="mdi-alert-outline" size="50px" color="pink" /></div> <div><q-icon name="mdi-alert-outline" size="50px" color="pink" /></div>
@ -177,8 +175,8 @@ const candidateCheck = async () => {
stepRaw.value = 2 stepRaw.value = 2
step.value = 2 step.value = 2
} else { } else {
registerStartDate.value = new Date(data.registerEndDate) registerStartDate.value = new Date(data.registerStartDate)
registerEndDate.value = new Date(data.registerStartDate) registerEndDate.value = new Date(data.registerEndDate)
timeout.value = true timeout.value = true
} }
} }