diff --git a/src/modules/00_support/components/FormChat.vue b/src/modules/00_support/components/FormChat.vue index 947ce8dad..b882a6950 100644 --- a/src/modules/00_support/components/FormChat.vue +++ b/src/modules/00_support/components/FormChat.vue @@ -12,7 +12,7 @@ const content = ref(""); const searchInput = ref(""); const currentIssuePage = ref(1); const totalPageIssue = ref(); -const createdByUser = ref(""); + const { scrollContainer } = storeToRefs(store); function dateIssue(timestamp: string): string { @@ -43,6 +43,9 @@ function getOnlineStatus(option: "icon" | "status", userId: string) { } onMounted(async () => { + if (store.currentIssue) { + await store.fetchIssue(); + } await store.fetchIssue(); totalPageIssue.value = Math.ceil((store.currentTotalIssue || 0) / 30); }); @@ -66,8 +69,9 @@ const onLoad = (async (_: any, done: any) => { size="16px" color="primary" class="button-link-no-deco q-px-md" + @click="$router.push('/support/category')" > - จัดการประเภทของปัญหา + จัดการประเภทของปัญหา

@@ -112,9 +116,9 @@ const onLoad = (async (_: any, done: any) => { - {{ getOnlineStatus("status", createdByUser) }} + {{ getOnlineStatus("status", store.createdByUser) }} @@ -148,7 +152,7 @@ const onLoad = (async (_: any, done: any) => { store.currentTitle = item.title; store.correntStatusIssue = item.status; store.currentCategory = item.category.name; - createdByUser = item.createdByUserId; + store.createdByUser = item.createdByUserId; store.issue ? (store.issue.result = store.issue.result.map((v) => { if (v.id === item.id) { @@ -171,7 +175,12 @@ const onLoad = (async (_: any, done: any) => {
- + + + {{ item.category.name }} + + + {{ item.title }} diff --git a/src/modules/00_support/store/Main.ts b/src/modules/00_support/store/Main.ts index d5a456b47..549465a41 100644 --- a/src/modules/00_support/store/Main.ts +++ b/src/modules/00_support/store/Main.ts @@ -33,6 +33,7 @@ export const useSupportStore = defineStore("supportServiceStore", () => { const currentPageIssue = ref(); const currentTotalIssue = ref(); const currentCategory = ref(); + const createdByUser = ref(""); const rowsCategory = ref(); @@ -106,9 +107,10 @@ export const useSupportStore = defineStore("supportServiceStore", () => { }); function sendMessage(content: string, to: string) { - console.log(to); - socket.emit("message", { to, content }); + + console.log(socket); + scrollToEnd(); } @@ -311,6 +313,7 @@ export const useSupportStore = defineStore("supportServiceStore", () => { currentCategory, rowsCategory, userStatus, + createdByUser, fetchIssue, fetchMessage, fetchMessageStatus, diff --git a/src/modules/00_support/views/MainPage.vue b/src/modules/00_support/views/MainPage.vue index b60ce91d6..636d05a31 100644 --- a/src/modules/00_support/views/MainPage.vue +++ b/src/modules/00_support/views/MainPage.vue @@ -1,11 +1,17 @@