diff --git a/src/api/00_support/api.support.ts b/src/api/00_support/api.support.ts index 1d1e98daa..401adaebc 100644 --- a/src/api/00_support/api.support.ts +++ b/src/api/00_support/api.support.ts @@ -1,14 +1,22 @@ import env from "../index"; export const supportIssue = `${env.API_SUPPORT_URI}/issue`; +export const supportCategory = `${env.API_SUPPORT_URI}/Issue-category`; +export const supportCategoryAction = (id: string) => + `${env.API_SUPPORT_URI}/Issue-category/${id}`; +export const supportIssueChangeStatus = (id: string) => + `${env.API_SUPPORT_URI}/issue/${id}`; export const supportMessage = (id: string) => `${env.API_SUPPORT_URI}/issue/${id}/message`; export const supportMessageStatus = (id: string) => - `${env.API_SUPPORT_URI}/issue/${id}/message-status?issueId`; + `${env.API_SUPPORT_URI}/issue/${id}/message-status`; export default { supportIssue, + supportCategory, supportMessage, supportMessageStatus, + supportIssueChangeStatus, + supportCategoryAction, }; diff --git a/src/modules/00_support/components/DialogStatus.vue b/src/modules/00_support/components/DialogStatus.vue new file mode 100644 index 000000000..96d2c0c0a --- /dev/null +++ b/src/modules/00_support/components/DialogStatus.vue @@ -0,0 +1,122 @@ + + + + + diff --git a/src/modules/00_support/components/FormChat.vue b/src/modules/00_support/components/FormChat.vue index 34b719b54..df121e9f8 100644 --- a/src/modules/00_support/components/FormChat.vue +++ b/src/modules/00_support/components/FormChat.vue @@ -1,6 +1,7 @@ diff --git a/src/modules/00_support/components/category/DialogCategory.vue b/src/modules/00_support/components/category/DialogCategory.vue new file mode 100644 index 000000000..0172642f7 --- /dev/null +++ b/src/modules/00_support/components/category/DialogCategory.vue @@ -0,0 +1,103 @@ + + + + + diff --git a/src/modules/00_support/components/category/TableCategory.vue b/src/modules/00_support/components/category/TableCategory.vue new file mode 100644 index 000000000..e57396f28 --- /dev/null +++ b/src/modules/00_support/components/category/TableCategory.vue @@ -0,0 +1,92 @@ + + + + + diff --git a/src/modules/00_support/interface/index/Main.ts b/src/modules/00_support/interface/index/Main.ts index 7b223125d..e029b9b8a 100644 --- a/src/modules/00_support/interface/index/Main.ts +++ b/src/modules/00_support/interface/index/Main.ts @@ -30,7 +30,7 @@ export interface SupportIssue { createdAt: string; updatedAt: string; title: string; - status: string; + status: "new" | "ongoing" | "resolved"; category: SupportIssueCategory; unreadCount: number; lastMessage: string; diff --git a/src/modules/00_support/router.ts b/src/modules/00_support/router.ts index 518b05c6c..ce6095191 100644 --- a/src/modules/00_support/router.ts +++ b/src/modules/00_support/router.ts @@ -1,4 +1,6 @@ const supportMain = () => import("@/modules/00_support/views/MainPage.vue"); +const supportCategory = () => + import("@/modules/00_support/views/ManageCategory.vue"); export default [ { @@ -11,4 +13,14 @@ export default [ Role: "evaluate", }, }, + { + path: "/category", + name: "supportCategory", + component: supportCategory, + meta: { + Auth: true, + Key: [1.1], + Role: "evaluate", + }, + }, ]; diff --git a/src/modules/00_support/store/Main.ts b/src/modules/00_support/store/Main.ts index db114c65c..a15444bee 100644 --- a/src/modules/00_support/store/Main.ts +++ b/src/modules/00_support/store/Main.ts @@ -10,9 +10,10 @@ import type { SupportIssueResponse, SupportStatusUser, SupportMessageStatus, + SupportIssueCategory, } from "@/modules/00_support/interface/index/Main"; import keycloak from "@/plugins/keycloak"; -import { useQuasar } from "quasar"; +import { useQuasar, type QTableProps } from "quasar"; export const useSupportStore = defineStore("supportServiceStore", () => { const { showLoader, hideLoader, messageError } = useCounterMixin(); @@ -24,11 +25,40 @@ export const useSupportStore = defineStore("supportServiceStore", () => { const statusUser = ref([]); const currentIssue = ref(""); const currentTitle = ref(""); + const currentCategoryId = ref(""); + const correntStatusIssue = ref<"new" | "ongoing" | "resolved">("new"); const currentTotalMessage = ref(); const currentPage = ref(); const scrollContainer = ref(); const currentPageIssue = ref(); const currentTotalIssue = ref(); + const currentCategory = ref(); + + const columnsCategory = [ + { + name: "id", + label: "id", + align: "center", + field: "id", + sortable: true, + }, + { + name: "name", + align: "center", + label: "name", + field: "name", + sortable: true, + }, + { + name: "actions", + align: "center", + label: "", + field: "", + }, + ] satisfies QTableProps["columns"]; + + const rowsCategory = ref(); + function scrollToEnd(position: Number = 1) { setTimeout(() => { scrollContainer.value?.setScrollPercentage("vertical", position); @@ -146,10 +176,37 @@ export const useSupportStore = defineStore("supportServiceStore", () => { } } + async function ChangeStatusIssue( + issueId: string, + title: string, + categoryId: string, + status: "new" | "ongoing" | "resolved" + ) { + showLoader(); + const requestBody = { + title: title, + categoryId: categoryId, + status: status, + }; + + const res = await http + .patch(config.API.supportIssueChangeStatus(issueId), requestBody) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); + if (res) { + fetchIssue(); + correntStatusIssue.value = status; + } + } + async function fetchIssue(page: number = 1) { showLoader(); const res = await http - .get(`${config.API.supportIssue}?page=${page}&&pageSize=6`) + .get(`${config.API.supportIssue}?page=${page}&pageSize=6`) .catch((err) => { messageError($q, err); }) @@ -159,29 +216,110 @@ export const useSupportStore = defineStore("supportServiceStore", () => { if (res && res.data) { issue.value = res.data; + currentPageIssue.value = res.data.page; currentTotalIssue.value = res.data.total; } } + async function newCategory(name: string) { + showLoader(); + const res = await http + .post(config.API.supportCategory, { + name: name, + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); + + if (res) { + fetchCategory(); + } + } + + async function fetchCategory() { + showLoader(); + const res = await http + .get(config.API.supportCategory) + .catch((err) => { + messageError($q, err); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); + if (res && res.data) { + rowsCategory.value = res.data; + } + } + + async function deleteCategory(CategoryId: string) { + showLoader(); + const res = await http + .delete(config.API.supportCategoryAction(CategoryId)) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); + + if (res) { + fetchCategory(); + } + } + + async function editCategory(CategoryId: string, name: string) { + showLoader(); + const res = await http + .patch(config.API.supportCategoryAction(CategoryId), { + name: name, + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); + + if (res) { + fetchCategory(); + } + } + return { userId, issue, message, - fetchIssue, - fetchMessage, - fetchMessageStatus, - sendMessage, - scrollToEnd, scrollContainer, currentIssue, currentTitle, socket, messageStatus, - loadMessage, currentTotalMessage, currentPage, currentPageIssue, currentTotalIssue, + currentCategoryId, + correntStatusIssue, + currentCategory, + rowsCategory, + columnsCategory, + fetchIssue, + fetchMessage, + fetchMessageStatus, + sendMessage, + scrollToEnd, + loadMessage, + ChangeStatusIssue, + newCategory, + fetchCategory, + deleteCategory, + editCategory, }; }); diff --git a/src/modules/00_support/views/MainPage.vue b/src/modules/00_support/views/MainPage.vue index 98f291642..b60ce91d6 100644 --- a/src/modules/00_support/views/MainPage.vue +++ b/src/modules/00_support/views/MainPage.vue @@ -1,6 +1,6 @@ + + + +