diff --git a/src/api/02_organizational/api.organization.ts b/src/api/02_organizational/api.organization.ts index c6ec1dc18..ba8cff83d 100644 --- a/src/api/02_organizational/api.organization.ts +++ b/src/api/02_organizational/api.organization.ts @@ -94,12 +94,14 @@ export default { orgProfileEmp: `${orgEmployeePos}/profile`, orgSearchProfileEmp: `${orgProfile}-employee/search`, - orgProfileById: (id: string, type: string) => `${orgProfile}${type}/${id}`, + orgProfileById: (id: string, type: string) => + `${orgProfile}${type}/admin/${id}`, orgDeceasedProfile: `${orgPos}/profile/search`, // orgCheckAvatar: (id: string) => `${orgProfile}/avatar/profileId/${id}`, + orgCheckAvatarCard: (path: string) => `${organization}/${path}`, //noPernission changePosition: `${organization}/placement/change-position`, changePositionById: `${organization}/placement/change-position/profile-all`, diff --git a/src/api/registry/api.registry.ts b/src/api/registry/api.registry.ts index 93ce13e62..d2e3de68a 100644 --- a/src/api/registry/api.registry.ts +++ b/src/api/registry/api.registry.ts @@ -128,6 +128,8 @@ export default { `${registryNew}${type}/discipline/${disciplineId}`, profileNewDisciplineHisByDisciplineId: (disciplineId: string, type: string) => `${registryNew}${type}/discipline/history/${disciplineId}`, + disciplineListCard: (profileId: string, type: string) => + `${registryNew}${type}/discipline/admin/${profileId}`, // noPermission // ปฏิบัติราชการพิเศษ profileNewDuty: (type: string) => `${registryNew}${type}/duty`, @@ -144,6 +146,8 @@ export default { `${registryNew}${type}/government/${id}`, profileNewGovernmentHistory: (id: string, type: string) => `${registryNew}${type}/government/history/${id}`, + profileNewGovernmentCard: (id: string, type: string) => + `${registryNew}${type}/government/admin/${id}`, // noPermission //การลา profileNewLeave: (type: string) => `${registryNew}${type}/leave`, @@ -153,6 +157,8 @@ export default { `${registryNew}${type}/leave/history/${id}`, profileCheckDate: () => `${env.API_URI}/leave/user/check`, profileNewLeaveType: () => `${env.API_URI}/leave/type`, + leaveListCard: (id: string, type: string) => + `${registryNew}${type}/leave/admin/${id}`, //noPermission /** ตำแหน่งเงินเดือน*/ profileSalaryNew: (type: string) => `${registryNew}${type}/salary`, @@ -162,6 +168,8 @@ export default { `${registryNew}${type}/salary/history/${profileId}`, profileSalarySwapNew: (type: string, id: string, type2: string) => `${registryNew}${type2}/salary/swap/${type}/${id}`, + salaryListCard: (id: string, type: string) => + `${registryNew}${type}/salary/admin/${id}`, //noPermission // ประวัติการเปลี่ยนชื่อ-นามสกุล profileNewChangeName: (type: string) => `${registryNew}${type}/changeName`, diff --git a/src/components/CardProfile.vue b/src/components/CardProfile.vue index 2576a9247..f798c1628 100644 --- a/src/components/CardProfile.vue +++ b/src/components/CardProfile.vue @@ -73,7 +73,11 @@ function fetchDataProfile(data: DataProfile) { } function fetchCheckAvatar(id: string) { - http.get(config.API.orgCheckAvatar(id)).then((res) => { + const path = + props.type === "employee" + ? `profile-employee/avatar/profileEmployeeId-admin/${id}` + : `profile/avatar/profileId-admin/${id}`; + http.get(config.API.orgCheckAvatarCard(path)).then((res) => { const data = res.data.result; if (data.avatarName) { fetchProfile(id, data.avatarName); @@ -101,10 +105,10 @@ function onclickViewinfo() { watch( () => props.data, - () => { - const dataMain = props.data as DataProfile; + async () => { + const dataMain = (await props.data) as DataProfile; profileId.value = dataMain.profileId; - fetchDataProfile(dataMain); + await fetchDataProfile(dataMain); } ); diff --git a/src/components/Dialogs/PopupPersonalNew.vue b/src/components/Dialogs/PopupPersonalNew.vue index a917080ea..a5ce956cc 100644 --- a/src/components/Dialogs/PopupPersonalNew.vue +++ b/src/components/Dialogs/PopupPersonalNew.vue @@ -4,6 +4,7 @@ import { useQuasar } from "quasar"; import http from "@/plugins/http"; import config from "@/app.config"; import { useRouter, useRoute } from "vue-router"; +import { checkPermissionGet } from "@/utils/permissions"; /** importType*/ import type { PersonalImformation } from "@/components/information/interface/response/Information"; @@ -101,8 +102,8 @@ async function fetchInformation(id: string) { `${empType.value == "employee" ? `-${empType.value}` : ""}` ) ) - .then((res) => { - const data = res.data.result; + .then(async (res) => { + const data = await res.data.result; imformation.prefix = data.prefix ? data.prefix : "-"; imformation.citizenId = data.citizenId ? data.citizenId : "-"; imformation.firstName = data.firstName ? data.firstName : "-"; @@ -115,7 +116,7 @@ async function fetchInformation(id: string) { avatar.position = data.position ? data.position : "-"; if (data.avatarName) { - fetchProfile(data.id as string, data.avatarName); + await fetchProfile(data.id as string, data.avatarName); } else { avatar.avatar = ""; } @@ -136,13 +137,13 @@ async function fetchProfileGov(id: string) { showLoader(); await http .get( - config.API.profileNewGovernmentById( + config.API.profileNewGovernmentCard( id, `${empType.value == "employee" ? `-${empType.value}` : ""}` ) ) - .then((res) => { - const data = res.data.result; + .then(async (res) => { + const data = await res.data.result; goverment.oc = data.org !== "" ? data.org : "-"; goverment.posNo = data.posMasterNo !== "" ? data.posMasterNo : "-"; goverment.position = data.position !== "" ? data.position : "-"; @@ -183,8 +184,10 @@ watch( ? "employee" : "officer"; - fetchInformation(props.id); - fetchProfileGov(props.id); + await Promise.all([ + fetchInformation(props.id), + fetchProfileGov(props.id), + ]); } } } @@ -197,14 +200,10 @@ watch(modal, (newValue) => { }); async function fetchProfile(id: string, avatarName: string) { - showLoader(); await http .get(config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, avatarName)) .then(async (res) => { avatar.avatar = await res.data.downloadUrl; - }) - .finally(() => { - hideLoader(); }); } @@ -259,6 +258,11 @@ async function fetchProfile(id: string, avatarName: string) {