เพิ่มส่งข้อความ inbox
This commit is contained in:
parent
90568eac79
commit
1e718bb5fc
2 changed files with 55 additions and 5 deletions
|
|
@ -28,6 +28,10 @@ const props = defineProps({
|
||||||
type: Function,
|
type: Function,
|
||||||
default: () => {},
|
default: () => {},
|
||||||
},
|
},
|
||||||
|
type: {
|
||||||
|
type: String,
|
||||||
|
default: "",
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const subject = ref<string>(""); // หัวข้อ
|
const subject = ref<string>(""); // หัวข้อ
|
||||||
|
|
@ -39,14 +43,18 @@ const body = ref<string>(""); //ข้อความ
|
||||||
function onSubmit() {
|
function onSubmit() {
|
||||||
dialogConfirm($q, async () => {
|
dialogConfirm($q, async () => {
|
||||||
showLoader();
|
showLoader();
|
||||||
|
const pathAPI =
|
||||||
|
props.type === "Administrator"
|
||||||
|
? config.API.replyMessage(props.idInbox)
|
||||||
|
: config.API.replyMessage(props.idInbox);
|
||||||
await http
|
await http
|
||||||
.put(config.API.replyMessage(props.idInbox), {
|
.put(pathAPI, {
|
||||||
subject: subject.value,
|
subject: subject.value,
|
||||||
body: body.value,
|
body: body.value,
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
props.clickClose();
|
|
||||||
success($q, "ส่งข้อความสำเร็จ");
|
success($q, "ส่งข้อความสำเร็จ");
|
||||||
|
onClose();
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
|
|
@ -56,13 +64,26 @@ function onSubmit() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onClose() {
|
||||||
|
subject.value = "";
|
||||||
|
body.value = "";
|
||||||
|
props.clickClose();
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<q-dialog v-model="props.modal" persistent>
|
<q-dialog v-model="props.modal" persistent>
|
||||||
<q-card style="width: 40vw; max-width: 40vw">
|
<q-card style="width: 40vw; max-width: 40vw">
|
||||||
<q-form greedy @submit.prevent @validation-success="onSubmit">
|
<q-form greedy @submit.prevent @validation-success="onSubmit">
|
||||||
<DialogHeader tittle="ส่งข้อความ" :close="clickClose" />
|
<DialogHeader
|
||||||
|
:tittle="
|
||||||
|
type === 'Administrator'
|
||||||
|
? 'ส่งข้อความไปยังผู้ดูแลระบบของหน่วยงาน'
|
||||||
|
: 'ส่งข้อความ'
|
||||||
|
"
|
||||||
|
:close="onClose"
|
||||||
|
/>
|
||||||
<q-separator />
|
<q-separator />
|
||||||
<q-card-section class="q-pa-sm bg-grey-1">
|
<q-card-section class="q-pa-sm bg-grey-1">
|
||||||
<div class="row col-12 q-col-gutter-sm">
|
<div class="row col-12 q-col-gutter-sm">
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted } from "vue";
|
import { ref, onMounted } from "vue";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
|
||||||
|
|
||||||
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
|
import { tokenParsed } from "@/plugins/auth";
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
|
|
||||||
|
|
@ -37,6 +38,8 @@ const thaiOptions: Intl.DateTimeFormatOptions = {
|
||||||
};
|
};
|
||||||
const isLoadInbox = ref<boolean>(false); // สถานะการโหลด
|
const isLoadInbox = ref<boolean>(false); // สถานะการโหลด
|
||||||
const modalReply = ref<boolean>(false); // ตอบกลับข้อความ
|
const modalReply = ref<boolean>(false); // ตอบกลับข้อความ
|
||||||
|
const modalAdministrator = ref<boolean>(false); //ส่งข้อความไปยังผู้ดูแลระบบของหน่วยงาน
|
||||||
|
const isSuperAdmin = ref<boolean>(false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* โหลดรายการกล่องข้องความ
|
* โหลดรายการกล่องข้องความ
|
||||||
|
|
@ -156,6 +159,7 @@ function dialogRepleOpen() {
|
||||||
*/
|
*/
|
||||||
function modalReplyClose() {
|
function modalReplyClose() {
|
||||||
modalReply.value = false;
|
modalReply.value = false;
|
||||||
|
modalAdministrator.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -176,6 +180,11 @@ function onLoad(index: number, done: Function) {
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await getData(1);
|
await getData(1);
|
||||||
|
// ดิงชื่อผู้ใช้งานจาก keycloak
|
||||||
|
const tokenParsedData = await tokenParsed();
|
||||||
|
if (tokenParsedData != null) {
|
||||||
|
isSuperAdmin.value = tokenParsedData.role.includes("SUPER_ADMIN");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -197,7 +206,21 @@ onMounted(async () => {
|
||||||
:style="$q.screen.gt.xs ? 'height: 80vh' : 'height: auto;'"
|
:style="$q.screen.gt.xs ? 'height: 80vh' : 'height: auto;'"
|
||||||
>
|
>
|
||||||
<div class="q-px-md q-py-sm row col-12 items-center">
|
<div class="q-px-md q-py-sm row col-12 items-center">
|
||||||
<div class="text-subtitle1 text-weight-medium">กล่องข้อความ</div>
|
<div class="text-subtitle1 text-weight-medium">
|
||||||
|
กล่องข้อความ
|
||||||
|
<q-btn
|
||||||
|
v-if="isSuperAdmin"
|
||||||
|
flat
|
||||||
|
round
|
||||||
|
dense
|
||||||
|
icon="add"
|
||||||
|
size="10px"
|
||||||
|
color="add"
|
||||||
|
@click="modalAdministrator = true"
|
||||||
|
>
|
||||||
|
<q-tooltip>ส่งข้อความไปยังผู้ดูแลระบบของหน่วยงาน</q-tooltip>
|
||||||
|
</q-btn>
|
||||||
|
</div>
|
||||||
<q-space />
|
<q-space />
|
||||||
<div v-if="totalInbox" class="text-grey-5" style="font-size: 12px">
|
<div v-if="totalInbox" class="text-grey-5" style="font-size: 12px">
|
||||||
ทั้งหมด {{ totalInbox }} ข้อความ
|
ทั้งหมด {{ totalInbox }} ข้อความ
|
||||||
|
|
@ -387,6 +410,12 @@ onMounted(async () => {
|
||||||
</q-card>
|
</q-card>
|
||||||
</template>
|
</template>
|
||||||
</q-splitter>
|
</q-splitter>
|
||||||
|
|
||||||
|
<PopupReplyInbox
|
||||||
|
:modal="modalAdministrator"
|
||||||
|
:click-close="modalReplyClose"
|
||||||
|
type="Administrator"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue