2026-01-16 09:49:12 +07:00
|
|
|
div
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { reactive, ref } from "vue";
|
|
|
|
|
import { useQuasar } from "quasar";
|
|
|
|
|
|
|
|
|
|
import { useRouter, useRoute } from "vue-router";
|
|
|
|
|
import { useCounterMixin } from "@/stores/mixin";
|
|
|
|
|
import http from "@/plugins/http";
|
|
|
|
|
import config from "@/app.config";
|
|
|
|
|
|
|
|
|
|
/** import components*/
|
|
|
|
|
import DialogHeader from "@/components/DialogHeader.vue";
|
|
|
|
|
|
|
|
|
|
//use
|
|
|
|
|
const $q = useQuasar();
|
|
|
|
|
const router = useRouter();
|
|
|
|
|
const route = useRoute();
|
2026-01-20 10:29:25 +07:00
|
|
|
const {
|
|
|
|
|
showLoader,
|
|
|
|
|
hideLoader,
|
|
|
|
|
messageError,
|
|
|
|
|
success,
|
|
|
|
|
date2Thai,
|
|
|
|
|
convertDateToAPI,
|
|
|
|
|
dialogConfirm,
|
|
|
|
|
} = useCounterMixin();
|
2026-01-16 09:49:12 +07:00
|
|
|
|
|
|
|
|
//props
|
|
|
|
|
const modal = defineModel<boolean>("modal", { required: true });
|
|
|
|
|
|
2026-01-16 16:00:24 +07:00
|
|
|
const profileId = ref<string>(route.params.id?.toString() ?? ""); //ProfileId
|
|
|
|
|
|
2026-01-16 09:49:12 +07:00
|
|
|
const form = reactive({
|
|
|
|
|
tranferOrg: "",
|
|
|
|
|
noteReason: "",
|
|
|
|
|
files: null as File | null,
|
2026-01-20 10:29:25 +07:00
|
|
|
date: null as Date | null,
|
2026-01-16 09:49:12 +07:00
|
|
|
});
|
|
|
|
|
|
2026-01-20 10:29:25 +07:00
|
|
|
function onSubmit() {
|
|
|
|
|
dialogConfirm($q, async () => {
|
|
|
|
|
try {
|
|
|
|
|
showLoader();
|
|
|
|
|
const formData = new FormData();
|
|
|
|
|
formData.append("ProfileId", profileId.value);
|
|
|
|
|
formData.append("Organization", form.tranferOrg);
|
|
|
|
|
formData.append("Reason", form.noteReason);
|
|
|
|
|
formData.append(
|
|
|
|
|
"Date",
|
|
|
|
|
form.date !== null ? (convertDateToAPI(form.date) as string) : ""
|
|
|
|
|
);
|
|
|
|
|
if (form.files) {
|
|
|
|
|
formData.append("file", form.files);
|
|
|
|
|
}
|
2026-01-16 09:49:12 +07:00
|
|
|
|
2026-01-20 10:29:25 +07:00
|
|
|
await http.post(config.API.transferAdmin, formData);
|
|
|
|
|
router.push({ name: "transfer" });
|
|
|
|
|
success($q, "บันทึกข้อมูลสำเร็จ");
|
|
|
|
|
} catch (error) {
|
|
|
|
|
messageError($q, error);
|
|
|
|
|
} finally {
|
|
|
|
|
hideLoader();
|
|
|
|
|
}
|
|
|
|
|
});
|
2026-01-16 09:49:12 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** function ปิด popup*/
|
|
|
|
|
function closeDialog() {
|
|
|
|
|
modal.value = false;
|
|
|
|
|
form.tranferOrg = "";
|
|
|
|
|
form.noteReason = "";
|
|
|
|
|
form.files = null;
|
2026-01-20 10:29:25 +07:00
|
|
|
form.date = null;
|
2026-01-16 09:49:12 +07:00
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<q-dialog v-model="modal" persistent>
|
|
|
|
|
<q-card style="width: 40vw; max-width: 50vw">
|
|
|
|
|
<q-form greedy @submit.prevent="onSubmit">
|
|
|
|
|
<DialogHeader :tittle="'ขอโอน'" :close="closeDialog" />
|
|
|
|
|
<q-separator />
|
|
|
|
|
|
|
|
|
|
<q-card-section class="q-pa-md">
|
|
|
|
|
<div class="col-12 row q-col-gutter-sm">
|
2026-01-20 10:29:25 +07:00
|
|
|
<div class="col-md-9 col-sm-12">
|
2026-01-16 09:49:12 +07:00
|
|
|
<q-input
|
|
|
|
|
class="inputgreen"
|
|
|
|
|
dense
|
|
|
|
|
outlined
|
|
|
|
|
v-model="form.tranferOrg"
|
|
|
|
|
hide-bottom-space
|
|
|
|
|
label="หน่วยงานที่ขอโอนไป"
|
|
|
|
|
:rules="[(val:string) => !!val || `${'กรุณากรอกหน่วยงานที่ขอโอนไป'}`]"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-01-20 10:29:25 +07:00
|
|
|
<div class="col-md-3 col-sm-12">
|
|
|
|
|
<datepicker
|
|
|
|
|
class="inputgreen"
|
|
|
|
|
menu-class-name="modalfix"
|
|
|
|
|
v-model="form.date"
|
|
|
|
|
:locale="'th'"
|
|
|
|
|
autoApply
|
|
|
|
|
borderless
|
|
|
|
|
:enableTimePicker="false"
|
|
|
|
|
week-start="0"
|
|
|
|
|
>
|
|
|
|
|
<template #year="{ year }">
|
|
|
|
|
{{ year + 543 }}
|
|
|
|
|
</template>
|
|
|
|
|
<template #year-overlay-value="{ value }">
|
|
|
|
|
{{ parseInt(value + 543) }}
|
|
|
|
|
</template>
|
|
|
|
|
<template #trigger>
|
|
|
|
|
<q-input
|
|
|
|
|
outlined
|
|
|
|
|
dense
|
|
|
|
|
hide-bottom-space
|
|
|
|
|
class="full-width"
|
|
|
|
|
:model-value="
|
|
|
|
|
form.date != null ? date2Thai(form.date) : null
|
|
|
|
|
"
|
|
|
|
|
:label="`${'ขอโอนตั้งแต่วันที่'}`"
|
|
|
|
|
:rules="[
|
|
|
|
|
(val: string) =>
|
|
|
|
|
!!val || `${'กรุณาเลือกวันที่ขอโอน'}`,
|
|
|
|
|
]"
|
|
|
|
|
>
|
|
|
|
|
<template v-slot:prepend>
|
|
|
|
|
<q-icon
|
|
|
|
|
name="event"
|
|
|
|
|
class="cursor-pointer"
|
|
|
|
|
style="color: var(--q-primary)"
|
|
|
|
|
>
|
|
|
|
|
</q-icon>
|
|
|
|
|
</template>
|
|
|
|
|
</q-input>
|
|
|
|
|
</template>
|
|
|
|
|
</datepicker>
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-01-16 09:49:12 +07:00
|
|
|
<div class="col-12">
|
|
|
|
|
<q-input
|
|
|
|
|
class="inputgreen"
|
|
|
|
|
dense
|
|
|
|
|
outlined
|
|
|
|
|
v-model="form.noteReason"
|
|
|
|
|
label="เหตุผล"
|
|
|
|
|
hide-bottom-space
|
|
|
|
|
type="textarea"
|
|
|
|
|
:rules="[(val:string) => !!val || `${'กรุณากรอกเหตุผล'}`]"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="col-12">
|
|
|
|
|
<q-file
|
|
|
|
|
v-model="form.files"
|
|
|
|
|
class="inputgreen"
|
|
|
|
|
outlined
|
|
|
|
|
dense
|
|
|
|
|
accept=".pdf"
|
|
|
|
|
label="เอกสารเพิ่มเติม"
|
|
|
|
|
>
|
|
|
|
|
<template v-slot:prepend>
|
|
|
|
|
<q-icon name="attach_file" /> </template
|
|
|
|
|
></q-file>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</q-card-section>
|
|
|
|
|
<q-separator />
|
|
|
|
|
|
|
|
|
|
<q-card-actions align="right">
|
|
|
|
|
<q-btn type="submit" :label="`บันทึก`" color="public">
|
|
|
|
|
<q-tooltip>บันทึก</q-tooltip>
|
|
|
|
|
</q-btn>
|
|
|
|
|
</q-card-actions>
|
|
|
|
|
</q-form>
|
|
|
|
|
</q-card>
|
|
|
|
|
</q-dialog>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style scoped></style>
|