diff --git a/src/app.config.ts b/src/app.config.ts index f18b886..0b1387d 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -33,16 +33,27 @@ const path = import.meta.env.VITE_MANUAL_URL ?? "https://bma-ehr-manual.frappet.synology.me"; -const generatePopupPath = (routeName: any) => { - if (routeName.includes("registry")) { - return `${path}/manual/chapter-2-user-registry`; +/** + * ไปหน้าคู่มือ + * @param routeName route name + * @param type type ขรก/ลูกจ้าง OFFICER PERM + * @returns + */ +const generatePopupPath = (routeName: any, type: string) => { + if (routeName.includes("organizationChart")) { + return `${path}/manual/chapter-1-user${type}-organization-chart`; } - if (routeName.includes("leave")) { - return `${path}/manual/chapter-4-user-leave`; + if (routeName.includes("registry")) { + return `${path}/manual/chapter-2-user${type}-registry`; } if (routeName.includes("evaluate")) { return `${path}/manual/chapter-3-user-evaluate`; } + + if (routeName.includes("leave")) { + return `${path}/manual/chapter-${type ? "3" : "4"}-user${type}-leave`; + } + if (routeName.includes("portfolio")) { return `${path}/manual/chapter-5-user-portfolio`; } @@ -50,16 +61,22 @@ const generatePopupPath = (routeName: any) => { return `${path}/manual/chapter-6-user-transfer`; } if (routeName.includes("appealComplain")) { - return `${path}/manual/chapter-7-user-appeal-complain`; + return `${path}/manual/chapter-${type ? "4" : "7"}-user${type}-appeal-complain`; } - if (routeName.includes("KPI")) { + if (routeName.includes("KPI-evaluator")) { return `${path}/manual/chapter-9-user-KPI-evaluator`; } if (routeName.includes("scholarship")) { return `${path}/manual/chapter-10-user-scholarship`; } + if (routeName.includes("idp")) { + return `${path}/manual/chapter-11-user-Individual-development`; + } + if (routeName.includes("probation-reportMain")) { + return `${path}/manual/chapter-14-user-service-testing`; + } if (routeName.includes("Retire")) { - return `${path}/manual/chapter-11-user-retire`; + return `${path}/manual/chapter-${type ? "5" : "11"}-user${type}-retire`; } else { return manualConfig[routeName as keyof typeof manualConfig]; } diff --git a/src/views/MainLayout.vue b/src/views/MainLayout.vue index c9c465e..b48f710 100644 --- a/src/views/MainLayout.vue +++ b/src/views/MainLayout.vue @@ -208,13 +208,13 @@ const thaiOptions: Intl.DateTimeFormatOptions = { minute: "2-digit", }; -const handleButtonClick = () => { +const handleButtonClick = async () => { const currentPath = route.name; const queryParams = { role: "user" }; // Replace with your query parameters const queryString = new URLSearchParams(queryParams).toString(); - + const type = await dataStore.getProFileType() // Assuming config.generatePopupPath() returns a base URL - const popupBasePath = config.generatePopupPath(currentPath); + const popupBasePath = config.generatePopupPath(currentPath,type); if (popupBasePath) { const popupPath = `${popupBasePath}?${queryString}`;