@@ -54,66 +63,154 @@ const onLoad = (async (_: any, done: any) => {
-
- {{ store.currentTitle }}
+
+ {{ store.currentTitle }}
+
+ {{ store.currentCategory }}
+
+
+
+
+
+
+
+
+
+
-
-
-
+ {
+ store.currentIssue = item.id;
+ store.currentTitle = item.title;
+ store.correntStatusIssue = item.status;
+ store.currentCategory = item.category.name;
+ store.issue
+ ? (store.issue.result = store.issue.result.map((v) => {
+ if (v.id === item.id) {
+ v.unreadCount = 0;
+ }
+ return v;
+ }))
+ : '';
+ await store.fetchMessageStatus(item.id);
+ await store.fetchMessage(item.id);
+ }
+ "
+ :class="{ active: store.currentIssue === item.id }"
+ class="noactive row q-py-sm justify-between items-center q-px-md"
+ >
+
+
+
+
+
+
+
+
+ {{ item.title }}
+
- if (store.issue) {
- store.issue.result = store.issue.result.map((v) => {
- if (v.id === data.id) v.unreadCount = 0;
- return v;
- });
- }
- "
- active-class="my-menu-link"
- >
-
-
-
-
- {{ data.title }}
-
- {{ data.lastMessage }}
-
- {{ item.lastMessage }}
+
+
+
+
+
-
+
+
+
@@ -198,29 +295,35 @@ const onLoad = (async (_: any, done: any) => {
-->
{
- store.sendMessage(content, store.currentIssue);
- content = '';
+ if (store.currentIssue) {
+ store.sendMessage(content, store.currentIssue);
+ content = '';
+ }
}
"
- />
+ outlined
+ dense
+ placeholder="Aa"
+ v-model="content"
+ id="message"
+ >
+
{
- store.sendMessage(content, store.currentIssue);
- content = '';
+ if (store.currentIssue) {
+ store.sendMessage(content, store.currentIssue);
+ content = '';
+ }
}
"
flat
- color="primary"
+ class="col-2"
+ style="color: #009789"
label="ส่งข้อความ"
/>
@@ -229,9 +332,24 @@ const onLoad = (async (_: any, done: any) => {
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 @@
+
+
+
+
+
+
+
+
+
+ เพิ่มประเภทของปัญหา
+
+
+ แก้ไขประเภทของปัญหา
+
+
+
+
+
+
+
+
ยืนยันการลบข้อมูล
+
ต้องการยืนยันการลบข้อมูลนี้หรือไม่
+
+
+
+
+
+
+
+
+
+ {
+ open = false;
+ }
+ "
+ label="ยกเลิก"
+ flat
+ v-close-popup
+ id="dialogDeleteClose"
+ />
+
+ {
+ controlAction(prop.category, prop.status, input);
+ open = false;
+ }
+ "
+ :color="prop.status == 'delete' ? 'negative' : 'primary'"
+ v-close-popup
+ label="ยืนยัน"
+ id="dialogDeleteConfirm"
+ />
+
+
+
+
+
+
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 @@
+
+
+
+
+
จัดการประเภคของปัญหา
+
+
{
+ open = true;
+ status = 'add';
+ }
+ "
+ >เพิ่มประเภทของปัญหา
+
+
+
+
+
+
+
+ {
+ open = true;
+ status = 'edit';
+ categoryId = data.row.id;
+ currentName = data.row.name;
+
+ console.log(currentName);
+ }
+ "
+ />
+
+ {
+ open = true;
+ status = 'delete';
+ categoryId = data.row.id;
+ }
+ "
+ />
+
+
+
+
+
+
+
+
+
+
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 @@
+
+
+
+
+
+