diff --git a/src/modules/05_leave/componenst/Forms/01_SickForm.vue b/src/modules/05_leave/componenst/Forms/01_SickForm.vue index eade6b9..b446ab5 100644 --- a/src/modules/05_leave/componenst/Forms/01_SickForm.vue +++ b/src/modules/05_leave/componenst/Forms/01_SickForm.vue @@ -1,294 +1,347 @@ + diff --git a/src/modules/05_leave/componenst/Forms/09_StudyForm.vue b/src/modules/05_leave/componenst/Forms/09_StudyForm.vue index 4a2123a..2822191 100644 --- a/src/modules/05_leave/componenst/Forms/09_StudyForm.vue +++ b/src/modules/05_leave/componenst/Forms/09_StudyForm.vue @@ -5,7 +5,7 @@ import type { FormRef09 } from "@/modules/05_leave/interface/request/AddAbsence" import { useQuasar } from "quasar"; const $q = useQuasar(); const mixin = useCounterMixin(); -const { date2Thai, dialogConfirm ,arabicNumberToText} = mixin; +const { date2Thai, dialogConfirm ,arabicNumberToText, calculateDurationYmd} = mixin; const edit = ref(true); const props = defineProps({ data: { @@ -96,23 +96,7 @@ function onSubmit() { "ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?" ); } -function calculateDuration(startDate: string | null, endDate: string | null) { - if (startDate && endDate) { - const start = new Date(startDate); - const end = new Date(endDate); - const duration = end.getTime() - start.getTime(); // ระยะเวลาในมิลลิวินาที - - const days = Math.floor(duration / (1000 * 60 * 60 * 24)); - const months = Math.floor(duration / (1000 * 60 * 60 * 24 * 30.44)); - const years = Math.floor(duration / (1000 * 60 * 60 * 24 * 30.44 * 12)); - - // return `${days} วัน, ${months} เดือน, ${years} ปี`; - return `${years} ปี, ${months} เดือน, ${days} วัน`; - } - - return ""; -} const formattedSalary = computed(() => { return formData.salary !== null ? formData.salary.toLocaleString("th-TH") @@ -334,7 +318,7 @@ const formattedSalary = computed(() => { > ระยะเวลา {{ - calculateDuration(formData.dateLeaveStart, formData.dateLeaveEnd) + calculateDurationYmd(formData.dateLeaveStart, formData.dateLeaveEnd) }}

diff --git a/src/modules/05_leave/componenst/Forms/10_TrainForm.vue b/src/modules/05_leave/componenst/Forms/10_TrainForm.vue index 4de1206..390cc17 100644 --- a/src/modules/05_leave/componenst/Forms/10_TrainForm.vue +++ b/src/modules/05_leave/componenst/Forms/10_TrainForm.vue @@ -5,7 +5,7 @@ import type { FormRef10 } from "@/modules/05_leave/interface/request/AddAbsence" import { useQuasar } from "quasar"; const $q = useQuasar(); const mixin = useCounterMixin(); -const { date2Thai, dialogConfirm ,arabicNumberToText} = mixin; +const { date2Thai, dialogConfirm ,arabicNumberToText, calculateDurationYmd} = mixin; const edit = ref(true); const props = defineProps({ data: { @@ -93,23 +93,7 @@ function onSubmit() { "ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?" ); } -function calculateDuration(startDate: string | null, endDate: string | null) { - if (startDate && endDate) { - const start = new Date(startDate); - const end = new Date(endDate); - const duration = end.getTime() - start.getTime(); // ระยะเวลาในมิลลิวินาที - - const days = Math.floor(duration / (1000 * 60 * 60 * 24)); - const months = Math.floor(duration / (1000 * 60 * 60 * 24 * 30.44)); - const years = Math.floor(duration / (1000 * 60 * 60 * 24 * 30.44 * 12)); - - // return `${days} วัน, ${months} เดือน, ${years} ปี`; - return `${years} ปี, ${months} เดือน, ${days} วัน`; - } - - return ""; -} const formattedSalary = computed(() => { return formData.salary !== null ? formData.salary.toLocaleString("th-TH") @@ -331,7 +315,7 @@ const formattedSalary = computed(() => { > ระยะเวลา {{ - calculateDuration(formData.dateLeaveStart, formData.dateLeaveEnd) + calculateDurationYmd(formData.dateLeaveStart, formData.dateLeaveEnd) }}

diff --git a/src/modules/05_leave/componenst/Forms/13_RehabilitationForm.vue b/src/modules/05_leave/componenst/Forms/13_RehabilitationForm.vue index fce3bdc..655b8f7 100644 --- a/src/modules/05_leave/componenst/Forms/13_RehabilitationForm.vue +++ b/src/modules/05_leave/componenst/Forms/13_RehabilitationForm.vue @@ -5,7 +5,7 @@ import type { FormRef13 } from "@/modules/05_leave/interface/request/AddAbsence" import { useQuasar } from "quasar"; const $q = useQuasar(); const mixin = useCounterMixin(); -const { date2Thai, dialogConfirm, arabicNumberToText } = mixin; +const { date2Thai, dialogConfirm, calculateDurationYmd } = mixin; const edit = ref(true); const isSave = ref(false); const props = defineProps({ @@ -60,38 +60,23 @@ function onSubmit() { dialogConfirm( $q, async () => { - if(isSave.value === false){ + if (isSave.value === false) { props.onSubmit(); console.log(formData); isSave.value = true; - }else{ - console.log('savefile อัปโหลด',filesUpload.value) + } else { + console.log("savefile อัปโหลด", filesUpload.value); } }, - !isSave.value ? - "ยืนยันการบันทึกข้อมูล":"ยืนยันการอัพโหลดไฟล์", - !isSave.value ? "ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?":"ต้องการยืนยันการอัพโหลดไฟล์นี้หรือไม่ ?" + !isSave.value ? "ยืนยันการบันทึกข้อมูล" : "ยืนยันการอัพโหลดไฟล์", + !isSave.value + ? "ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?" + : "ต้องการยืนยันการอัพโหลดไฟล์นี้หรือไม่ ?" ); } -function calculateDuration(startDate: string | null, endDate: string | null) { - if (startDate && endDate) { - const start = new Date(startDate); - const end = new Date(endDate); - const duration = end.getTime() - start.getTime(); // ระยะเวลาในมิลลิวินาที - - const days = Math.floor(duration / (1000 * 60 * 60 * 24)); - const months = Math.floor(duration / (1000 * 60 * 60 * 24 * 30.44)); - const years = Math.floor(duration / (1000 * 60 * 60 * 24 * 30.44 * 12)); - - // return `${days} วัน, ${months} เดือน, ${years} ปี`; - return `${years} ปี, ${months} เดือน, ${days} วัน`; - } - - return ""; -} -function upLoadFile(){ - console.log('upload',filesUpload.value) +function upLoadFile() { + console.log("upload", filesUpload.value); } @@ -218,7 +203,7 @@ function upLoadFile(){ > ระยะเวลา {{ - calculateDuration(formData.dateLeaveStart, formData.dateLeaveEnd) + calculateDurationYmd(formData.dateLeaveStart, formData.dateLeaveEnd) }}

@@ -273,6 +258,7 @@ function upLoadFile(){ +
@@ -285,50 +271,60 @@ function upLoadFile(){
ดาวน์โหลด
- +
-
+
อัพโหลด
- - - - + + +
- อัปโหลด + อัปโหลด
+
- - - -
- - + +
+ + +
-
diff --git a/src/modules/05_leave/componenst/Forms/Form.vue b/src/modules/05_leave/componenst/Forms/Form.vue index a8d3cf1..646615d 100644 --- a/src/modules/05_leave/componenst/Forms/Form.vue +++ b/src/modules/05_leave/componenst/Forms/Form.vue @@ -140,7 +140,7 @@ const formData = reactive({ readonly bg-color="white" v-model="formData.leaveReceived" - label="จำนวนสิทธิ์การลาที่ได้รับในแต่ละประเภท" + label="จำนวนสิทธิ์การลาที่ได้รับ" /> ({ readonly bg-color="white" v-model="formData.leaveUse" - label="จำนวนสิทธิ์การลาที่ใช้ไปในแต่ละประเภท" + label="จำนวนสิทธิ์การลาที่ใช้ไป" /> ({ readonly bg-color="white" v-model="formData.leaveRemaining" - label="จำนวนสิทธิ์การลาคงเหลือในแต่ละประเภท" + label="จำนวนสิทธิ์การลาคงเหลือ" /> diff --git a/src/modules/05_leave/views/AddPage.vue b/src/modules/05_leave/views/AddPage.vue index 6df28d5..45ecc06 100644 --- a/src/modules/05_leave/views/AddPage.vue +++ b/src/modules/05_leave/views/AddPage.vue @@ -27,14 +27,10 @@ const route = useRoute(); const myform = ref(null); const $q = useQuasar(); -const model = ref(""); -const modelSpecific = ref(""); +const model = ref(""); +const modelSpecific = ref(""); -const clickBack = () => { - router.push(`/leave`); -}; - -onMounted(() => {}); +// onMounted(() => {}); const saveAbsence = () => { $q.dialog({ @@ -63,11 +59,13 @@ const onSubmit = async () => { console.log("save"); }; + - diff --git a/src/stores/mixin.ts b/src/stores/mixin.ts index 58ab4fe..6bd56c2 100644 --- a/src/stores/mixin.ts +++ b/src/stores/mixin.ts @@ -931,6 +931,24 @@ export const useCounterMixin = defineStore("mixin", () => { } } + function calculateDurationYmd(startDate: string | null, endDate: string | null) { + if (startDate && endDate) { + const start = new Date(startDate); + const end = new Date(endDate); + + const duration = end.getTime() - start.getTime(); // ระยะเวลาในมิลลิวินาที + + const days = Math.floor(duration / (1000 * 60 * 60 * 24)); + const months = Math.floor(duration / (1000 * 60 * 60 * 24 * 30.44)); + const years = Math.floor(duration / (1000 * 60 * 60 * 24 * 30.44 * 12)); + + // return `${days} วัน, ${months} เดือน, ${years} ปี`; + return `${years} ปี, ${months} เดือน, ${days} วัน`; + } + + return ""; + } + return { calAge, date2Thai, @@ -963,5 +981,6 @@ export const useCounterMixin = defineStore("mixin", () => { dialogConfirm, dialogRemove, arabicNumberToText, + calculateDurationYmd }; });