รายละเอียดทุนการศึกษา/ฝึกอบรม
This commit is contained in:
parent
7666554388
commit
12c255e82f
4 changed files with 1309 additions and 28 deletions
327
src/modules/09_scholarship/components/Dialog/DialogReturn.vue
Normal file
327
src/modules/09_scholarship/components/Dialog/DialogReturn.vue
Normal file
|
|
@ -0,0 +1,327 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, watch } from "vue";
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useQuasar } from "quasar";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useRoute } from "vue-router";
|
||||
|
||||
const route = useRoute();
|
||||
const id = ref<string>(route.params.id.toLocaleString());
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
const {
|
||||
date2Thai,
|
||||
dialogMessageNotify,
|
||||
showLoader,
|
||||
hideLoader,
|
||||
messageError,
|
||||
dialogConfirm,
|
||||
success,
|
||||
} = mixin;
|
||||
const modal = defineModel<boolean>("modal", { required: true });
|
||||
|
||||
const governmentDate = ref<any>(null);
|
||||
const graduatedDate = ref<any>(null);
|
||||
const isGraduated = ref<any>(null);
|
||||
const graduatedReason = ref<string>("");
|
||||
|
||||
const bookNumber = ref<string>("");
|
||||
const bookDate = ref<any>(null);
|
||||
const governmentEndDate = ref<any>(null);
|
||||
|
||||
function close() {
|
||||
modal.value = false;
|
||||
|
||||
bookNumber.value = "";
|
||||
bookDate.value = null;
|
||||
governmentDate.value = null;
|
||||
governmentEndDate.value = null;
|
||||
|
||||
isGraduated.value = null;
|
||||
graduatedDate.value = null;
|
||||
graduatedReason.value = "";
|
||||
}
|
||||
|
||||
function onSubmit() {
|
||||
if (isGraduated.value == null) {
|
||||
dialogMessageNotify($q, "กรุณาเลือกสำเร็จการศึกษาตามที่หลักสูตรกำหนด");
|
||||
} else {
|
||||
dialogConfirm($q, () => {
|
||||
showLoader();
|
||||
http
|
||||
.put(config.API.developmentScholarship + `/user/detail/${id.value}`, {
|
||||
bookNumber: bookNumber.value,
|
||||
bookDate: bookDate.value,
|
||||
governmentDate: governmentDate.value,
|
||||
governmentEndDate: governmentEndDate.value,
|
||||
isGraduated: isGraduated.value,
|
||||
graduatedDate: isGraduated.value == 'true' ? graduatedDate.value : null,
|
||||
graduatedReason: isGraduated.value == 'false' ? graduatedReason.value : null,
|
||||
})
|
||||
.then((res) => {
|
||||
success($q, "บันทึกสำเร็จ");
|
||||
close();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => modal.value,
|
||||
() => {
|
||||
if (modal.value == true) {
|
||||
showLoader();
|
||||
http
|
||||
.get(config.API.developmentScholarship + `/user/detail/${id.value}`)
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
bookNumber.value = data.bookNumber;
|
||||
bookDate.value = data.bookDate;
|
||||
governmentDate.value = data.governmentDate;
|
||||
governmentEndDate.value = data.governmentEndDate;
|
||||
isGraduated.value = data.isGraduated.toLocaleString();
|
||||
graduatedDate.value = data.graduatedDate;
|
||||
graduatedReason.value = data.graduatedReason;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
</script>
|
||||
<template>
|
||||
<q-dialog v-model="modal">
|
||||
<q-card flat style="min-width: 30vw">
|
||||
<q-form greedy @submit.prevent @validation-success="onSubmit">
|
||||
<DialogHeader tittle="รายงานตัวกลับเข้ารับราชการ" :close="close" />
|
||||
<q-separator />
|
||||
<q-card-section>
|
||||
<div class="row q-col-gutter-sm">
|
||||
<div class="col-6">
|
||||
<q-input
|
||||
label="เลขที่หนังสือรายงานตัวกลับเข้าปฏิบัติราชการ"
|
||||
v-model="bookNumber"
|
||||
outlined
|
||||
lazy-rules
|
||||
dense
|
||||
hide-bottom-space
|
||||
:rules="[
|
||||
(val:string) =>
|
||||
!!val || `${'กรุณากรอกเลขที่หนังสือรายงานตัวกลับเข้าปฏิบัติราชการ'}`,
|
||||
]"
|
||||
class="inputgreen"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<datepicker
|
||||
menu-class-name="modalfix"
|
||||
v-model="bookDate"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
:enableTimePicker="false"
|
||||
week-start="0"
|
||||
>
|
||||
<template #year="{ year }">{{ year + 543 }}</template>
|
||||
<template #year-overlay-value="{ value }">{{
|
||||
parseInt(value + 543)
|
||||
}}</template>
|
||||
<template #trigger>
|
||||
<q-input
|
||||
dense
|
||||
outlined
|
||||
:model-value="bookDate ? date2Thai(bookDate) : null"
|
||||
:label="`${'หนังสือรายงานตัวกลับเข้าปฏิบัติราชการลงวันที่'}`"
|
||||
hide-bottom-space
|
||||
class="inputgreen"
|
||||
: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>
|
||||
<div class="col-6">
|
||||
<datepicker
|
||||
menu-class-name="modalfix"
|
||||
v-model="governmentDate"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
:enableTimePicker="false"
|
||||
week-start="0"
|
||||
>
|
||||
<template #year="{ year }">{{ year + 543 }}</template>
|
||||
<template #year-overlay-value="{ value }">{{
|
||||
parseInt(value + 543)
|
||||
}}</template>
|
||||
<template #trigger>
|
||||
<q-input
|
||||
dense
|
||||
outlined
|
||||
:model-value="
|
||||
governmentDate ? date2Thai(governmentDate) : null
|
||||
"
|
||||
:label="`${'วันที่กลับเข้าปฏิบัติราชการ'}`"
|
||||
hide-bottom-space
|
||||
class="inputgreen"
|
||||
: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>
|
||||
<div class="col-6">
|
||||
<datepicker
|
||||
menu-class-name="modalfix"
|
||||
v-model="governmentEndDate"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
:enableTimePicker="false"
|
||||
week-start="0"
|
||||
>
|
||||
<template #year="{ year }">{{ year + 543 }}</template>
|
||||
<template #year-overlay-value="{ value }">{{
|
||||
parseInt(value + 543)
|
||||
}}</template>
|
||||
<template #trigger>
|
||||
<q-input
|
||||
dense
|
||||
outlined
|
||||
:model-value="
|
||||
governmentEndDate ? date2Thai(governmentEndDate) : null
|
||||
"
|
||||
:label="`${' วันสิ้นสุดภาระผูกพัน'}`"
|
||||
hide-bottom-space
|
||||
class="inputgreen"
|
||||
: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>
|
||||
<q-radio
|
||||
v-model="isGraduated"
|
||||
checked-icon="task_alt"
|
||||
unchecked-icon="panorama_fish_eye"
|
||||
val="true"
|
||||
label="สำเร็จการศึกษาตามที่หลักสูตรกำหนด"
|
||||
/>
|
||||
|
||||
<q-radio
|
||||
v-model="isGraduated"
|
||||
checked-icon="task_alt"
|
||||
unchecked-icon="panorama_fish_eye"
|
||||
val="false"
|
||||
label="เสร็จสิ้นการศึกษาตามที่หลักสูตรกำหนดแล้วแต่ยังไม่สำเร็จการศึกษา"
|
||||
/>
|
||||
<div v-if="isGraduated == 'true'" class="col-12">
|
||||
<datepicker
|
||||
menu-class-name="modalfix"
|
||||
v-model="graduatedDate"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
:enableTimePicker="false"
|
||||
week-start="0"
|
||||
>
|
||||
<template #year="{ year }">{{ year + 543 }}</template>
|
||||
<template #year-overlay-value="{ value }">{{
|
||||
parseInt(value + 543)
|
||||
}}</template>
|
||||
<template #trigger>
|
||||
<q-input
|
||||
dense
|
||||
outlined
|
||||
:model-value="
|
||||
graduatedDate ? date2Thai(graduatedDate) : null
|
||||
"
|
||||
:label="`${'ตั้งแต่ (วันที่)'}`"
|
||||
hide-bottom-space
|
||||
class="inputgreen"
|
||||
: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>
|
||||
<div v-if="isGraduated == 'false'" class="col-12">
|
||||
<q-input
|
||||
v-model="graduatedReason"
|
||||
type="textarea"
|
||||
dense
|
||||
outlined
|
||||
hide-bottom-space
|
||||
class="inputgreen"
|
||||
:rules="[
|
||||
(val:string) =>
|
||||
!!val || `${'กรุณากรอก เนื่องจาก'}`,
|
||||
]"
|
||||
label="เนื่องจาก"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
<q-separator />
|
||||
<q-card-actions align="right">
|
||||
<q-btn label="บันทึก" color="secondary" type="submit"
|
||||
><q-tooltip>บันทึกข้อมูล</q-tooltip></q-btn
|
||||
>
|
||||
</q-card-actions>
|
||||
</q-form>
|
||||
</q-card>
|
||||
</q-dialog>
|
||||
</template>
|
||||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue