กล่องข้อความ => ปรับขนาด Popup

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-05-28 14:49:06 +07:00
parent feeb92b91d
commit e89d03cfa2
2 changed files with 25 additions and 26 deletions

View file

@ -10,7 +10,7 @@ import { useQuasar } from "quasar";
const mixin = useCounterMixin(); // const mixin = useCounterMixin(); //
const $q = useQuasar(); const $q = useQuasar();
const { showLoader, hideLoader, success, messageError } = mixin; const { showLoader, hideLoader, success, messageError, dialogConfirm } = mixin;
const myForm = ref<any>(); const myForm = ref<any>();
const props = defineProps({ const props = defineProps({
@ -30,35 +30,34 @@ const props = defineProps({
const subject = ref<string>(""); const subject = ref<string>("");
const body = ref<string>(""); const body = ref<string>("");
async function submit() { function onSubmit() {
myForm.value.validate().then(async (result: boolean) => { dialogConfirm($q, () => {
if (result) { showLoader();
// props.savaForm(reason.value); http
showLoader(); .put(config.API.replyMessage(props.idInbox), {
await http subject: subject.value,
.put(config.API.replyMessage(props.idInbox), { body: body.value,
subject: subject.value, })
body: body.value, .then(() => {
}) props.clickClose();
.then((res) => { success($q, "ส่งข้อความสำเร็จ");
props.clickClose() })
success($q, "ส่งข้อความสำเร็จ"); .catch((e) => {
}) messageError($q, e);
.catch((e) => { })
messageError($q, e); .finally(() => {
}) hideLoader();
.finally(() => { });
hideLoader();
});
}
}); });
} }
</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
<q-form ref="myForm"> :style="$q.screen.gt.xs ? 'width: 40vw; max-width: 40vw' : 'width: 100%'"
>
<q-form greedy @submit.prevent @validation-success="onSubmit">
<DialogHeader tittle="ส่งข้อความ" :close="clickClose" /> <DialogHeader tittle="ส่งข้อความ" :close="clickClose" />
<q-separator /> <q-separator />
<q-card-section class="q-pa-sm bg-grey-1"> <q-card-section class="q-pa-sm bg-grey-1">
@ -98,7 +97,7 @@ async function submit() {
unelevated unelevated
label="ส่งข้อความ" label="ส่งข้อความ"
color="public" color="public"
@click="submit" type="submit"
class="q-px-md" class="q-px-md"
> >
<!-- icon="mdi-content-save-outline" --> <!-- icon="mdi-content-save-outline" -->

View file

@ -11,7 +11,7 @@ const { date2Thai } = useCounterMixin();
const { scrollContainer } = storeToRefs(store); const { scrollContainer } = storeToRefs(store);
function getOnlineStatus(option: "icon" | "status") { function getOnlineStatus(option: "icon" | "status") {
const isAdmin = store.userStatus.some((u) => u.role.includes("admin")); const isAdmin = store.userStatus.some((u: any) => u.role.includes("admin"));
if (option === "icon") return isAdmin ? "green" : "grey"; if (option === "icon") return isAdmin ? "green" : "grey";
if (option === "status") return isAdmin ? "ออนไลน์" : "ออฟไลน์"; if (option === "status") return isAdmin ? "ออนไลน์" : "ออฟไลน์";
} }