diff --git a/src/api/02_organizational/api.organization.ts b/src/api/02_organizational/api.organization.ts index 93d2241c..ae3d06dd 100644 --- a/src/api/02_organizational/api.organization.ts +++ b/src/api/02_organizational/api.organization.ts @@ -113,4 +113,6 @@ export default { viewWorkflow: `${organization}/view-workflow`, keycloakLogSSO: `${organization}/keycloak/log/sso`, + + orgIssues: `${organization}/issues`, }; diff --git a/src/interface/request/main/main.ts b/src/interface/request/main/main.ts index 7e0ab73d..6697267c 100644 --- a/src/interface/request/main/main.ts +++ b/src/interface/request/main/main.ts @@ -182,6 +182,14 @@ const menuList = readonly([ path: "manageWebservices", role: ["SUPER_ADMIN"], }, + { + key: 7, + icon: "mdi-bug", + activeIcon: "mdi-bug", + label: "รายงานปัญหา", + path: "manageIssues", + role: ["SUPER_ADMIN", "ISSUE"], + }, ]); export { menuList }; diff --git a/src/modules/07_issues/components/DialogViewIssue.vue b/src/modules/07_issues/components/DialogViewIssue.vue new file mode 100644 index 00000000..5dd2e586 --- /dev/null +++ b/src/modules/07_issues/components/DialogViewIssue.vue @@ -0,0 +1,587 @@ + + + + + diff --git a/src/modules/07_issues/interface/Main.ts b/src/modules/07_issues/interface/Main.ts new file mode 100644 index 00000000..56c4b46d --- /dev/null +++ b/src/modules/07_issues/interface/Main.ts @@ -0,0 +1,44 @@ +import type { D } from "@fullcalendar/core/internal-common"; + +interface Options { + label: string; + value: string; +} + +interface IssueData { + codeIssue: string; + createdAt: Date; + createdFullName: string; + createdUserId: string; + description: string; + id: string; + lastUpdateFullName: string; + lastUpdateUserId: string; + lastUpdatedAt: Date; + menu: string; + org: string; + remark: string; + status: "IN_PROGRESS" | "RESOLVED" | "CLOSED" | "NEW"; + system: "mgt" | "user" | "checkin"; + title: string; + email: string; + phone: string; +} + +interface IssueAttachment { + fileName: string; + path: string; + pathname: string; + title: string; +} + +interface IssueAttachmentWithDownloadUrl extends IssueAttachment { + downloadUrl: string; +} + +export type { + Options, + IssueData, + IssueAttachment, + IssueAttachmentWithDownloadUrl, +}; diff --git a/src/modules/07_issues/router.ts b/src/modules/07_issues/router.ts new file mode 100644 index 00000000..5fd42a25 --- /dev/null +++ b/src/modules/07_issues/router.ts @@ -0,0 +1,13 @@ +const Main = () => import("@/modules/07_issues/views/Main.vue"); + +export default [ + { + path: "/issues", + name: "manageIssues", + component: Main, + meta: { + Auth: true, + role: ["SUPER_ADMIN", "ISSUE"], + }, + }, +]; diff --git a/src/modules/07_issues/store.ts b/src/modules/07_issues/store.ts new file mode 100644 index 00000000..efddccdc --- /dev/null +++ b/src/modules/07_issues/store.ts @@ -0,0 +1,52 @@ +import { ref } from "vue"; +import { defineStore } from "pinia"; +import type { Options } from "@/modules/07_issues/interface/Main"; + +export const useIssueStore = defineStore("issue", () => { + const systemOptions = ref([ + { label: "ทั้งหมด", value: "" }, + { label: "ระบบบริหารจัดการ", value: "MGT" }, + { label: "ระบบผู้ใช้งาน", value: "USER" }, + { label: "ระบบลงเวลา", value: "CHECKIN" }, + ]); + + const statusOptions = ref([ + { label: "ทั้งหมด", value: "" }, + { label: "ใหม่", value: "NEW" }, + { label: "กำลังดำเนินการ", value: "IN_PROGRESS" }, + { label: "แก้ไขแล้ว", value: "RESOLVED" }, + { label: "ปิดแล้ว", value: "CLOSED" }, + ]); + + function convertStatus(status: string) { + let val = status.toUpperCase(); + switch (val) { + case "NEW": + return "ใหม่"; + case "IN_PROGRESS": + return "กำลังดำเนินการ"; + case "RESOLVED": + return "แก้ไขแล้ว"; + case "CLOSED": + return "ปิดแล้ว"; + default: + return "-"; + } + } + + function convertSystem(system: string) { + let val = system.toUpperCase(); + switch (val) { + case "MGT": + return "ระบบบริหารจัดการ"; + case "USER": + return "ระบบผู้ใช้งาน"; + case "CHECKIN": + return "ระบบลงเวลา"; + default: + return "-"; + } + } + + return { systemOptions, statusOptions, convertStatus, convertSystem }; +}); diff --git a/src/modules/07_issues/views/Main.vue b/src/modules/07_issues/views/Main.vue new file mode 100644 index 00000000..3eac5f83 --- /dev/null +++ b/src/modules/07_issues/views/Main.vue @@ -0,0 +1,363 @@ + + + + diff --git a/src/router/index.ts b/src/router/index.ts index 52bcf737..a5ab0eb3 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -12,6 +12,7 @@ import ModuleLogs from "@/modules/03_logs/router"; import ModuleSystem from "@/modules/04_system/router"; import ModuleCommand from "@/modules/05_command/router"; import ModuleWebServices from "@/modules/06_webservices/router"; +import ModeuleIssues from "@/modules/07_issues/router"; // TODO: ใช้หรือไม่? import { authenticated, logout } from "@/plugins/auth"; @@ -50,6 +51,7 @@ const router = createRouter({ ...ModuleSystem, ...ModuleCommand, ...ModuleWebServices, + ...ModeuleIssues, ], }, /** diff --git a/src/views/MainLayout.vue b/src/views/MainLayout.vue index 3327b237..d9b71c84 100644 --- a/src/views/MainLayout.vue +++ b/src/views/MainLayout.vue @@ -129,7 +129,7 @@ async function getDataNotification(index: number, type: string) { : e.createdFullName[0], body: e.body ?? "", timereceive: `${date2Thai(e.receiveDate)} ${new Date( - e.receiveDate + e.receiveDate, ).toLocaleTimeString("th-TH", thaiOptions)} น.`, isOpen: e.isOpen, }); @@ -255,7 +255,7 @@ function doLogout() { await logoutSSO(); }, "ยืนยันการออกจากระบบ", - "ต้องการออกจากระบบใช่หรือไม่?" + "ต้องการออกจากระบบใช่หรือไม่?", ); } @@ -335,6 +335,10 @@ const landingPageUrl = ref(configParam.landingPageUrl); /** ฟังก์ชันเรียกข้อมูลผู้ใช่งาน*/ async function fetchKeycloakPosition() { + const checkRole = + role.value.includes("SUPER_ADMIN") || role.value.includes("ADMIN"); + if (!checkRole) return; + await http .get(config.API.keycloakPosition()) .then(async (res) => { @@ -379,7 +383,7 @@ watch( notiList.value = updatedNotifications; fetchmsgNoread(); } - } + }, ); const isSsoToken = ref(false); @@ -730,7 +734,6 @@ onUnmounted(() => { v-if=" menuItem.key == 2 || menuItem.key == 0 || - menuItem.key == 7 || menuItem.key == 8 || menuItem.key == 9 || menuItem.key == 10 || @@ -773,7 +776,6 @@ onUnmounted(() => {
{ v-if=" menuItem.key == 2 || menuItem.key == 0 || - menuItem.key == 7 || menuItem.key == 8 || menuItem.key == 9 || menuItem.key == 10 || @@ -942,7 +943,6 @@ onUnmounted(() => {
{ :label="subMenu.label" v-if=" subMenu.key !== 2.0 && - subMenu.key !== 7.1 && subMenu.key !== 12.0 && subMenu.key !== 13.0 "