diff --git a/src/api/05_placement/api.placement.ts b/src/api/05_placement/api.placement.ts index bd9f76127..9ab8a9ba1 100644 --- a/src/api/05_placement/api.placement.ts +++ b/src/api/05_placement/api.placement.ts @@ -3,4 +3,34 @@ */ import env from "../index"; -export default {}; +const placement = `${env.API_PLACEMENT_URI}/Placement/placement/`; + +export default { + //personal + placementPersonalId: (personalId: string) => + `${placement}personal/${personalId}`, + + //personal + placementPropertyId: (personalId: string) => + `${placement}property/${personalId}`, + + //information + placementInformationId: (personalId: string) => + `${placement}information/${personalId}`, + + //address + placementAddressId: (personalId: string) => + `${placement}address/${personalId}`, + + //family + placementFamilyId: (personalId: string) => `${placement}family/${personalId}`, + + //certificate + placementCertId: (personalId: string) => + `${placement}certificate/${personalId}`, + placementCertDetailId: (personalId: string, certificateId: string) => + `${placement}certificate/${personalId}/${certificateId}`, + + //education + placementEducationId: (id: string) => `${placement}education/${id}`, +}; diff --git a/src/api/index.ts b/src/api/index.ts index 3c47b1430..857d2e33d 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -18,6 +18,7 @@ const config = ref({ API_CANDIDATE_URI: "https://bma-ehr.frappet.synology.me/api/v1", // API_REPORT_URI: "https://localhost:7187/api/v1", API_REPORT_URI: "https://bma-ehr.frappet.synology.me/api/v1", + API_PLACEMENT_URI: "https://localhost:7260/api", MEET_URI: "meet.frappet.com", }, test: { @@ -49,6 +50,9 @@ const MEET_URI = ref(config.value[env.value].MEET_URI); const API_URI_PROFILE_SERVICE = ref( config.value[env.value].API_URI_PROFILE_SERVICE ); +const API_PLACEMENT_URI = ref( + config.value[env.value].API_PLACEMENT_URI +); export default { env: env.value, @@ -58,5 +62,6 @@ export default { API_REPORT_URI: API_REPORT_URI.value, API_URI_ORG_SERVICE: API_URI_ORG_SERVICE.value, API_URI_PROFILE_SERVICE: API_URI_PROFILE_SERVICE.value, + API_PLACEMENT_URI: API_PLACEMENT_URI.value, MEET_URI: MEET_URI.value, }; diff --git a/src/modules/05_placement/components/PersonalDetail/Detail.vue b/src/modules/05_placement/components/PersonalDetail/Detail.vue index c105e003c..f757ecc6d 100644 --- a/src/modules/05_placement/components/PersonalDetail/Detail.vue +++ b/src/modules/05_placement/components/PersonalDetail/Detail.vue @@ -3,89 +3,330 @@ import { onMounted, reactive, ref } from "vue"; import { useDataStore } from "@/stores/data"; import { useRoute, useRouter } from "vue-router"; -const router = useRouter(); -import Informationvue from "@/modules/05_placement/components/PersonalDetail/Information/layout.vue"; +import { useCounterMixin } from "@/stores/mixin"; +import { useQuasar } from "quasar"; + +import http from "@/plugins/http"; +import config from "@/app.config"; + +import Informationvue from "@/modules/05_placement/components/PersonalDetail/Information/Information.vue"; +import Addressvue from "@/modules/05_placement/components/PersonalDetail/Information/Address.vue"; import EducationVue from "@/modules/05_placement/components/PersonalDetail/Education.vue"; import Certicate from "@/modules/05_placement/components/PersonalDetail/Information/Certicate.vue"; import ExamResult from "@/modules/05_placement/components/PersonalDetail/ExamResult.vue"; import Qualification from "@/modules/05_placement/components/PersonalDetail/Qualification.vue"; -import Family from "@/modules/05_placement/components/PersonalDetail/Information/Family.vue"; +import Familyvue from "@/modules/05_placement/components/PersonalDetail/Information/Family.vue"; +import type { + Property, + PointExam, + Education, + Family, + Address, +} from "@/modules/05_placement/interface/index/Main.ts"; + +import type { Information } from "@/modules/05_placement/components/PersonalDetail/profileType"; + +const $q = useQuasar(); // show dialog +const router = useRouter(); const store = useDataStore(); +const mixin = useCounterMixin(); //เรียกฟังก์ชันกลาง +const { showLoader, hideLoader, messageError } = mixin; const { changeTab } = store; const statusEdit = ref(false); const profileType = ref(""); const route = useRoute(); -const examId = ref(route.params.personalId.toString()); +const examId = ref( + route.params.personalId ? route.params.personalId.toString() : "" +); -const FormData = reactive({ - fullName: examId, +const ExamDataDefualt: PointExam = { + pointA: 0, + pointB: 0, + pointC: 0, + pointTotalA: 0, + pointTotalB: 0, + pointTotalC: 0, + point: 0, + pointTotal: 0, + examNumber: 0, + examRound: 0, + pass: "", +}; + +const InformationDataDefualt: Information = { + idCard: "", + prefix: "", + prefixId: "", + fullName: "", + firstname: "", + lastname: "", + nationality: "", + race: "", + dateOfBirth: new Date(), + age: "", + telephone: "", + gender: "", + genderId: "", + relationship: "", + relationshipId: "", + bloodGroup: "", + bloodGroupId: "", + religion: "", + religionId: "", +}; + +const FamilyDataDefualt: Family = { + couple: false, + marryPrefix: "", + marryPrefixId: "", + marryFirstName: "", + marryLastName: "", + marryOccupation: "", + fatherPrefix: "", + fatherPrefixId: "", + fatherFirstName: "", + fatherLastName: "", + fatherOccupation: "", + motherPrefix: "", + motherPrefixId: "", + motherFirstName: "", + motherLastName: "", + motherOccupation: "", +}; + +const AddressDataDefualt: Address = { + registSubDistrict: "", + registSubDistrictId: "", + registZipCode: "", + registDistrict: "", + registDistrictId: "", + registProvince: "", + registProvinceId: "", + currentSubDistrict: "", + currentSubDistrictId: "", + currentZipCode: "", + currentDistrict: "", + currentDistrictId: "", + currentProvince: "", + currentProvinceId: "", + registSame: false, +}; + +const personalData = ref({ + id: "", + fullName: "", }); +const QualificationData = ref([]); +const ExamData = ref(ExamDataDefualt); +const InformationData = ref(InformationDataDefualt); +const EducationData = ref([]); +const FamilyData = ref(FamilyDataDefualt); +const AddressData = ref
(AddressDataDefualt); onMounted(async () => { - // await checkProfileData(); - // await fetchData(); - await changeTab("information"); + // await checkProfileData(); + await fetchData(); + await changeTab("information"); }); +const fetchData = async () => { + showLoader(); + await http + .get(config.API.placementPersonalId(examId.value)) + .then((res: any) => { + const data = res.data.result; + // data.value = data; + console.log(data); + personalData.value.fullName = data.fullName; + personalData.value.id = data.personalId; + + InformationData.value.idCard = data.idCard; + InformationData.value.fullName = data.fullName; + InformationData.value.firstname = data.firstname; + InformationData.value.lastname = data.lastname; + InformationData.value.nationality = data.nationality; + InformationData.value.race = data.race; + InformationData.value.genderId = data.genderId; + InformationData.value.prefixId = data.prefixId; + InformationData.value.relationshipId = data.relationshipId; + InformationData.value.religionId = data.religionId; + InformationData.value.bloodGroupId = data.bloodGroupId; + InformationData.value.dateOfBirth = new Date(data.dateOfBirth); + InformationData.value.age = data.age; + InformationData.value.telephone = data.telephone; + + AddressData.value.registSame = data.registSame ?? false; + AddressData.value.registSubDistrict = data.registSubDistrict ?? ""; + AddressData.value.registSubDistrictId = data.registSubDistrictId ?? ""; + AddressData.value.registZipCode = data.registZipCode ?? ""; + AddressData.value.registDistrict = data.registDistrict ?? ""; + AddressData.value.registDistrictId = data.registDistrictId ?? ""; + AddressData.value.registProvince = data.registProvince ?? ""; + AddressData.value.registProvinceId = data.registProvinceId ?? ""; + AddressData.value.currentSubDistrict = data.currentSubDistrict ?? ""; + AddressData.value.currentSubDistrictId = data.currentSubDistrictId ?? ""; + AddressData.value.currentZipCode = data.currentZipCode ?? ""; + AddressData.value.currentDistrict = data.currentDistrict ?? ""; + AddressData.value.currentDistrictId = data.currentDistrictId ?? ""; + AddressData.value.currentProvince = data.currentProvince ?? ""; + AddressData.value.currentProvinceId = data.currentProvinceId ?? ""; + + FamilyData.value.couple = data.couple ?? false; + FamilyData.value.marryPrefix = data.marryPrefix ?? ""; + FamilyData.value.marryPrefixId = data.marryPrefixId ?? ""; + FamilyData.value.marryFirstName = data.marryFirstName ?? ""; + FamilyData.value.marryLastName = data.marryLastName ?? ""; + FamilyData.value.marryOccupation = data.marryOccupation ?? ""; + FamilyData.value.fatherPrefix = data.fatherPrefix ?? ""; + FamilyData.value.fatherPrefixId = data.fatherPrefixId ?? ""; + FamilyData.value.fatherFirstName = data.fatherFirstName ?? ""; + FamilyData.value.fatherLastName = data.fatherLastName ?? ""; + FamilyData.value.fatherOccupation = data.fatherOccupation ?? ""; + FamilyData.value.motherPrefix = data.motherPrefix ?? ""; + FamilyData.value.motherPrefixId = data.motherPrefixId ?? ""; + FamilyData.value.motherFirstName = data.motherFirstName ?? ""; + FamilyData.value.motherLastName = data.motherLastName ?? ""; + FamilyData.value.motherOccupation = data.motherOccupation ?? ""; + + ExamData.value.pointA = data.pointA; + ExamData.value.pointB = data.pointB; + ExamData.value.pointC = data.pointC; + ExamData.value.point = data.point; + ExamData.value.pointTotalA = data.pointTotalA; + ExamData.value.pointTotalB = data.pointTotalB; + ExamData.value.pointTotalC = data.pointTotalC; + ExamData.value.pointTotal = data.pointTotal; + ExamData.value.examNumber = data.examNumber; + ExamData.value.examRound = data.examRound; + ExamData.value.pass = data.pass; + + QualificationData.value = data.isProperty; + + let listRow: Education[] = []; + data.education.map((row: any) => { + listRow.push({ + id: row.id ?? "", + educationLevel: row.educationLevel ?? "", + institute: row.institute ?? "", + degree: row.degree ?? "", + field: row.field ?? "", + gpa: row.gpa ?? "", + country: row.country ?? "", + duration: row.duration ?? "", + other: row.other ?? "", + fundName: row.fundName ?? "", + durationYear: row.durationYear ?? 0, + finishDate: row.finishDate ?? new Date(), + isDate: row.isDate ?? "", + startDate: row.startDate ?? 0, + endDate: row.endDate ?? 0, + positionPath: row.positionPath ?? "", + isEducation: row.isEducation ?? "", + }); + }); + EducationData.value = listRow; + }) + .catch((e: any) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); +}; \ No newline at end of file + diff --git a/src/modules/05_placement/components/PersonalDetail/Education.vue b/src/modules/05_placement/components/PersonalDetail/Education.vue index 37c25205a..8c504a8c0 100644 --- a/src/modules/05_placement/components/PersonalDetail/Education.vue +++ b/src/modules/05_placement/components/PersonalDetail/Education.vue @@ -13,18 +13,30 @@ import type { DataProps, } from "@/modules/05_placement/interface/request/Education"; import type { ResponseObject } from "@/modules/05_placement/interface/response/Education"; -import type { DataOption } from "@/modules/05_placement/interface/index/Main"; import HistoryTable from "@/components/TableHistory.vue"; import http from "@/plugins/http"; import config from "@/app.config"; -import type { EduOps } from "@/modules/05_placement/interface/index/Main"; +import type { + EduOps, + Education, + DataOption, +} from "@/modules/05_placement/interface/index/Main"; import type { QTableProps } from "quasar"; +import type { PropType } from "vue"; const props = defineProps({ statusEdit: { type: Boolean, required: true, }, + fetch: { + type: Function, + default: () => console.log("not function"), + }, + data: { + type: Array as PropType, + default: [], + }, }); const $q = useQuasar(); @@ -74,9 +86,9 @@ const tittleHistory = ref("ประวัติแก้ไขประ const filterHistory = ref(""); //search data table history const modalHistory = ref(false); //modal ประวัติการแก้ไขข้อมูล const checkValidate = ref(false); //validate data ผ่านหรือไม่ -const profileId = ref(''); +const profileId = ref(""); // const profileId = ref(route.params.id.toString()); -const rows = ref([]); +const rows = ref(props.data); const filter = ref(""); //search data table const visibleColumns = ref([]); profileData.education.columns.length == 0 @@ -459,8 +471,8 @@ watch(visibleColumns, async (count: String[], prevCount: String[]) => { }); onMounted(async () => { - // await fetchLevel(); - // await fetchPositionPath(); + await fetchLevel(); + await fetchPositionPath(); // await fetchData(); }); diff --git a/src/modules/05_placement/components/PersonalDetail/ExamResult.vue b/src/modules/05_placement/components/PersonalDetail/ExamResult.vue index cbee59678..5792bcf8b 100644 --- a/src/modules/05_placement/components/PersonalDetail/ExamResult.vue +++ b/src/modules/05_placement/components/PersonalDetail/ExamResult.vue @@ -1,101 +1,137 @@ \ No newline at end of file + diff --git a/src/modules/05_placement/components/PersonalDetail/Information/Address.vue b/src/modules/05_placement/components/PersonalDetail/Information/Address.vue index bb299a3ee..623b91beb 100644 --- a/src/modules/05_placement/components/PersonalDetail/Information/Address.vue +++ b/src/modules/05_placement/components/PersonalDetail/Information/Address.vue @@ -29,6 +29,10 @@ const props = defineProps({ type: Function, default: () => console.log("not function"), }, + fetch: { + type: Function, + default: () => console.log("not function"), + }, }); const emit = defineEmits(["update:statusEdit"]); diff --git a/src/modules/05_placement/components/PersonalDetail/Information/Certicate.vue b/src/modules/05_placement/components/PersonalDetail/Information/Certicate.vue index 3082baed4..2f2186299 100644 --- a/src/modules/05_placement/components/PersonalDetail/Information/Certicate.vue +++ b/src/modules/05_placement/components/PersonalDetail/Information/Certicate.vue @@ -28,6 +28,10 @@ const props = defineProps({ type: String, required: true, }, + fetch: { + type: Function, + default: () => console.log("not function"), + }, }); const $q = useQuasar(); diff --git a/src/modules/05_placement/components/PersonalDetail/Information/Family.vue b/src/modules/05_placement/components/PersonalDetail/Information/Family.vue index dc8850be0..aac6c8f9f 100644 --- a/src/modules/05_placement/components/PersonalDetail/Information/Family.vue +++ b/src/modules/05_placement/components/PersonalDetail/Information/Family.vue @@ -27,6 +27,10 @@ const props = defineProps({ type: Function, default: () => console.log("not function"), }, + fetch: { + type: Function, + default: () => console.log("not function"), + }, }); const emit = defineEmits(["update:statusEdit"]); @@ -198,56 +202,55 @@ const fetchHistory = async () => { }; const fetchData = async () => { - familyData.value.childrens = []; // loaderPage(true); // await http // .get(config.API.profileFamiId(route.params.id.toString())) // .then((res) => { - // const data: ResponseObject = res.data.result; - // familyData.value.prefixC = ""; - // familyData.value.prefixIdC = data.couplePrefixId; - // familyData.value.firstnameC = data.coupleFirstName; - // familyData.value.lastnameC = data.coupleLastName; - // familyData.value.lastnameCOld = data.coupleLastNameOld; - // familyData.value.occupationC = data.coupleCareer; - // familyData.value.prefixM = ""; - // familyData.value.prefixIdM = data.fatherPrefixId; + // const data: ResponseObject = res.data.result; + // familyData.value.prefixC = ""; + // familyData.value.prefixIdC = data.couplePrefixId; + // familyData.value.firstnameC = data.coupleFirstName; + // familyData.value.lastnameC = data.coupleLastName; + // familyData.value.lastnameCOld = data.coupleLastNameOld; + // familyData.value.occupationC = data.coupleCareer; + // familyData.value.prefixM = ""; + // familyData.value.prefixIdM = data.fatherPrefixId; - // familyData.value.firstnameM = data.fatherFirstName; - // familyData.value.lastnameM = data.fatherLastName; - // familyData.value.occupationM = data.fatherCareer; - // familyData.value.prefixF = ""; - // familyData.value.prefixIdF = data.motherPrefixId; + // familyData.value.firstnameM = data.fatherFirstName; + // familyData.value.lastnameM = data.fatherLastName; + // familyData.value.occupationM = data.fatherCareer; + // familyData.value.prefixF = ""; + // familyData.value.prefixIdF = data.motherPrefixId; - // familyData.value.firstnameF = data.motherFirstName; - // familyData.value.lastnameF = data.motherLastName; - // familyData.value.occupationF = data.motherCareer; - // familyData.value.same = data.couple ? "1" : "0"; + // familyData.value.firstnameF = data.motherFirstName; + // familyData.value.lastnameF = data.motherLastName; + // familyData.value.occupationF = data.motherCareer; + // familyData.value.same = data.couple ? "1" : "0"; - // if (data.childrens.length > 0) { - // let dataChild: childrenFamily[] = []; - // data.childrens.map((row: childrenFamily, index: number) => { - // dataChild.push({ - // id: `${index + 1}`, - // childrenPrefixId: row.childrenPrefixId, - // childrenFirstName: row.childrenFirstName, - // childrenLastName: row.childrenLastName, - // childrenCareer: row.childrenCareer, - // }); - // }); - // familyData.value.childrens = dataChild; - // } else { - // familyData.value.childrens = []; - // } - // }) - // .catch((e) => { - // messageError($q, e); - // }) - // .finally(async () => { - // loaderPage(false); - // }); + // if (data.childrens.length > 0) { + // let dataChild: childrenFamily[] = []; + // data.childrens.map((row: childrenFamily, index: number) => { + // dataChild.push({ + // id: `${index + 1}`, + // childrenPrefixId: row.childrenPrefixId, + // childrenFirstName: row.childrenFirstName, + // childrenLastName: row.childrenLastName, + // childrenCareer: row.childrenCareer, + // }); + // }); + // familyData.value.childrens = dataChild; + // } else { + // familyData.value.childrens = []; + // } + // }) + // .catch((e) => { + // messageError($q, e); + // }) + // .finally(async () => { + // loaderPage(false); + // }); }; const editData = async () => { @@ -1094,6 +1097,6 @@ const getClass = (val: boolean) => { \ No newline at end of file + diff --git a/src/modules/05_placement/components/PersonalDetail/Information/Information.vue b/src/modules/05_placement/components/PersonalDetail/Information/Information.vue index a2e99b4a9..7442b06a4 100644 --- a/src/modules/05_placement/components/PersonalDetail/Information/Information.vue +++ b/src/modules/05_placement/components/PersonalDetail/Information/Information.vue @@ -2,26 +2,23 @@ diff --git a/src/modules/05_placement/components/PersonalDetail/Qualification.vue b/src/modules/05_placement/components/PersonalDetail/Qualification.vue index 778ad5c4d..6ba5f8f09 100644 --- a/src/modules/05_placement/components/PersonalDetail/Qualification.vue +++ b/src/modules/05_placement/components/PersonalDetail/Qualification.vue @@ -1,46 +1,69 @@ \ No newline at end of file + diff --git a/src/modules/05_placement/components/PersonalDetail/profileType.ts b/src/modules/05_placement/components/PersonalDetail/profileType.ts index 9ba368651..1e8e1ee75 100644 --- a/src/modules/05_placement/components/PersonalDetail/profileType.ts +++ b/src/modules/05_placement/components/PersonalDetail/profileType.ts @@ -8,23 +8,25 @@ interface ChangeActive { //ข้อมูลส่วนตัว interface Information { - cardid: string | null; + idCard: string | null; prefix: string | null; - age: string | null; prefixId: string | null; + fullName: string | null; firstname: string | null; lastname: string | null; - birthDate: Date; - genderId: string | null; - bloodId: string | null; nationality: string | null; - ethnicity: string | null; - statusId: string | null; + race: string | null; + dateOfBirth: Date | null; + age: string | null; + telephone: string | null; + gender: string | null; + genderId: string | null; + relationship: string | null; + relationshipId: string | null; + bloodGroup: string | null; + bloodGroupId: string | null; + religion: string | null; religionId: string | null; - tel: string | null; - employeeType: string | null; - employeeClass: string | null; - profileType: string | null; } interface Family { @@ -119,23 +121,25 @@ const defaultAddress: Address = { }; const defaultInformation: Information = { - cardid: null, - age: null, + idCard: null, prefix: null, prefixId: null, + fullName: null, firstname: null, lastname: null, - birthDate: new Date(), - genderId: null, - bloodId: null, nationality: null, - ethnicity: null, - statusId: null, + race: null, + dateOfBirth: new Date(), + age: null, + telephone: null, + gender: null, + genderId: null, + relationship: null, + relationshipId: null, + bloodGroup: null, + bloodGroupId: null, + religion: null, religionId: null, - tel: null, - employeeType: null, - employeeClass: null, - profileType: null, }; const defaultFamily: Family = { diff --git a/src/modules/05_placement/components/pass/Table.vue b/src/modules/05_placement/components/pass/Table.vue index e4cbf2fdd..ab390e580 100644 --- a/src/modules/05_placement/components/pass/Table.vue +++ b/src/modules/05_placement/components/pass/Table.vue @@ -164,7 +164,7 @@ const fetchPosition = async () => { }); // positionLevelOptionsFilter.value = optionPositionLevels; }) - .catch((e: any) => { }) + .catch((e: any) => {}) .finally(() => { hideLoader(); }); @@ -300,7 +300,7 @@ const selectData = (props: TableName) => { if (roleAdmin.value === true) { modal.value = true; } else { - router.push("/placement/detail/08db7322-5712-4626-8a76-e2d28cd1a13b"); + router.push("/placement/detail/0a846508-4932-40de-9a9e-5b519492217c"); } }; const onSelected = async (id: string) => { @@ -356,15 +356,15 @@ const editDetail = ( }; placementData.mappingPosition.columns.length == 0 ? (visibleColumns.value = [ - "position", - "Name", - "ExamOrder", - "Unit", - "ReportingDate", - "BMAOfficer", - "Status", - "checkList", - ]) + "position", + "Name", + "ExamOrder", + "Unit", + "ReportingDate", + "BMAOfficer", + "Status", + "checkList", + ]) : (visibleColumns.value = placementData.mappingPosition.columns); const columns = ref([ { @@ -1023,9 +1023,7 @@ const save = () => { onMounted(async () => { if (keycloak.tokenParsed != null) { roleAdmin.value = await keycloak.tokenParsed.role.includes("placement1"); - console.log("roleAdmin===>", roleAdmin) - - + console.log("roleAdmin===>", roleAdmin); } await fetchPosition(); @@ -1077,27 +1075,53 @@ const listKeyId = (data: any) => { const expiredAccount = ref(false); - watch(expiredAccount, () => { console.log("expiredAccount===>", expiredAccount.value); });