diff --git a/src/components/PopupDetailInbox.vue b/src/components/PopupDetailInbox.vue new file mode 100644 index 0000000..29e7647 --- /dev/null +++ b/src/components/PopupDetailInbox.vue @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + {{ detail.subject }} + + + วันที่ได้รับ {{ detail.receiveDate }} + + + + + ตอบกลับข้อความ + + + + + + + + + + {{ detail.body }} + + + + + + + + ดาวน์โหลดเอกสารแนบ + + + + {{ item.name }} + + + + + ดาวน์โหลดเอกสารแนบ + + + + + + + + + diff --git a/src/modules/01_dashboard/views/Dashboard.vue b/src/modules/01_dashboard/views/Dashboard.vue index a5439b2..dc6608c 100644 --- a/src/modules/01_dashboard/views/Dashboard.vue +++ b/src/modules/01_dashboard/views/Dashboard.vue @@ -7,6 +7,7 @@ import http from "@/plugins/http"; import config from "@/app.config"; import { useCounterMixin } from "@/stores/mixin"; import PopupReplyInbox from "@/components/PopupReplyInbox.vue"; +import PopupDetailInbox from "@/components/PopupDetailInbox.vue"; const $q = useQuasar(); const mixin = useCounterMixin(); @@ -82,14 +83,15 @@ const items = ref([ }, ]); onMounted(async () => { - await fetchlistInbox(); + await fetchlistInbox(1); }); -const fetchlistInbox = async () => { - showLoader(); +const fetchlistInbox = async (index: number) => { + index === 1 && showLoader(); await http - .get(config.API.msgInbox) + .get(config.API.msgInbox + `?page=${index}&pageSize=${10}`) .then((res) => { - let data = res.data.result; + let data = res.data.result.data; + totalInbox.value = res.data.result.total; let listItem: any = []; data.map((e: any) => { listItem.push({ @@ -100,11 +102,13 @@ const fetchlistInbox = async () => { : e.createdFullName, subject: e.subject ?? "", timereceive: date2Thai(e.createdAt), - body: e.body ?? "", + body: e.body ?? "-", ratingModel: 0, + receiveDate: date2Thai(e.receiveDate), + payload: e.payload, }); }); - inboxList.value = listItem; + inboxList.value.push(...listItem); }) .catch((err) => { console.log(err); @@ -130,6 +134,38 @@ function modalReplyClose() { contactNo.value = ""; modalReply.value = false; } + +const dataInbox = ref(); +const modalDetial = ref(false); +function onClickOpenPopupDetail(data: any) { + dataInbox.value = data; + link.value = data.no; + modalDetial.value = !modalDetial.value; +} + +function updateModalDetail(val: boolean) { + modalDetial.value = val; +} + +const scrollTargetRef = ref(null); +const totalInbox = ref(0); +function onLoad(index: number, done: any) { + if (inboxList.value.length < totalInbox.value) { + setTimeout(() => { + fetchlistInbox(index + 1); + done(); + }, 2000); + } +} + +// function onLoadRef(index: number, done: any) { +// if (inboxList.value.length < totalInbox.value) { +// setTimeout(() => { +// fetchlistInbox(index + 1); +// done(); +// }, 2000); +// } +// } @@ -184,7 +220,7 @@ function modalReplyClose() { @@ -200,8 +236,73 @@ function modalReplyClose() { flat /> --> + + + + + + + {{ item.sender }} + + {{ + item.subject + }} + - + + {{ item.timereceive }} + + + + + ตอบกลับข้อความ + + + + + + + + + + + + + + +