diff --git a/src/modules/09_leave/components/1_Work/DialogEdit.vue b/src/modules/09_leave/components/1_Work/DialogEdit.vue new file mode 100644 index 000000000..308fb3f45 --- /dev/null +++ b/src/modules/09_leave/components/1_Work/DialogEdit.vue @@ -0,0 +1,167 @@ + + + + + + + + + + + สถานะช่วงเช้า + filterFnOptions(inputValue, doneFn)" + > + + + ไม่มีข้อมูล + + + + + + + + สถานะช่วงบ่าย + filterFnOptions(inputValue, doneFn)" + > + + + ไม่มีข้อมูล + + + + + + + + + + + + + + + + + + + + diff --git a/src/modules/09_leave/components/1_Work/TableList.vue b/src/modules/09_leave/components/1_Work/TableList.vue index 27b8930b1..9c52c2e43 100644 --- a/src/modules/09_leave/components/1_Work/TableList.vue +++ b/src/modules/09_leave/components/1_Work/TableList.vue @@ -6,6 +6,7 @@ import type { QTableProps } from "quasar"; /** importComponents */ import DialogDetail from "@/modules/09_leave/components/1_Work/DialogDetail.vue"; +import DialogEdit from "@/modules/09_leave/components/1_Work/DialogEdit.vue"; /** importStores */ import { useCounterMixin } from "@/stores/mixin"; @@ -45,6 +46,7 @@ const emit = defineEmits(["update:pagination"]); /** ข้อมูล popup */ const modal = ref(false); const dataDetail = ref([]); +const modalEdit = ref(false); /** pagination */ const currentPage = ref(1); @@ -65,6 +67,7 @@ function updateProp(newPagination: any, page: number) { } const typeTab = ref(""); + /** * Function openPopup และแสดงรายละเอียด * @param data ข้อมูลรายละเอียด @@ -75,6 +78,11 @@ function clickDetail(data: any) { dataDetail.value = data; } +function onClickEdit(data: any) { + modalEdit.value = !modalEdit.value; + dataDetail.value = modalEdit.value ? data : []; +} + /** Function ปิด popup */ function closeDetail() { modal.value = false; @@ -93,6 +101,10 @@ function updateRowsPerPagen(newPagination: any) { pagination.value.rowsPerPage = newPagination.rowsPerPage; currentPage.value = 1; } + +onMounted(() => { + typeTab.value = props.tab as string; +}); @@ -115,6 +127,7 @@ function updateRowsPerPagen(newPagination: any) { {{ col.label }} + @@ -156,6 +169,18 @@ function updateRowsPerPagen(newPagination: any) { {{ col.value }} + + + แก้ไข + + @@ -177,6 +202,7 @@ function updateRowsPerPagen(newPagination: any) { :typeTab="typeTab" :close="closeDetail" /> - + + diff --git a/src/modules/09_leave/components/3_Report/DetailReport.vue b/src/modules/09_leave/components/3_Report/DetailReport.vue index 0683e748b..2483038c7 100644 --- a/src/modules/09_leave/components/3_Report/DetailReport.vue +++ b/src/modules/09_leave/components/3_Report/DetailReport.vue @@ -46,8 +46,8 @@ const dateMonth = ref({ year: new Date().getFullYear(), }); const year = ref(new Date().getFullYear()); -const dateStart = ref(new Date()); -const dateEnd = ref(new Date()); +const dateStart = ref(new Date(year.value, 9, 1)); +const dateEnd = ref(new Date(year.value, 8, 30)); const employeeClass = ref("employee"); const yearType = ref("FULL"); const filterType = ref("daily"); @@ -68,7 +68,8 @@ const employeeClassMain = ref([ ]); const yearTypeOptionMain = ref([ { id: "FULL", name: "รายปี" }, - { id: "HAFT", name: "ครึ่งปี" }, + { id: "FIRSTHAFT", name: "ครึ่งปีแรก" }, + { id: "SECONDHAFT", name: "ครึ่งปีหลัง" }, ]); const employeeClassOption = ref(employeeClassMain.value); const yearTypeOptionOption = ref(yearTypeOptionMain.value); @@ -145,10 +146,19 @@ async function fetchReportTimeRecords(body: any) { }); } -async function fetchLeaveday(type: string, year: string) { +async function fetchLeaveday( + type: string, + year: string, + startDate: Date, + endDate: Date +) { showLoader(); + const body = { type: year, + year: 2024, + startDate: dateToISO(startDate), + endDate: dateToISO(endDate), }; await http @@ -188,7 +198,6 @@ async function updateMonth() { // วันสิ้นสุดของเดือนถัดไป const lastDay = new Date(dateMonth.value.year, mount, 0); - console.log(firstDay, lastDay); const body = { startDate: dateToISO(firstDay), @@ -263,7 +272,23 @@ async function genReportXLSX(data: any) { } async function updateLeaveday() { - fetchLeaveday(employeeClass.value, yearType.value); + if (yearType.value === "FULL") { + dateStart.value = new Date(year.value, 9, 1); + dateEnd.value = new Date(year.value, 8, 30); + } else if (yearType.value === "FIRSTHAFT") { + dateStart.value = new Date(year.value, 9, 1); + dateEnd.value = new Date(year.value, 2, 31); + } else if (yearType.value === "SECONDHAFT") { + dateStart.value = new Date(year.value, 3, 1); + dateEnd.value = new Date(year.value, 8, 30); + } + + fetchLeaveday( + employeeClass.value, + yearType.value, + dateStart.value, + dateEnd.value + ); } async function downloadReport(data: any, type: string) { @@ -281,9 +306,15 @@ onMounted(() => { startDate: dateToISO(date.value), endDate: dateToISO(date.value), }; + typeReport === "time-records" ? fetchReportTimeRecords(body) - : fetchLeaveday(employeeClass.value, yearType.value); + : fetchLeaveday( + employeeClass.value, + yearType.value, + dateStart.value, + dateEnd.value + ); }); @@ -516,19 +547,19 @@ onMounted(() => { - + + + + {{ year + 543 }} + {{ + parseInt(value + 543) + }} + + + + + + + + - --> + + + {{ year + 543 }} + {{ + parseInt(value + 543) + }} + + + + + + + + + + +