เพิ่มส่งข้อความ 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,
|
||||
default: () => {},
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
});
|
||||
|
||||
const subject = ref<string>(""); // หัวข้อ
|
||||
|
|
@ -39,14 +43,18 @@ const body = ref<string>(""); //ข้อความ
|
|||
function onSubmit() {
|
||||
dialogConfirm($q, async () => {
|
||||
showLoader();
|
||||
const pathAPI =
|
||||
props.type === "Administrator"
|
||||
? config.API.replyMessage(props.idInbox)
|
||||
: config.API.replyMessage(props.idInbox);
|
||||
await http
|
||||
.put(config.API.replyMessage(props.idInbox), {
|
||||
.put(pathAPI, {
|
||||
subject: subject.value,
|
||||
body: body.value,
|
||||
})
|
||||
.then(() => {
|
||||
props.clickClose();
|
||||
success($q, "ส่งข้อความสำเร็จ");
|
||||
onClose();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
|
|
@ -56,13 +64,26 @@ function onSubmit() {
|
|||
});
|
||||
});
|
||||
}
|
||||
|
||||
function onClose() {
|
||||
subject.value = "";
|
||||
body.value = "";
|
||||
props.clickClose();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<q-dialog v-model="props.modal" persistent>
|
||||
<q-card style="width: 40vw; max-width: 40vw">
|
||||
<q-form greedy @submit.prevent @validation-success="onSubmit">
|
||||
<DialogHeader tittle="ส่งข้อความ" :close="clickClose" />
|
||||
<DialogHeader
|
||||
:tittle="
|
||||
type === 'Administrator'
|
||||
? 'ส่งข้อความไปยังผู้ดูแลระบบของหน่วยงาน'
|
||||
: 'ส่งข้อความ'
|
||||
"
|
||||
:close="onClose"
|
||||
/>
|
||||
<q-separator />
|
||||
<q-card-section class="q-pa-sm bg-grey-1">
|
||||
<div class="row col-12 q-col-gutter-sm">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue