hrms-user/src/app.config.ts

105 lines
3.2 KiB
TypeScript
Raw Normal View History

2023-08-08 14:03:12 +07:00
/**ใช้รวมไฟล์ย่อยๆ ของ api แต่ละไฟล์ */
/** API Metadata */
2024-02-02 17:18:33 +07:00
import testtest from "./api/test/api.test";
import retirementResign from "./api/leave/api.leave";
import placementTransfer from "./api/transfer/api.transfer";
import appeal from "./api/appeal/api.appeal";
import message from "./api/api.message";
2023-12-14 14:49:27 +07:00
import evaluate from "./api/evaluate/api.evaluate";
2024-02-02 17:18:33 +07:00
import support from "./api/support/api.support";
import org from "./api/org/api.org";
import scholarship from "./api/scholarship/api.scholarship";
2024-04-22 17:37:47 +07:00
import kpi from "./api/KPI/api.kpis";
import probation from "./api/probation/api.probation";
2024-06-27 18:15:20 +07:00
import development from "./api/api.development";
2023-08-08 14:03:12 +07:00
2024-11-18 10:22:56 +07:00
/** API reports */
import reports from "./api/reports/api.report";
2023-08-08 14:03:12 +07:00
const API = {
2024-08-08 16:51:28 +07:00
...testtest,
...retirementResign,
...placementTransfer,
...message,
...evaluate,
...appeal,
...support,
...org,
...scholarship,
...kpi,
...probation,
...development,
2024-11-18 10:22:56 +07:00
//reports
...reports,
2024-06-28 13:07:29 +07:00
};
2025-09-03 15:26:39 +07:00
const path = import.meta.env.VITE_MANUAL_URL ?? "";
2024-06-28 13:07:29 +07:00
2024-11-15 13:16:11 +07:00
/**
*
* @param routeName route name
* @param type type / OFFICER PERM
* @returns
*/
const generatePopupPath = (routeName: any, type: string) => {
if (routeName.includes("organizationChart")) {
2024-12-20 16:49:35 +07:00
return `${path}/chapter-1-user${type}-organization-chart`;
2024-08-08 16:51:28 +07:00
}
2025-06-24 09:33:41 +07:00
if (routeName.includes("registry") || routeName.includes("request-edit")) {
2024-12-20 16:49:35 +07:00
return `${path}/chapter-2-user${type}-registry`;
2024-08-08 16:51:28 +07:00
}
if (routeName.includes("evaluate")) {
2024-12-20 16:49:35 +07:00
return `${path}/chapter-3-user-evaluate`;
2024-08-08 16:51:28 +07:00
}
2024-11-15 13:16:11 +07:00
2025-06-24 09:33:41 +07:00
if (routeName.includes("leave") || routeName.includes("addAbsence")) {
2024-12-20 16:49:35 +07:00
return `${path}/chapter-${type ? "3" : "4"}-user${type}-leave`;
2024-11-15 13:16:11 +07:00
}
2024-08-08 16:51:28 +07:00
if (routeName.includes("portfolio")) {
2024-12-20 16:49:35 +07:00
return `${path}/chapter-5-user-portfolio`;
2024-08-08 16:51:28 +07:00
}
if (routeName.includes("transfer")) {
2024-12-20 16:49:35 +07:00
return `${path}/chapter-6-user-transfer`;
2024-08-08 16:51:28 +07:00
}
if (routeName.includes("appealComplain")) {
2024-12-20 16:49:35 +07:00
return `${path}/chapter-${type ? "4" : "7"}-user${type}-appeal-complain`;
2024-08-08 16:51:28 +07:00
}
2024-11-15 13:16:11 +07:00
if (routeName.includes("KPI-evaluator")) {
2024-12-20 16:49:35 +07:00
return `${path}/chapter-9-user-KPI-evaluator`;
2024-08-08 16:51:28 +07:00
}
if (routeName.includes("scholarship")) {
2024-12-20 16:49:35 +07:00
return `${path}/chapter-10-user-scholarship`;
2024-08-08 16:51:28 +07:00
}
2024-11-15 13:16:11 +07:00
if (routeName.includes("idp")) {
2024-12-20 16:49:35 +07:00
return `${path}/chapter-11-user-Individual-development`;
2024-11-15 13:16:11 +07:00
}
if (routeName.includes("probation-reportMain")) {
2024-12-20 16:49:35 +07:00
return `${path}/chapter-14-user-service-testing`;
2024-11-15 13:16:11 +07:00
}
2024-08-08 16:51:28 +07:00
if (routeName.includes("Retire")) {
2025-06-24 09:33:41 +07:00
return `${path}/chapter-${type ? "6" : "12"}-user${type}-retire`;
2024-08-08 16:51:28 +07:00
} else {
return manualConfig[routeName as keyof typeof manualConfig];
}
2024-06-28 13:07:29 +07:00
};
const manualConfig = {
2024-12-20 16:49:35 +07:00
dashboard: `${path}/chapter-1-user-organization-chart`,
leave: `${path}/chapter-4-user-leave`,
organizationChart: `${path}/chapter-1-user-organization-chart`,
registryMain: `${path}/chapter-2-user-registry`,
addPortfolio: `${path}/chapter-5-user-portfolio`,
addTransfer: `${path}/chapter-6-user-transfer`,
KPIMain: `${path}/chapter-8-user-KPI`,
2025-06-24 09:33:41 +07:00
KPIAdd: `${path}/chapter-8-user-KPI`,
KPIEdit: `${path}/chapter-8-user-KPI`,
2024-12-20 16:49:35 +07:00
KPIMainEvaluator: `${path}/chapter-9-user-KPI-evaluator`,
};
2023-08-08 14:03:12 +07:00
export default {
2024-08-08 16:51:28 +07:00
API: API,
generatePopupPath,
};