diff --git a/src/api/exam/api.metadata.ts b/src/api/exam/api.metadata.ts index 8f35838..780d9f2 100644 --- a/src/api/exam/api.metadata.ts +++ b/src/api/exam/api.metadata.ts @@ -4,6 +4,9 @@ const prefix = `${env.API_URI}/prefix/` const religion = `${env.API_URI}/religion/` const relationship = `${env.API_URI}/relationship/` const educationLevel = `${env.API_URI}/education-level/` +const province = `${env.API_URI}/province/`; +const district = `${env.API_URI}/district/`; +const subDistrict = `${env.API_URI}/sub-district/`; export default { countDashbordSubHistory: (type: number) => `${dashbord}${type}`, @@ -11,5 +14,8 @@ export default { prefix, religion, relationship, - educationLevel + educationLevel, + province, + listDistrict: (id: string) => `${district}${id}`, + listSubDistrict: (id: string) => `${subDistrict}${id}`, } diff --git a/src/modules/01_exam/components/ExamPayment.vue b/src/modules/01_exam/components/ExamPayment.vue index 70b6aa9..b3d7808 100644 --- a/src/modules/01_exam/components/ExamPayment.vue +++ b/src/modules/01_exam/components/ExamPayment.vue @@ -21,7 +21,7 @@
- ***ถ้าต้องการเเก้ไขหลักฐานการโอนเงินกรุณาอัพโหลดซ้ำ*** + ***ถ้าต้องการเเก้ไขหลักฐานการโอนเงินกรุณาอัปโหลดซ้ำ***
Re diff --git a/src/modules/01_exam/components/Form/Profile/Address.vue b/src/modules/01_exam/components/Form/Profile/Address.vue index 2282e68..b4e9ff5 100644 --- a/src/modules/01_exam/components/Form/Profile/Address.vue +++ b/src/modules/01_exam/components/Form/Profile/Address.vue @@ -100,7 +100,7 @@ lazy-rules readonly borderless - v-model="addressData.code" + v-model="codep" :style="!edit ? '' : 'padding:0 12px;'" :label="`${'รหัสไปรษณีย์'}`" /> @@ -212,7 +212,7 @@ lazy-rules readonly borderless - v-model="addressData.codeC" + v-model="codec" :style="!edit ? '' : 'padding:0 12px;'" :label="`${'รหัสไปรษณีย์'}`" /> @@ -273,9 +273,9 @@ const props = defineProps({ const emit = defineEmits(['update:statusEdit']) onMounted(() => { - // fetchProvince() - // fetchDistrict(addressData.value.provinceId, '1') - // fetchDistrict(addressData.value.provinceIdC, '2') + fetchProvince() + fetchDistrict(addressData.value.provinceId, '1') + fetchDistrict(addressData.value.provinceIdC, '2') }) const saveData = async () => { @@ -349,72 +349,72 @@ const selectSubDistrict = (e: string, name: string) => { } const fetchProvince = async () => { - // // loader.value = true; - // await http - // .get(config.API.province) - // .then((res) => { - // const data = res.data.result - // let option: DataOption[] = [] - // // console.log(data); - // data.map((r: any) => { - // option.push({ id: r.id.toString(), name: r.name.toString() }) - // }) - // provinceOptions.value = option - // }) - // .catch((e: any) => {}) - // .finally(() => { - // // loader.value = false; - // }) + // loader.value = true; + await http + .get(config.API.province) + .then((res) => { + const data = res.data.result + let option: DataOption[] = [] + // console.log(data); + data.map((r: any) => { + option.push({ id: r.id.toString(), name: r.name.toString() }) + }) + provinceOptions.value = option + }) + .catch((e: any) => {}) + .finally(() => { + // loader.value = false; + }) } const fetchDistrict = async (id: string, position: string) => { - // // loader.value = true; - // await http - // .get(config.API.listDistrict(id)) - // .then((res) => { - // const data = res.data.result - // let option: DataOption[] = [] - // // console.log(data); - // data.map((r: any) => { - // option.push({ id: r.id.toString(), name: r.name.toString() }) - // }) - // if (position == '1') { - // districtOptions.value = option - // } else { - // districtCOptions.value = option - // } - // }) - // .catch((e: any) => {}) - // .finally(() => { - // // loader.value = false; - // }) + // loader.value = true; + await http + .get(config.API.listDistrict(id)) + .then((res) => { + const data = res.data.result + let option: DataOption[] = [] + // console.log(data); + data.map((r: any) => { + option.push({ id: r.id.toString(), name: r.name.toString() }) + }) + if (position == '1') { + districtOptions.value = option + } else { + districtCOptions.value = option + } + }) + .catch((e: any) => {}) + .finally(() => { + // loader.value = false; + }) } const fetchSubDistrict = async (id: string, position: string) => { - // // loader.value = true; - // await http - // .get(config.API.listSubDistrict(id)) - // .then((res) => { - // const data = res.data.result - // let option: zipCodeOption[] = [] - // // console.log(res); - // data.map((r: any) => { - // option.push({ - // id: r.id.toString(), - // name: r.name.toString(), - // zipCode: r.zipCode.toString() - // }) - // }) - // if (position == '1') { - // subdistrictOptions.value = option - // } else { - // subdistrictCOptions.value = option - // } - // }) - // .catch((e: any) => {}) - // .finally(() => { - // // loader.value = false; - // }) + // loader.value = true; + await http + .get(config.API.listSubDistrict(id)) + .then((res) => { + const data = res.data.result + let option: zipCodeOption[] = [] + // console.log(res); + data.map((r: any) => { + option.push({ + id: r.id.toString(), + name: r.name.toString(), + zipCode: r.zipCode.toString() + }) + }) + if (position == '1') { + subdistrictOptions.value = option + } else { + subdistrictCOptions.value = option + } + }) + .catch((e: any) => {}) + .finally(() => { + // loader.value = false; + }) } const consenClose = () => { diff --git a/src/modules/01_exam/components/Form/Profile/Information.vue b/src/modules/01_exam/components/Form/Profile/Information.vue index 75fb332..715dac0 100644 --- a/src/modules/01_exam/components/Form/Profile/Information.vue +++ b/src/modules/01_exam/components/Form/Profile/Information.vue @@ -206,7 +206,7 @@ :outlined="edit" dense lazy-rules - v-model="informaData.provinceId" + v-model="province" emit-value map-options option-label="name" @@ -358,8 +358,8 @@ const mixin = useCounterMixin() const store = useExamDataStore() const { date2Thai, calAge } = mixin const prefix = ref() +const province = ref() const relationship = ref() - const prefixOptions = ref([]) const relationshipOptions = ref([]) @@ -412,11 +412,17 @@ const props = defineProps({ const emit = defineEmits(['update:statusEdit']) -onMounted(() => { - // fetchProvince() - fetchprefix() - fetchrelationship() +onMounted(async () => { + await fetchData() + await fetchprefix() + await fetchrelationship() + await fetchProvince() }) +const fetchData = () => { + prefix.value = 'e4e6a4f8-39c6-467f-bd84-7650d105fc4c' + relationship.value = '02fbc0e3-1da0-45b5-90da-783d344b5896' + province.value = '02fbc0e3-1da0-45b5-90da-783d344b5896' +} const saveData = async () => { if (store.consend == true) { @@ -446,22 +452,22 @@ const changeBtn = async () => { } const fetchProvince = async () => { - // // loader.value = true; - // await http - // .get(config.API.province) - // .then((res) => { - // const data = res.data.result - // let option: DataOption[] = [] - // // console.log(data); - // data.map((r: any) => { - // option.push({ id: r.id.toString(), name: r.name.toString() }) - // }) - // provinceOptions.value = option - // }) - // .catch((e: any) => {}) - // .finally(() => { - // // loader.value = false; - // }) + // loader.value = true; + await http + .get(config.API.province) + .then((res) => { + const data = res.data.result + let option: DataOption[] = [] + // console.log(data); + data.map((r: any) => { + option.push({ id: r.id.toString(), name: r.name.toString() }) + }) + provinceOptions.value = option + }) + .catch((e: any) => {}) + .finally(() => { + // loader.value = false; + }) } const fetchprefix = async () => { // loader.value = true;