diff --git a/src/modules/07_insignia/components/3_result/DialogForm.vue b/src/modules/07_insignia/components/3_result/DialogForm.vue index 2555ecbc8..714e6113e 100644 --- a/src/modules/07_insignia/components/3_result/DialogForm.vue +++ b/src/modules/07_insignia/components/3_result/DialogForm.vue @@ -50,7 +50,7 @@ const employeeClassOps = ref([ const listPerson = ref([]); const paymentOp = [ - { label: "จัดส่งทางไปรษณี", value: "จัดส่งทางไปรษณี" }, + { label: "จัดส่งทางไปรษณีย์", value: "จัดส่งทางไปรษณีย์" }, { label: "มารับด้วยตัวเอง", value: "มารับด้วยตัวเอง" }, ]; @@ -682,7 +682,7 @@ const filterSelector = (val: any, update: Function, name: any) => { :label="`เลือกรูปแบบการจ่าย`" /> -
+
+
+ +
+ + + + + +
+ + + + + + + + + +
+ + + + + + + diff --git a/src/modules/09_leave/interface/request/specialTime.ts b/src/modules/09_leave/interface/request/specialTime.ts new file mode 100644 index 000000000..ad40e5737 --- /dev/null +++ b/src/modules/09_leave/interface/request/specialTime.ts @@ -0,0 +1,12 @@ +interface ListData { + id: string; + fullname: string | null; + date: string | null; + dateFix: string | null; + startTimeMorning: string | null; + endTimeMorning: string | null; + startTimeAfternoon: string | null; + endTimeAfternoon: string | null; + status: string; +} +export type { ListData }; diff --git a/src/modules/09_leave/interface/response/specialTime.ts b/src/modules/09_leave/interface/response/specialTime.ts index 318a5ed5d..fa2d52ffe 100644 --- a/src/modules/09_leave/interface/response/specialTime.ts +++ b/src/modules/09_leave/interface/response/specialTime.ts @@ -1,11 +1,10 @@ interface DataRows { + id: string; fullname: string | null; date: string | null; dateFix: string | null; - type: string; - reason: string; - timeStamp: string; - unapprove?: string; // Make these properties optional - approve?: string; + timeMorning: string; + timeAfternoon: string; + status: string; } export type { DataRows }; diff --git a/src/modules/09_leave/stores/SpecialTimeStore.ts b/src/modules/09_leave/stores/SpecialTimeStore.ts index 9f233d1b9..fa33244b1 100644 --- a/src/modules/09_leave/stores/SpecialTimeStore.ts +++ b/src/modules/09_leave/stores/SpecialTimeStore.ts @@ -1,16 +1,22 @@ import { defineStore } from "pinia"; import { ref } from "vue"; import type { QTableProps } from "quasar"; +import type { DataRows } from "@/modules/09_leave/interface/response/specialTime"; +import type { ListData } from "@/modules/09_leave/interface/request/specialTime"; import { useCounterMixin } from "@/stores/mixin"; const mixin = useCounterMixin(); const { date2Thai } = mixin; export const useSpecialTimeStore = defineStore("LeaveSpecialTime", () => { const rows = ref([]); - async function fecthList(data: any[]) { - let datalist: any[] = data.map((e: any) => ({ + const selectDate = ref(new Date()); + const fiscalYear = ref("0"); + const DataMainOrig = ref([]); // ข้อมูลหลักดั้งเดิม + async function fecthList(data: ListData[]) { + let datalist: DataRows[] = data.map((e: ListData) => ({ + id: e.id, fullname: e.fullname, - date: date2Thai(new Date(e.date), false, true), + date: date2Thai(new Date(e.date)), dateFix: date2Thai(new Date(e.dateFix)), timeMorning: e.startTimeMorning == null @@ -23,7 +29,56 @@ export const useSpecialTimeStore = defineStore("LeaveSpecialTime", () => { status: e.status, })); rows.value = datalist; + DataMainOrig.value = datalist; } + const DataMainUpdate = ref([]); // ข้อมูลเปลี่ยนแปลง + const DataMain = (val: DataRows[]) => (DataMainOrig.value = val); + const DataUpdate = (filterYear: string) => { + DataMainUpdate.value = []; + if (filterYear === "") { + DataMainUpdate.value = DataMainOrig.value; + } + }; + + //--------------|ฟิลเตอร์|--------------------------------------// + const searchFilterTable = async (searchDate: any) => { + rows.value = []; + + if (fiscalYear.value !== undefined && searchDate.value !== null) { + await DataUpdate(searchDate.value === "0" ? "all" : searchDate.value!); + let filteredData = DataMainOrig.value; + if (searchDate.value !== "0") { + filteredData = filteredData.filter( + (item: DataRows) => item.date === searchDate.value + ); + console.log(searchDate.value); + } + const dataArr = filteredData.map((e: any) => ({ + fullname: e.fullname, + date: date2Thai(new Date(e.date)), + dateFix: date2Thai(new Date(e.dateFix)) + (e.timeStamp || ""), + type: e.type, + reason: e.reason, + timeStamp: e.timeStamp, + })); + rows.value = dataArr; + } + }; + + // const filterSelector = (val: any, update: Function, refData: string) => { + // switch (refData) { + // case "": + // update(() => { + // selectDate.value = selectDate.value.filter( + // (v: any) => v.name.indexOf(val) > -1 + // ); + // }); + // break; + + // default: + // break; + // } + // }; const visibleColumns = ref([ "no", @@ -96,5 +151,8 @@ export const useSpecialTimeStore = defineStore("LeaveSpecialTime", () => { rows, visibleColumns, columns, + DataMain, + searchFilterTable, + selectDate, }; }); diff --git a/src/modules/09_leave/views/SpecialTimeMain.vue b/src/modules/09_leave/views/SpecialTimeMain.vue index 7f5c3047b..1dd3d8bdc 100644 --- a/src/modules/09_leave/views/SpecialTimeMain.vue +++ b/src/modules/09_leave/views/SpecialTimeMain.vue @@ -47,6 +47,7 @@ const resetFilter = () => { onMounted(async () => { fecthList([ { + id: "00000000-0000-0000-0000-000000000000", fullname: "นางสาวณัฐกา ชมสิน", date: "2023-11-01 08:54", dateFix: "2023-10-30", @@ -57,6 +58,7 @@ onMounted(async () => { status: "PENDING", }, { + id: "00000000-0000-0000-0000-000000000000", fullname: "นางสาวรัชภรณ์ ภักดี", date: "2023-10-30 08:55", dateFix: "2023-10-29", @@ -67,6 +69,7 @@ onMounted(async () => { status: "APPROVE", }, { + id: "00000000-0000-0000-0000-000000000000", fullname: "นางสาวภาพรรณ ลออ", date: "2023-10-31 18:54", dateFix: "2023-10-30", @@ -220,6 +223,9 @@ const monthYearThai = (val: any) => { unelevated >อนุมัติ + + +