คัดเลือก เลือกวุฒิการศึกษา
This commit is contained in:
parent
90a47d43ad
commit
b4f20e407b
4 changed files with 79 additions and 3 deletions
|
|
@ -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-3">
|
<div class="col-3" v-if="showEducationName">
|
||||||
<q-input
|
<q-input
|
||||||
class="q-pl-sm"
|
class="q-pl-sm"
|
||||||
:class="getClass(status == 'checkRegister' || status == 'payment')"
|
:class="getClass(status == 'checkRegister' || status == 'payment')"
|
||||||
|
|
@ -220,6 +221,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 candidateId = ref<string>(route.params.candidateId.toString());
|
const candidateId = ref<string>(route.params.candidateId.toString());
|
||||||
|
|
@ -276,6 +278,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,
|
||||||
|
|
|
||||||
|
|
@ -136,6 +136,7 @@
|
||||||
week-start="0"
|
week-start="0"
|
||||||
:max-date="new Date()"
|
:max-date="new Date()"
|
||||||
:disabled="!(status == 'checkRegister' || status == 'payment')"
|
:disabled="!(status == 'checkRegister' || status == 'payment')"
|
||||||
|
@update:modelValue="selectBirthDate"
|
||||||
>
|
>
|
||||||
<template #year="{ year }">
|
<template #year="{ year }">
|
||||||
{{ year + 543 }}
|
{{ year + 543 }}
|
||||||
|
|
@ -214,6 +215,7 @@
|
||||||
:borderless="!(status == 'checkRegister' || status == 'payment')"
|
:borderless="!(status == 'checkRegister' || status == 'payment')"
|
||||||
v-model="defaultInformation.tel"
|
v-model="defaultInformation.tel"
|
||||||
:rules="[
|
:rules="[
|
||||||
|
(val) => !!val || `${'กรุณากรอก เบอร์โทร'}`,
|
||||||
(val) => val.length == 10 || `${'กรุณากรอก เบอร์โทร'}`,
|
(val) => val.length == 10 || `${'กรุณากรอก เบอร์โทร'}`,
|
||||||
(val) =>
|
(val) =>
|
||||||
/^[0-9]*$/.test(val) || `${'กรุณากรอกข้อมูลเบอร์โทรให้ถูกต้อง'}`,
|
/^[0-9]*$/.test(val) || `${'กรุณากรอกข้อมูลเบอร์โทรให้ถูกต้อง'}`,
|
||||||
|
|
@ -440,7 +442,8 @@ const props = defineProps({
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
const { date2Thai, calAge, modalError, success } = mixin;
|
const { date2Thai, calAge, modalError, success, notifyError, calAgeYear } =
|
||||||
|
mixin;
|
||||||
const districtOptions = ref<DataOption[]>([]);
|
const districtOptions = ref<DataOption[]>([]);
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const candidateId = ref<string>(route.params.candidateId.toString());
|
const candidateId = ref<string>(route.params.candidateId.toString());
|
||||||
|
|
@ -449,6 +452,7 @@ const myform = ref<any>({});
|
||||||
const img = ref<string>("");
|
const img = ref<string>("");
|
||||||
const opNat = ref(["ไทย"]);
|
const opNat = ref(["ไทย"]);
|
||||||
const fileProfile = ref<File[]>([]);
|
const fileProfile = ref<File[]>([]);
|
||||||
|
const registerEndDate = ref<Date>(new Date());
|
||||||
|
|
||||||
const { messageError, showLoader, hideLoader } = mixin;
|
const { messageError, showLoader, hideLoader } = mixin;
|
||||||
|
|
||||||
|
|
@ -577,6 +581,21 @@ const getClass = (val: boolean) => {
|
||||||
"full-width cursor-pointer": !val,
|
"full-width cursor-pointer": !val,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
const selectBirthDate = async () => {
|
||||||
|
// if (defaultInformation.value.birthDate != null) {
|
||||||
|
// if (
|
||||||
|
// calAgeYear(defaultInformation.value.birthDate, registerEndDate.value) < 18
|
||||||
|
// ) {
|
||||||
|
// defaultInformation.value.birthDate = null;
|
||||||
|
// notifyError($q, "อายุไม่ถึง18");
|
||||||
|
// } else if (
|
||||||
|
// calAgeYear(defaultInformation.value.birthDate, registerEndDate.value) > 60
|
||||||
|
// ) {
|
||||||
|
// defaultInformation.value.birthDate = null;
|
||||||
|
// notifyError($q, "อายุเกิน60");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@
|
||||||
:label="`${'เงินเดือน'}`"
|
:label="`${'เงินเดือน'}`"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
<q-input
|
<q-input
|
||||||
:class="getClass(status == 'checkRegister' || status == 'payment')"
|
:class="getClass(status == 'checkRegister' || status == 'payment')"
|
||||||
|
|
@ -124,6 +124,7 @@
|
||||||
v-model="defaultOccupation.tel"
|
v-model="defaultOccupation.tel"
|
||||||
:rules="[
|
:rules="[
|
||||||
(val) => !!val || `${'กรุณากรอก เบอร์โทรที่ทำงาน'}`,
|
(val) => !!val || `${'กรุณากรอก เบอร์โทรที่ทำงาน'}`,
|
||||||
|
(val) => val.length == 10 || `${'กรุณากรอก เบอร์โทรที่ทำงาน'}`,
|
||||||
(val) =>
|
(val) =>
|
||||||
/^[0-9]*$/.test(val) || 'กรุณากรอก เบอร์โทรที่ทำงานให้ถูกต้อง',
|
/^[0-9]*$/.test(val) || 'กรุณากรอก เบอร์โทรที่ทำงานให้ถูกต้อง',
|
||||||
]"
|
]"
|
||||||
|
|
|
||||||
|
|
@ -198,6 +198,48 @@ export const useCounterMixin = defineStore("mixin", () => {
|
||||||
return date.getDate().toString().padStart(2, "0") + " " + dstMonth;
|
return date.getDate().toString().padStart(2, "0") + " " + dstMonth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const calAgeYear = (srcDate: Date, birthCal: Date = new Date()) => {
|
||||||
|
const toDay = birthCal;
|
||||||
|
const birth = new Date(srcDate);
|
||||||
|
|
||||||
|
const yearNow = toDay.getFullYear();
|
||||||
|
const monthNow = toDay.getMonth();
|
||||||
|
const dateNow = toDay.getDate();
|
||||||
|
|
||||||
|
const yearDob = birth.getFullYear();
|
||||||
|
const monthDob = birth.getMonth();
|
||||||
|
const dateDob = birth.getDate();
|
||||||
|
|
||||||
|
const lastYear = 12;
|
||||||
|
const subtractDate: Object = moment().subtract(1, "months").endOf("month");
|
||||||
|
|
||||||
|
const lastMonths = new Date(subtractDate.toString()).getDate();
|
||||||
|
|
||||||
|
let yearAge = yearNow - yearDob;
|
||||||
|
let monthAge = 0;
|
||||||
|
let dateAge = 0;
|
||||||
|
|
||||||
|
if (monthNow >= monthDob) {
|
||||||
|
monthAge = monthNow - monthDob;
|
||||||
|
} else {
|
||||||
|
yearAge--;
|
||||||
|
monthAge = lastYear + monthNow - monthDob;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dateNow >= dateDob) {
|
||||||
|
dateAge = dateNow - dateDob;
|
||||||
|
} else {
|
||||||
|
monthAge--;
|
||||||
|
dateAge = lastMonths + dateNow - dateDob;
|
||||||
|
|
||||||
|
if (monthAge < 0) {
|
||||||
|
monthAge = 11;
|
||||||
|
yearAge--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return yearAge;
|
||||||
|
};
|
||||||
|
|
||||||
function monthYear2Thai(month: number, year: number, isFullMonth = false) {
|
function monthYear2Thai(month: number, year: number, isFullMonth = false) {
|
||||||
const date = new Date(`${year}-${month + 1}-1`);
|
const date = new Date(`${year}-${month + 1}-1`);
|
||||||
const fullMonthThai = [
|
const fullMonthThai = [
|
||||||
|
|
@ -809,6 +851,7 @@ export const useCounterMixin = defineStore("mixin", () => {
|
||||||
dateToISO,
|
dateToISO,
|
||||||
notify,
|
notify,
|
||||||
notifyError,
|
notifyError,
|
||||||
|
calAgeYear,
|
||||||
dateText,
|
dateText,
|
||||||
monthYear2Thai,
|
monthYear2Thai,
|
||||||
dateMonth2Thai,
|
dateMonth2Thai,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue