diff --git a/src/api/exam/api.candidate.ts b/src/api/exam/api.candidate.ts index 221d17e..525d267 100644 --- a/src/api/exam/api.candidate.ts +++ b/src/api/exam/api.candidate.ts @@ -1,5 +1,6 @@ import env from '../index' const candidate = `${env.API_URI}/candidate/` +const periodExam = `${env.API_URI}/period-exam/` export default { candidateInformation: (examId: string) => `${candidate}information/${examId}`, @@ -12,5 +13,6 @@ export default { candidateRegister: (examId: string) => `${candidate}register/${examId}`, candidatePayment: (examId: string) => `${candidate}payment/${examId}`, candidateStatus: (examId: string) => `${candidate}status/${examId}`, + periodExamId: (examId: string) => `${periodExam}${examId}`, candidate } diff --git a/src/modules/01_exam/components/ExamForm.vue b/src/modules/01_exam/components/ExamForm.vue index caae140..fde20a3 100644 --- a/src/modules/01_exam/components/ExamForm.vue +++ b/src/modules/01_exam/components/ExamForm.vue @@ -106,6 +106,7 @@ import Profile from '@/modules/01_exam/components/Form/Profile.vue' import Education from '@/modules/01_exam/components/Form/Education.vue' import Career from '@/modules/01_exam/components/Form/Career.vue' import Document from '@/modules/01_exam/components/Form/Document.vue' +import { useRoute } from 'vue-router' const props = defineProps({ fetchStep: { @@ -126,7 +127,8 @@ const { modalConfirm, modalError, success } = mixin const loader = ref(false) const statusEdit = ref(false) const acceptTermOfUse = ref(false) -const candidateId = ref('2223ba53-2fb2-470b-8dc1-27e5471b0331') +const route = useRoute() +const examId = ref(route.params.id.toString()) onMounted(async () => { if (props.status !== 'register') { @@ -151,7 +153,7 @@ const saveForm = async () => { //saveform loader.value = true await http - .get(config.API.candidateRegister(candidateId.value)) + .get(config.API.candidateRegister(examId.value)) .then(() => { success($q, 'สมัครสอบสำเร็จสำเร็จ') }) diff --git a/src/modules/01_exam/components/ExamPayment.vue b/src/modules/01_exam/components/ExamPayment.vue index e7e4db0..4fb7c4a 100644 --- a/src/modules/01_exam/components/ExamPayment.vue +++ b/src/modules/01_exam/components/ExamPayment.vue @@ -37,6 +37,7 @@ import { useQuasar } from 'quasar' import { useCounterMixin } from '@/stores/mixin' import http from '@/plugins/http' import config from '@/app.config' +import { useRoute } from 'vue-router' const props = defineProps({ fetchStep: { @@ -56,7 +57,8 @@ const rejectMessage = ref('กรุณาจ่ายเงินให const img = ref('https://cdn-icons-png.flaticon.com/512/2496/2496846.png') const fileData = ref() const loader = ref(false) -const candidateId = ref('2223ba53-2fb2-470b-8dc1-27e5471b0331') +const route = useRoute() +const examId = ref(route.params.id.toString()) const uploadImg = (file: any) => { fileData.value = null @@ -69,7 +71,7 @@ const uploadImg = (file: any) => { const clickPayment = async () => { loader.value = true await http - .get(config.API.candidatePayment(candidateId.value)) + .get(config.API.candidatePayment(examId.value)) .then(() => { success($q, 'ส่งหลักฐานชำระเงินสำเร็จ') }) diff --git a/src/modules/01_exam/components/Form/Address.vue b/src/modules/01_exam/components/Form/Address.vue index 5d3b6ca..2c91ce6 100644 --- a/src/modules/01_exam/components/Form/Address.vue +++ b/src/modules/01_exam/components/Form/Address.vue @@ -227,6 +227,8 @@ import { useExamDataStore } from '@/modules/01_exam/store' import type { Address, DataOption } from '@/modules/01_exam/interface/index/Main' import { defaultAddress } from '@/modules/01_exam/interface/index/Main' import HeaderTop from '@/components/top.vue' +import { useRoute } from 'vue-router' + // import Conference from '@/modules/01_exam/components/Conference.vue' const props = defineProps({ @@ -252,7 +254,8 @@ const $q = useQuasar() const mixin = useCounterMixin() const store = useExamDataStore() const { success } = mixin -const candidateId = ref('2223ba53-2fb2-470b-8dc1-27e5471b0331') +const route = useRoute() +const examId = ref(route.params.id.toString()) const edit = ref(true) const addressData = ref
(defaultAddress) const myform = ref() @@ -277,7 +280,7 @@ onMounted(async () => { const fetchData = async () => { await http - .get(config.API.candidateAddress(candidateId.value)) + .get(config.API.candidateAddress(examId.value)) .then((res) => { const data = res.data.result addressData.value.address = data.registAddress @@ -304,7 +307,7 @@ const saveData = async () => { // if (store.consend == true) { loader.value = true await http - .post(config.API.candidateAddress(candidateId.value), { + .post(config.API.candidateAddress(examId.value), { registAddress: addressData.value.address, currentAddress: addressData.value.addressC, registProvinceId: addressData.value.provinceId, diff --git a/src/modules/01_exam/components/Form/Career.vue b/src/modules/01_exam/components/Form/Career.vue index a54cea9..41b8cc2 100644 --- a/src/modules/01_exam/components/Form/Career.vue +++ b/src/modules/01_exam/components/Form/Career.vue @@ -195,6 +195,7 @@ import Table from '@/components/Table.vue' import DialogHeader from '@/components/DialogHeader.vue' import DialogFooter from '@/components/DialogFooter.vue' import Conference from '@/modules/01_exam/components/Conference.vue' +import { useRoute } from 'vue-router' const props = defineProps({ loader: { @@ -209,6 +210,10 @@ const props = defineProps({ statusEdit: { type: Boolean, required: true + }, + notiNoEdit: { + type: Function, + default: () => console.log('not function') } }) @@ -236,7 +241,8 @@ const editRow = ref(false) //เช็คมีการแก้ไข const statusCode = ref() const checkValidate = ref(false) //validate data ผ่านหรือไม่ // const modalConsend = ref(false) -const candidateId = ref('2223ba53-2fb2-470b-8dc1-27e5471b0331') +const route = useRoute() +const examId = ref(route.params.id.toString()) const rows = ref([]) const filter = ref('') //search data table @@ -315,7 +321,7 @@ onMounted(async () => { const fetchData = async () => { loader.value = true await http - .get(config.API.candidateCareer(candidateId.value)) + .get(config.API.candidateCareer(examId.value)) .then((res) => { const data = res.data.result rows.value = [] @@ -452,7 +458,7 @@ const clickSave = async () => { const saveData = async () => { loader.value = true await http - .post(config.API.candidateCareer(candidateId.value), { + .post(config.API.candidateCareer(examId.value), { name: location.value, position: position.value, salary: salary.value, diff --git a/src/modules/01_exam/components/Form/Education.vue b/src/modules/01_exam/components/Form/Education.vue index 2fd082b..951eba1 100644 --- a/src/modules/01_exam/components/Form/Education.vue +++ b/src/modules/01_exam/components/Form/Education.vue @@ -197,6 +197,7 @@ import Table from '@/components/Table.vue' import DialogHeader from '@/components/DialogHeader.vue' import DialogFooter from '@/components/DialogFooter.vue' import Conference from '@/modules/01_exam/components/Conference.vue' +import { useRoute } from 'vue-router' const props = defineProps({ loader: { @@ -211,6 +212,10 @@ const props = defineProps({ statusEdit: { type: Boolean, required: true + }, + notiNoEdit: { + type: Function, + default: () => console.log('not function') } }) @@ -241,7 +246,8 @@ const statusCode = ref() const checkValidate = ref(false) //validate data ผ่านหรือไม่ // const modalConsend = ref(false) const rows = ref([]) -const candidateId = ref('2223ba53-2fb2-470b-8dc1-27e5471b0331') +const route = useRoute() +const examId = ref(route.params.id.toString()) const filter = ref('') //search data table const emit = defineEmits(['update:loader', 'update:statusEdit']) @@ -320,7 +326,7 @@ onMounted(async () => { const fetchData = async () => { loader.value = true await http - .get(config.API.candidateEducation(candidateId.value)) + .get(config.API.candidateEducation(examId.value)) .then((res) => { const data = res.data.result rows.value = [] @@ -478,7 +484,7 @@ const clickSave = async () => { const saveData = async () => { loader.value = true await http - .post(config.API.candidateEducation(candidateId.value), { + .post(config.API.candidateEducation(examId.value), { educationLevelId: educationLevelId.value, major: major.value, scores: scores.value, diff --git a/src/modules/01_exam/components/Form/Family.vue b/src/modules/01_exam/components/Form/Family.vue index 97ebf7a..3caa843 100644 --- a/src/modules/01_exam/components/Form/Family.vue +++ b/src/modules/01_exam/components/Form/Family.vue @@ -275,6 +275,7 @@ import type { Family, DataOption } from '@/modules/01_exam/interface/index/Main' import { defaultFamily } from '@/modules/01_exam/interface/index/Main' import HeaderTop from '@/components/top.vue' import Conference from '@/modules/01_exam/components/Conference.vue' +import { useRoute } from 'vue-router' const props = defineProps({ prefixOptions: { @@ -303,7 +304,8 @@ const edit = ref(true) const myform = ref() const familyData = ref(defaultFamily) // const modalConsend = ref(false) -const candidateId = ref('2223ba53-2fb2-470b-8dc1-27e5471b0331') +const route = useRoute() +const examId = ref(route.params.id.toString()) const loader = ref(false) const emit = defineEmits(['update:statusEdit']) @@ -315,7 +317,7 @@ onMounted(async () => { const fetchData = async () => { loader.value = true await http - .get(config.API.candidateFamily(candidateId.value)) + .get(config.API.candidateFamily(examId.value)) .then((res) => { const data = res.data.result familyData.value.prefixIdC = data.marryPrefixId @@ -347,7 +349,7 @@ const saveData = async () => { // if (store.consend == true) { loader.value = true await http - .post(config.API.candidateFamily(candidateId.value), { + .post(config.API.candidateFamily(examId.value), { marryPrefixId: familyData.value.prefixIdC, marryFirstName: familyData.value.firstnameC, marryLastName: familyData.value.lastnameC, diff --git a/src/modules/01_exam/components/Form/Information.vue b/src/modules/01_exam/components/Form/Information.vue index 811325f..7b267b1 100644 --- a/src/modules/01_exam/components/Form/Information.vue +++ b/src/modules/01_exam/components/Form/Information.vue @@ -369,6 +369,7 @@ import type { Information, DataOption } from '@/modules/01_exam/interface/index/ import { defaultInformation } from '@/modules/01_exam/interface/index/Main' import HeaderTop from '@/components/top.vue' import Conference from '@/modules/01_exam/components/Conference.vue' +import { useRoute } from 'vue-router' const props = defineProps({ prefixOptions: { @@ -402,7 +403,8 @@ const mixin = useCounterMixin() const store = useExamDataStore() const { date2Thai, calAge, success, dateToISO } = mixin const districtOptions = ref([]) -const candidateId = ref('2223ba53-2fb2-470b-8dc1-27e5471b0331') +const route = useRoute() +const examId = ref(route.params.id.toString()) const edit = ref(true) const informaData = ref(defaultInformation) const myform = ref() @@ -422,7 +424,7 @@ onMounted(async () => { const fetchData = async () => { loader.value = true await http - .get(config.API.candidateInformation(candidateId.value)) + .get(config.API.candidateInformation(examId.value)) .then((res) => { const data = res.data.result informaData.value.prefixId = data.prefixId @@ -458,7 +460,7 @@ const saveData = async () => { // if (store.consend == true) { loader.value = true await http - .post(config.API.candidateInformation(candidateId.value), { + .post(config.API.candidateInformation(examId.value), { prefixId: informaData.value.prefixId, lastName: informaData.value.lastname, citizenProvinceId: informaData.value.provinceId, diff --git a/src/modules/01_exam/components/Form/Occupation.vue b/src/modules/01_exam/components/Form/Occupation.vue index 22f95ed..4f83cd7 100644 --- a/src/modules/01_exam/components/Form/Occupation.vue +++ b/src/modules/01_exam/components/Form/Occupation.vue @@ -262,6 +262,7 @@ import type { Occupation } from '@/modules/01_exam/interface/index/Main' import { defaultOccupation } from '@/modules/01_exam/interface/index/Main' import HeaderTop from '@/components/top.vue' import Conference from '@/modules/01_exam/components/Conference.vue' +import { useRoute } from 'vue-router' const props = defineProps({ statusEdit: { @@ -287,7 +288,8 @@ const occupationData = ref(defaultOccupation) const myform = ref() // const modalConsend = ref(false) const loader = ref(false) -const candidateId = ref('2223ba53-2fb2-470b-8dc1-27e5471b0331') +const route = useRoute() +const examId = ref(route.params.id.toString()) const emit = defineEmits(['update:statusEdit']) @@ -298,7 +300,7 @@ onMounted(async () => { const fetchData = async () => { loader.value = true await http - .get(config.API.candidateOccupation(candidateId.value)) + .get(config.API.candidateOccupation(examId.value)) .then((res) => { const data = res.data.result occupationData.value.status = data.occupationType @@ -335,7 +337,7 @@ const saveData = async () => { if (occupationData.value.status == 'other') type.value = occupationData.value.other loader.value = true await http - .post(config.API.candidateOccupation(candidateId.value), { + .post(config.API.candidateOccupation(examId.value), { occupationType: occupationData.value.status, occupationCompany: occupationData.value.company, occupationDepartment: occupationData.value.department, diff --git a/src/modules/01_exam/views/ExamDetail.vue b/src/modules/01_exam/views/ExamDetail.vue index 1ee205c..44ac111 100644 --- a/src/modules/01_exam/views/ExamDetail.vue +++ b/src/modules/01_exam/views/ExamDetail.vue @@ -81,25 +81,28 @@ import ExamForm from '@/modules/01_exam/components/ExamForm.vue' import ExamPayment from '@/modules/01_exam/components/ExamPayment.vue' import ExamFinished from '@/modules/01_exam/components/ExamFinished.vue' import Conference from '@/modules/01_exam/components/Conference.vue' +import { useRoute } from 'vue-router' const $q = useQuasar() const store = useExamDataStore() const step = ref(1) const stepRaw = ref(1) -const tittle = ref('การสอบภาค ข. พิเศษ สำหรับผู้สอบผ่านของส่วนราชการแล้ว ทดสอบ') -const candidateId = ref('2223ba53-2fb2-470b-8dc1-27e5471b0331') +const tittle = ref('') +const route = useRoute() +const examId = ref(route.params.id.toString()) const loader = ref(false) const status = ref('register') const modalConsend = ref(false) onMounted(async () => { + await fetchPeriodExam() await candidateCheck() }) const candidateCheck = async () => { loader.value = true await http - .get(config.API.candidateCheckCreate(candidateId.value)) + .get(config.API.candidateCheckCreate(examId.value)) .then(async (res) => { const data = res.data.result store.consend = data @@ -120,7 +123,7 @@ const candidateCheck = async () => { const fetchStep = async () => { loader.value = true await http - .get(config.API.candidateStatus(candidateId.value)) + .get(config.API.candidateStatus(examId.value)) .then((res) => { const data = res.data.result status.value = data @@ -156,6 +159,20 @@ const fetchStep = async () => { }) } +const fetchPeriodExam = async () => { + loader.value = true + await http + .get(config.API.periodExamId(examId.value)) + .then((res) => { + const data = res.data.result + tittle.value = data.name + }) + .catch(() => {}) + .finally(() => { + loader.value = false + }) +} + const consenClose = () => { modalConsend.value = false } diff --git a/src/plugins/keycloak.ts b/src/plugins/keycloak.ts index dcbce19..bea4f25 100644 --- a/src/plugins/keycloak.ts +++ b/src/plugins/keycloak.ts @@ -8,11 +8,11 @@ import Keycloak from 'keycloak-js' const initOptions = { // url: "https://keycloak.frappet.synology.me/auth/", - // realm: "bma-ehr", - // clientId: "bma-ehr-vue3", - url: 'https://identity.frappet.com/', - realm: 'bma-ehr-exam', - clientId: 'bma-ehr-exam-vue3' + realm: 'bma-ehr', + clientId: 'bma-ehr-vue3', + url: 'https://identity.frappet.com/' + // realm: 'bma-ehr-exam', + // clientId: 'bma-ehr-exam-vue3' } //option keycloak ที่จะ connect const keycloak = Keycloak(initOptions)