route คู่มือ

This commit is contained in:
setthawutttty 2024-11-15 13:16:11 +07:00
parent 18eb7fc2f0
commit c91fffe2da
2 changed files with 28 additions and 11 deletions

View file

@ -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];
}

View file

@ -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}`;