Merge branch 'develop' of github.com:Frappet/bma-ehr-frontend into develop
This commit is contained in:
commit
653cd846db
4 changed files with 79 additions and 3 deletions
|
|
@ -27,9 +27,10 @@
|
|||
v-model="defaultEducation.educationLevelExamId"
|
||||
:rules="[(val) => !!val || `${'กรุณาเลือก วุฒิที่ใช้สมัครสอบ'}`]"
|
||||
:label="`${'วุฒิที่ใช้สมัครสอบ'}`"
|
||||
@update:model-value="(value) => checkInputName()"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="col-3" v-if="showEducationName">
|
||||
<q-input
|
||||
class="q-pl-sm"
|
||||
:class="getClass(status == 'checkRegister' || status == 'payment')"
|
||||
|
|
@ -220,6 +221,7 @@ const props = defineProps({
|
|||
|
||||
const $q = useQuasar();
|
||||
const edit = ref<boolean>(true);
|
||||
const showEducationName = ref<boolean>(true);
|
||||
const myform = ref<any>({});
|
||||
const route = useRoute();
|
||||
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) => {
|
||||
return {
|
||||
"full-width inputgreen cursor-pointer": val,
|
||||
|
|
|
|||
|
|
@ -136,6 +136,7 @@
|
|||
week-start="0"
|
||||
:max-date="new Date()"
|
||||
:disabled="!(status == 'checkRegister' || status == 'payment')"
|
||||
@update:modelValue="selectBirthDate"
|
||||
>
|
||||
<template #year="{ year }">
|
||||
{{ year + 543 }}
|
||||
|
|
@ -214,6 +215,7 @@
|
|||
:borderless="!(status == 'checkRegister' || status == 'payment')"
|
||||
v-model="defaultInformation.tel"
|
||||
:rules="[
|
||||
(val) => !!val || `${'กรุณากรอก เบอร์โทร'}`,
|
||||
(val) => val.length == 10 || `${'กรุณากรอก เบอร์โทร'}`,
|
||||
(val) =>
|
||||
/^[0-9]*$/.test(val) || `${'กรุณากรอกข้อมูลเบอร์โทรให้ถูกต้อง'}`,
|
||||
|
|
@ -440,7 +442,8 @@ const props = defineProps({
|
|||
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
const { date2Thai, calAge, modalError, success } = mixin;
|
||||
const { date2Thai, calAge, modalError, success, notifyError, calAgeYear } =
|
||||
mixin;
|
||||
const districtOptions = ref<DataOption[]>([]);
|
||||
const route = useRoute();
|
||||
const candidateId = ref<string>(route.params.candidateId.toString());
|
||||
|
|
@ -449,6 +452,7 @@ const myform = ref<any>({});
|
|||
const img = ref<string>("");
|
||||
const opNat = ref(["ไทย"]);
|
||||
const fileProfile = ref<File[]>([]);
|
||||
const registerEndDate = ref<Date>(new Date());
|
||||
|
||||
const { messageError, showLoader, hideLoader } = mixin;
|
||||
|
||||
|
|
@ -577,6 +581,21 @@ const getClass = (val: boolean) => {
|
|||
"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>
|
||||
|
||||
<style>
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@
|
|||
:label="`${'เงินเดือน'}`"
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-4">
|
||||
<q-input
|
||||
:class="getClass(status == 'checkRegister' || status == 'payment')"
|
||||
|
|
@ -124,6 +124,7 @@
|
|||
v-model="defaultOccupation.tel"
|
||||
:rules="[
|
||||
(val) => !!val || `${'กรุณากรอก เบอร์โทรที่ทำงาน'}`,
|
||||
(val) => val.length == 10 || `${'กรุณากรอก เบอร์โทรที่ทำงาน'}`,
|
||||
(val) =>
|
||||
/^[0-9]*$/.test(val) || 'กรุณากรอก เบอร์โทรที่ทำงานให้ถูกต้อง',
|
||||
]"
|
||||
|
|
|
|||
|
|
@ -198,6 +198,48 @@ export const useCounterMixin = defineStore("mixin", () => {
|
|||
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) {
|
||||
const date = new Date(`${year}-${month + 1}-1`);
|
||||
const fullMonthThai = [
|
||||
|
|
@ -809,6 +851,7 @@ export const useCounterMixin = defineStore("mixin", () => {
|
|||
dateToISO,
|
||||
notify,
|
||||
notifyError,
|
||||
calAgeYear,
|
||||
dateText,
|
||||
monthYear2Thai,
|
||||
dateMonth2Thai,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue