483 lines
17 KiB
Vue
483 lines
17 KiB
Vue
<!-- step กรอกข้อมูล -->
|
|
<script setup lang="ts">
|
|
import { onMounted, ref } from "vue";
|
|
import { useRoute, useRouter } from "vue-router";
|
|
import { useQuasar } from "quasar";
|
|
|
|
import http from "@/plugins/http";
|
|
import config from "@/app.config";
|
|
import { useCounterMixin } from "@/stores/mixin";
|
|
|
|
import Profile from "@/modules/03_recruiting/components/Profile.vue";
|
|
import {
|
|
defaultInformation,
|
|
defaultOccupation,
|
|
defaultContact,
|
|
defaultAddress,
|
|
defaultEducation,
|
|
} from "@/modules/03_recruiting/interface/index/Main";
|
|
|
|
const $q = useQuasar();
|
|
const router = useRouter();
|
|
const route = useRoute();
|
|
const mixin = useCounterMixin(); //เรียกฟังก์ชันกลาง
|
|
const {
|
|
success,
|
|
dateToISO,
|
|
messageError,
|
|
showLoader,
|
|
hideLoader,
|
|
notifyError,
|
|
} = mixin;
|
|
|
|
const examId = ref<string>(route.params.examId.toString());
|
|
const candidateId = ref<string>(route.params.candidateId.toString());
|
|
const modal = ref<boolean>(false);
|
|
const modalReverseOfficer = ref<boolean>(false);
|
|
const approve = ref<string>("1");
|
|
const reason = ref<string>("");
|
|
const formInformation = ref<any>({});
|
|
const formAddress = ref<any>({});
|
|
const formEducation = ref<any>({});
|
|
const formOccupation = ref<any>({});
|
|
const formContact = ref<any>({});
|
|
const status = ref<string>("");
|
|
const rejectDetail = ref<string>("");
|
|
|
|
/** ดึงข้อมูลสถานะ */
|
|
async function fetchStatus() {
|
|
showLoader();
|
|
await http
|
|
.get(config.API.candidateId(candidateId.value))
|
|
.then((res) => {
|
|
const data = res.data.result;
|
|
status.value = data.status;
|
|
rejectDetail.value = data.rejectDetail;
|
|
})
|
|
.catch((e) => {
|
|
messageError($q, e);
|
|
})
|
|
.finally(async () => {
|
|
hideLoader();
|
|
});
|
|
}
|
|
|
|
/** ยืนยัน ตรวจสอบข้อมูลสำเร็จ*/
|
|
async function confirm(status: boolean, reason: string) {
|
|
showLoader();
|
|
await http
|
|
.put(config.API.candidateCheckRegister(candidateId.value), {
|
|
status: status,
|
|
reason: reason,
|
|
})
|
|
.then(() => {
|
|
success($q, "ตรวจสอบข้อมูลสำเร็จ");
|
|
router.push(`/qualify/manage/${examId.value}`);
|
|
})
|
|
.catch((e) => {
|
|
messageError($q, e);
|
|
})
|
|
.finally(() => {
|
|
hideLoader();
|
|
});
|
|
}
|
|
|
|
/** ปฏิเสธ ตรวจสอบข้อมูลสำเร็จ */
|
|
async function reject(reason: string) {
|
|
showLoader();
|
|
await http
|
|
.put(config.API.candidateRejectRegister(candidateId.value), {
|
|
reason: reason,
|
|
})
|
|
.then(() => {
|
|
success($q, "ตรวจสอบข้อมูลสำเร็จ");
|
|
router.push(`/qualify/manage/${examId.value}`);
|
|
})
|
|
.catch((e) => {
|
|
messageError($q, e);
|
|
})
|
|
.finally(() => {
|
|
hideLoader();
|
|
});
|
|
}
|
|
|
|
/** บันทึกตรวจสอบ */
|
|
function checkSaveReverse() {
|
|
rejectReverse(reason.value);
|
|
}
|
|
|
|
/** save ข้อมูล */
|
|
function checkSave() {
|
|
if (approve.value == "1") {
|
|
confirm(true, "");
|
|
} else if (approve.value == "2") {
|
|
confirm(false, reason.value);
|
|
} else {
|
|
reject(reason.value);
|
|
}
|
|
}
|
|
|
|
/** บันทึกตรวจสอบ */
|
|
async function rejectReverse(reason: string) {
|
|
showLoader();
|
|
await http
|
|
.put(config.API.candidateCheckRegisterReject(candidateId.value), {
|
|
reason: reason,
|
|
})
|
|
.then(() => {
|
|
success($q, "สำเร็จ");
|
|
router.push(`/qualify/manage/${examId.value}`);
|
|
})
|
|
.catch((e) => {
|
|
messageError($q, e);
|
|
})
|
|
.finally(() => {
|
|
hideLoader();
|
|
});
|
|
}
|
|
|
|
/** dialog ย้อนกลับให้เจ้าหน้าที่ตรวจสอบ*/
|
|
function modalReverse() {
|
|
modalReverseOfficer.value = true;
|
|
}
|
|
|
|
/** ปิด dialog ย้อนกลับให้เจ้าหน้าที่ตรวจสอบ */
|
|
function closeReverse() {
|
|
modalReverseOfficer.value = false;
|
|
}
|
|
|
|
/** ปิด dialog */
|
|
function close() {
|
|
modal.value = false;
|
|
}
|
|
|
|
/** บันทึกข้อมูล คุณสมบัติผู้สมัครสอบรอบคัดเลือก */
|
|
async function clickSave() {
|
|
await formInformation.value.validate().then(async (suc: boolean) => {
|
|
if (suc) {
|
|
await formAddress.value.validate().then(async (suc: boolean) => {
|
|
if (suc) {
|
|
await formEducation.value.validate().then(async (suc: boolean) => {
|
|
if (suc) {
|
|
await formOccupation.value
|
|
.validate()
|
|
.then(async (suc: boolean) => {
|
|
if (suc) {
|
|
await formContact.value
|
|
.validate()
|
|
.then(async (suc: boolean) => {
|
|
if (suc) {
|
|
showLoader();
|
|
await http
|
|
.post(config.API.candidateId(candidateId.value), {
|
|
// prefixId: defaultInformation.value.prefixId,
|
|
lastName: defaultInformation.value.lastname,
|
|
dateOfBirth:
|
|
defaultInformation.value.birthDate == null
|
|
? null
|
|
: dateToISO(
|
|
defaultInformation.value.birthDate
|
|
),
|
|
citizenId: defaultInformation.value.cardid,
|
|
firstName: defaultInformation.value.firstname,
|
|
// religionId: defaultInformation.value.religionId,
|
|
nationality: defaultInformation.value.nationality,
|
|
email: defaultInformation.value.email,
|
|
mobilePhone: defaultInformation.value.phone,
|
|
telephone: defaultInformation.value.tel,
|
|
knowledge: defaultInformation.value.knowledge,
|
|
occupationOrg: defaultOccupation.value.org,
|
|
occupationPile: defaultOccupation.value.pile,
|
|
occupationGroup: defaultOccupation.value.group,
|
|
occupationSalary: defaultOccupation.value.salary,
|
|
occupationPosition:
|
|
defaultOccupation.value.position,
|
|
occupationPositionType:
|
|
defaultOccupation.value.positionType,
|
|
occupationTelephone: defaultOccupation.value.tel,
|
|
registAddress: defaultAddress.value.address,
|
|
currentAddress: defaultAddress.value.addressC,
|
|
registProvinceId: defaultAddress.value.provinceId,
|
|
currentProvinceId:
|
|
defaultAddress.value.provinceIdC,
|
|
registDistrictId: defaultAddress.value.districtId,
|
|
currentDistrictId:
|
|
defaultAddress.value.districtIdC,
|
|
registSubDistrictId:
|
|
defaultAddress.value.subdistrictId,
|
|
currentSubDistrictId:
|
|
defaultAddress.value.subdistrictIdC,
|
|
registZipCode: defaultAddress.value.code,
|
|
currentZipCode: defaultAddress.value.codeC,
|
|
registSame:
|
|
defaultAddress.value.same == "1"
|
|
? true
|
|
: defaultAddress.value.same == "0"
|
|
? false
|
|
: null,
|
|
educationLevelExamId:
|
|
defaultEducation.value.educationLevelExamId,
|
|
educationName:
|
|
defaultEducation.value.educationName,
|
|
educationMajor:
|
|
defaultEducation.value.educationMajor,
|
|
educationLocation:
|
|
defaultEducation.value.educationLocation,
|
|
educationType:
|
|
defaultEducation.value.educationType,
|
|
educationEndDate:
|
|
defaultEducation.value.educationEndDate == null
|
|
? null
|
|
: dateToISO(
|
|
defaultEducation.value.educationEndDate
|
|
),
|
|
educationScores:
|
|
defaultEducation.value.educationScores,
|
|
educationLevelHighId:
|
|
defaultEducation.value.educationLevelHighId,
|
|
// contactPrefixId:
|
|
// defaultContact.value.contactPrefixId,
|
|
contactFirstname:
|
|
defaultContact.value.contactFirstname,
|
|
contactLastname:
|
|
defaultContact.value.contactLastname,
|
|
contactRelations:
|
|
defaultContact.value.contactRelations,
|
|
contactTel: defaultContact.value.contactTel,
|
|
|
|
contactPrefixName:
|
|
defaultContact.value.contactPrefixName,
|
|
prefixName: defaultInformation.value.prefix,
|
|
religionName:
|
|
defaultInformation.value.religionName,
|
|
})
|
|
.then(async () => {
|
|
success($q, "บันทึกข้อมูลส่วนตัวสำเร็จ");
|
|
})
|
|
.catch((e) => {
|
|
messageError($q, e);
|
|
})
|
|
.finally(async () => {
|
|
hideLoader();
|
|
});
|
|
} else {
|
|
notifyError($q, "กรุณากรอกข้อมูลให้ครบถ้วน");
|
|
}
|
|
});
|
|
} else {
|
|
notifyError($q, "กรุณากรอกข้อมูลให้ครบถ้วน");
|
|
}
|
|
});
|
|
} else {
|
|
notifyError($q, "กรุณากรอกข้อมูลให้ครบถ้วน");
|
|
}
|
|
});
|
|
} else {
|
|
notifyError($q, "กรุณากรอกข้อมูลให้ครบถ้วน");
|
|
}
|
|
});
|
|
} else {
|
|
notifyError($q, "กรุณากรอกข้อมูลให้ครบถ้วน");
|
|
}
|
|
});
|
|
}
|
|
|
|
onMounted(async () => {
|
|
await fetchStatus();
|
|
});
|
|
</script>
|
|
|
|
<template>
|
|
<div class="toptitle text-dark col-12 row items-center">
|
|
<q-btn
|
|
icon="mdi-arrow-left"
|
|
unelevated
|
|
round
|
|
dense
|
|
flat
|
|
color="primary"
|
|
class="q-mr-sm"
|
|
@click="router.push(`/qualify/manage/${examId}`)"
|
|
/>
|
|
ตรวจสอบคุณสมบัติผู้สมัครสอบรอบคัดเลือก
|
|
{{
|
|
rejectDetail == null || rejectDetail == ""
|
|
? ""
|
|
: "(เหตุผล: " + rejectDetail + ")"
|
|
}}
|
|
<q-space />
|
|
<q-btn
|
|
color="blue"
|
|
flat
|
|
round
|
|
icon="mdi-content-save-outline"
|
|
@click="clickSave"
|
|
v-if="status == 'checkRegister' || status == 'payment'"
|
|
class="q-mr-sm bg-blue-1"
|
|
outline
|
|
>
|
|
<q-tooltip>บันทึกข้อมูล</q-tooltip>
|
|
</q-btn>
|
|
<!-- <q-btn
|
|
color="primary"
|
|
flat
|
|
round
|
|
icon="check"
|
|
class="bg-teal-1"
|
|
@click="modalCheck"
|
|
v-if="status == 'checkRegister'"
|
|
>
|
|
<q-tooltip>ตรวจสอบข้อมูล</q-tooltip>
|
|
</q-btn> -->
|
|
<q-btn
|
|
color="red"
|
|
flat
|
|
round
|
|
icon="refresh"
|
|
class="bg-red-1"
|
|
@click="modalReverse"
|
|
v-if="status == 'payment'"
|
|
>
|
|
<q-tooltip>ย้อนกลับให้เจ้าหน้าที่ตรวจสอบ</q-tooltip>
|
|
</q-btn>
|
|
<!-- || status == 'checkSeat' -->
|
|
</div>
|
|
<q-card class="q-pa-md">
|
|
<div>
|
|
<Profile
|
|
:status="status"
|
|
v-model:formInformation="formInformation"
|
|
v-model:formAddress="formAddress"
|
|
v-model:formOccupation="formOccupation"
|
|
v-model:formContact="formContact"
|
|
v-model:formEducation="formEducation"
|
|
/>
|
|
</div>
|
|
<!-- v-model:formFamily="formFamily" -->
|
|
</q-card>
|
|
<q-dialog :model-value="modal" persistent>
|
|
<q-card style="min-width: 700px">
|
|
<q-form ref="myForm">
|
|
<div class="row items-center q-pa-sm">
|
|
<div class="row">
|
|
<div class="text-bold">ตรวจสอบคุณสมบัติ</div>
|
|
</div>
|
|
<q-space />
|
|
<q-btn
|
|
icon="close"
|
|
unelevated
|
|
round
|
|
dense
|
|
style="color: #ff8080; background-color: #ffdede"
|
|
size="12px"
|
|
@click="close"
|
|
/>
|
|
</div>
|
|
<q-separator />
|
|
<!-- header บน table มี ค้นหา แสดงคอลัมน์ (status nornmalData true) -->
|
|
<div class="col-12 row q-pa-md">
|
|
<q-radio
|
|
v-model="approve"
|
|
checked-icon="task_alt"
|
|
unchecked-icon="panorama_fish_eye"
|
|
val="1"
|
|
label="ผ่านการตรวจสอบคุณสมบัติ/กดรับใบสมัคร"
|
|
class="col-12"
|
|
@update:modelValue="reason = ''"
|
|
/>
|
|
<q-radio
|
|
v-model="approve"
|
|
checked-icon="task_alt"
|
|
unchecked-icon="panorama_fish_eye"
|
|
val="2"
|
|
label="ไม่ผ่านการตรวจสอบคุณสมบัติ(ผู้สมัครแก้ข้อมูลสมัคร)"
|
|
class="col-12"
|
|
/>
|
|
<q-radio
|
|
v-model="approve"
|
|
checked-icon="task_alt"
|
|
unchecked-icon="panorama_fish_eye"
|
|
val="3"
|
|
label="ไม่ผ่านการตรวจสอบคุณสมบัติ"
|
|
class="col-12"
|
|
/>
|
|
<q-input
|
|
class="col-12 q-px-sm q-pt-sm"
|
|
outlined
|
|
stack-label
|
|
v-model="reason"
|
|
label="หมายเหตุ"
|
|
lazy-rules
|
|
autofocus
|
|
hide-bottom-space
|
|
v-if="approve == '2' || approve == '3'"
|
|
type="textarea"
|
|
></q-input>
|
|
</div>
|
|
<q-separator />
|
|
<q-card-actions align="right" class="bg-white text-teal">
|
|
<q-btn
|
|
flat
|
|
round
|
|
color="public"
|
|
@click="checkSave"
|
|
icon="mdi-content-save-outline"
|
|
>
|
|
<q-tooltip>บันทึกตรวจสอบ</q-tooltip>
|
|
</q-btn>
|
|
</q-card-actions>
|
|
</q-form>
|
|
</q-card>
|
|
</q-dialog>
|
|
|
|
<q-dialog :model-value="modalReverseOfficer" persistent>
|
|
<q-card style="min-width: 700px">
|
|
<q-form ref="myForm">
|
|
<div class="row items-center q-pa-sm">
|
|
<div class="row">
|
|
<div class="text-bold">ย้อนกลับให้เจ้าหน้าที่ตรวจสอบ</div>
|
|
</div>
|
|
<q-space />
|
|
<q-btn
|
|
icon="close"
|
|
unelevated
|
|
round
|
|
dense
|
|
style="color: #ff8080; background-color: #ffdede"
|
|
size="12px"
|
|
@click="closeReverse"
|
|
/>
|
|
</div>
|
|
<q-separator />
|
|
<!-- header บน table มี ค้นหา แสดงคอลัมน์ (status nornmalData true) -->
|
|
<div class="col-12 row q-pa-md">
|
|
<q-input
|
|
class="col-12 q-px-sm q-pt-sm"
|
|
outlined
|
|
stack-label
|
|
v-model="reason"
|
|
label="หมายเหตุ"
|
|
lazy-rules
|
|
autofocus
|
|
hide-bottom-space
|
|
type="textarea"
|
|
></q-input>
|
|
</div>
|
|
<q-separator />
|
|
<q-card-actions align="right" class="bg-white text-teal">
|
|
<q-btn
|
|
flat
|
|
round
|
|
color="public"
|
|
@click="checkSaveReverse"
|
|
icon="mdi-content-save-outline"
|
|
>
|
|
<q-tooltip>บันทึกตรวจสอบ</q-tooltip>
|
|
</q-btn>
|
|
</q-card-actions>
|
|
</q-form>
|
|
</q-card>
|
|
</q-dialog>
|
|
</template>
|
|
|
|
<style lang="scss" scoped></style>
|