diff --git a/src/api/02_organizational/api.organization.ts b/src/api/02_organizational/api.organization.ts index 3afda0fb6..009e34bad 100644 --- a/src/api/02_organizational/api.organization.ts +++ b/src/api/02_organizational/api.organization.ts @@ -86,5 +86,5 @@ export default { orgProfileEmp: `${orgEmployeePos}/profile`, orgSearchProfileEmp: `${orgProfile}-employee/search`, - orgProfileById:(id:string)=>`${orgProfile}/${id}` + orgProfileById:(id:string,type:string)=>`${orgProfile}${type}/${id}` }; diff --git a/src/components/Dialogs/PopupPersonalNew.vue b/src/components/Dialogs/PopupPersonalNew.vue index 0b6a235e5..aa137758e 100644 --- a/src/components/Dialogs/PopupPersonalNew.vue +++ b/src/components/Dialogs/PopupPersonalNew.vue @@ -3,7 +3,7 @@ import { ref, reactive, watch, onMounted } from "vue"; import { useQuasar } from "quasar"; import http from "@/plugins/http"; import config from "@/app.config"; -import { useRouter } from "vue-router"; +import { useRouter,useRoute } from "vue-router"; /** importType*/ import type { PersonalImformation } from "@/components/information/interface/response/Information"; @@ -14,13 +14,16 @@ import type { Avatar } from "@/components/information/interface/response/avatar" import { useCounterMixin } from "@/stores/mixin"; /** use*/ +const route = useRoute() const mixin = useCounterMixin(); const router = useRouter(); const $q = useQuasar(); const retireDate = ref(); const { showLoader, hideLoader, messageError, date2Thai } = mixin; const fileName = ref(""); - +const empType = ref( + route.name !== "appoint-employee-detail" ? "" : "-employee" +); /** props*/ const props = defineProps({ id: { @@ -101,7 +104,7 @@ function calculateAge(birthDate: Date | null) { async function fetchInformation(id: string) { showLoader(); await http - .get(config.API.orgProfileById(id)) + .get(config.API.orgProfileById(id,empType.value)) .then((res) => { const data = res.data.result; imformation.prefix = data.prefix ? data.prefix : "-"; @@ -115,6 +118,11 @@ async function fetchInformation(id: string) { avatar.fullname = `${data.prefix}${data.firstName} ${data.lastName}`; avatar.position = data.position ? data.position : "-"; + if(data.avatarName){ + fetchProfile(data.id as string) + }else{ + statusLoad.value.val = true; + } }) .catch((err) => { messageError($q, err); @@ -132,7 +140,7 @@ async function fetchInformation(id: string) { async function fetchProfileGov(id: string) { showLoader(); await http - .get(config.API.profileNewGovernmentById(id, "")) + .get(config.API.profileNewGovernmentById(id, empType.value)) .then((res) => { const data = res.data.result; goverment.oc = data.org !== "" ? data.org : "-"; @@ -179,7 +187,7 @@ watch( fetchInformation(props.id); fetchProfileGov(props.id); fileName.value = `profile-${props.id}`; - fetchProfile(props.id as string); + // fetchProfile(props.id as string); } } } diff --git a/src/modules/05_placement/components/AppointEmployee/Detail.vue b/src/modules/05_placement/components/AppointEmployee/Detail.vue index d5a9e4532..8a037e626 100644 --- a/src/modules/05_placement/components/AppointEmployee/Detail.vue +++ b/src/modules/05_placement/components/AppointEmployee/Detail.vue @@ -72,8 +72,8 @@ const fecthappointmentByid = async () => { const data = res.data.result; appointment.value = data; profileId.value = data.profileId; - title.value.fullname = `${data.prefix}${data.firstname ?? "-"} ${ - data.lastname ?? "-" + title.value.fullname = `${data.prefix}${data.firstName ?? "-"} ${ + data.lastName ?? "-" }`; title.value.organizationPositionOld = data.organizationPositionOld ?? "-"; title.value.positionLevelOld = data.positionLevelOld ?? "-"; diff --git a/src/modules/05_placement/interface/response/AppointMent.ts b/src/modules/05_placement/interface/response/AppointMent.ts index 270156317..2bd429369 100644 --- a/src/modules/05_placement/interface/response/AppointMent.ts +++ b/src/modules/05_placement/interface/response/AppointMent.ts @@ -92,8 +92,8 @@ interface ResponseData { citizenId: string; profileId: string; prefix: string; - firstname: string; - lastname: string; + firstName: string; + lastName: string; organizationPositionOld: string; positionLevelOld: string; positionTypeOld: string;