diff --git a/src/components/CurruncyInput.vue b/src/components/CurruncyInput.vue index b92c8e38f..8d535b1ce 100644 --- a/src/components/CurruncyInput.vue +++ b/src/components/CurruncyInput.vue @@ -39,7 +39,7 @@ const props = defineProps({ const { inputRef, formattedValue, setValue } = useCurrencyInput({ locale: "en-US", currency: "EUR", - currencyDisplay: "hidden", + // currencyDisplay: "hidden", hideCurrencySymbolOnFocus: true, hideGroupingSeparatorOnFocus: true, hideNegligibleDecimalDigitsOnFocus: true, diff --git a/src/modules/04_registry/components/DialogHistory.vue b/src/modules/04_registry/components/DialogHistory.vue index eeb90a358..34f8524cc 100644 --- a/src/modules/04_registry/components/DialogHistory.vue +++ b/src/modules/04_registry/components/DialogHistory.vue @@ -1,6 +1,6 @@ @@ -739,7 +738,10 @@ const fetchData = async () => { totalLeave: e.totalLeave, status: e.status, reason: e.reason, - typeLeaveId: e.typeLeaveId, + typeLeaveId: + e.typeLeaveId !== "00000000-0000-0000-0000-000000000000" + ? e.typeLeaveId + : "", }); }); }) @@ -794,7 +796,10 @@ const clickHistory = async (row: RequestItemsObject) => { totalLeave: e.totalLeave, status: e.status, reason: e.reason, - typeLeaveId: e.typeLeaveId, + typeLeaveId: + e.typeLeaveId !== "00000000-0000-0000-0000-000000000000" + ? e.typeLeaveId + : "", }); }); }) diff --git a/src/modules/04_registry/components/Salary.vue b/src/modules/04_registry/components/Salary.vue index 6225b1a57..0bd1a120c 100644 --- a/src/modules/04_registry/components/Salary.vue +++ b/src/modules/04_registry/components/Salary.vue @@ -388,9 +388,10 @@ :options="{ currency: 'THB', }" - :rules="[(val: string) => !!val || `${'กรุณากรอกเงินเดือน'}`]" :label="`${'เงินเดือน'}`" + :rules="[(val: number) => !!val || `${'กรุณากรอกเงินเดือน'}`]" /> +
- --> +
@@ -581,6 +590,7 @@ import HistoryTable from "@/components/TableHistory.vue"; import http from "@/plugins/http"; import config from "@/app.config"; import type { QTableProps } from "quasar"; +import CurrencyInput from "@/components/CurruncyInput.vue"; const props = defineProps({ statusEdit: { @@ -602,6 +612,7 @@ const { dialogMessage, showLoader, hideLoader, + dialogConfirm, } = mixin; const route = useRoute(); const id = ref(""); @@ -939,7 +950,7 @@ profileData.salary.columns.length == 0 "mouthSalaryAmount", "oc", "positionEmployeePosition", - "posNo", + "posNoEmployee", "positionEmployeePositionSide", "positionEmployeeLevel", "positionEmployeeGroup", @@ -1016,11 +1027,11 @@ const columns = ref([ a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), }, { - name: "posNo", + name: "posNoEmployee", align: "left", label: "ตำแหน่งเลขที่", sortable: true, - field: "posNo", + field: "posNoEmployee", headerStyle: "font-size: 14px", style: "font-size: 14px", sort: (a: string, b: string) => @@ -1481,9 +1492,9 @@ const fetchData = async () => { .get(config.API.profileSalaryEmployeeId(profileId.value)) .then((res) => { const data = res.data.result; - // console.log(data); + console.log(data); rows.value = []; - data.map((e: ResponseObjectEmployee) => { + data.map((e: any) => { rows.value.push({ id: e.id, date: new Date(e.date), @@ -1493,16 +1504,35 @@ const fetchData = async () => { oc: e.oc, ocId: e.ocId, posNo: e.posNo, - posNoId: e.posNoId, + posNoId: + e.posNoId !== "00000000-0000-0000-0000-000000000000" + ? e.posNoId + : "", posNoEmployee: e.posNoEmployee, positionEmployeeGroup: e.positionEmployeeGroup, - positionEmployeeGroupId: e.positionEmployeeGroupId, + positionEmployeeGroupId: + e.positionEmployeeGroupId !== + "00000000-0000-0000-0000-000000000000" + ? e.positionEmployeeGroupId + : "", positionEmployeeLevel: e.positionEmployeeLevel, - positionEmployeeLevelId: e.positionEmployeeLevelId, + positionEmployeeLevelId: + e.positionEmployeeLevelId !== + "00000000-0000-0000-0000-000000000000" + ? e.positionEmployeeLevelId + : "", positionEmployeePosition: e.positionEmployeePosition, - positionEmployeePositionId: e.positionEmployeePositionId, + positionEmployeePositionId: + e.positionEmployeePositionId !== + "00000000-0000-0000-0000-000000000000" + ? e.positionEmployeePositionId + : "", positionEmployeePositionSide: e.positionEmployeePositionSide, - positionEmployeePositionSideId: e.positionEmployeePositionSideId, + positionEmployeePositionSideId: + e.positionEmployeePositionSideId !== + "00000000-0000-0000-0000-000000000000" + ? e.positionEmployeePositionSideId + : "", salaryClass: e.salaryClass, salaryRef: e.salaryRef, refCommandNo: e.refCommandNo, @@ -1687,12 +1717,29 @@ const templateDetail = async () => { * กดบันทึกใน dialog */ const clickSave = async () => { + if (amount.value === 0) { + amount.value = null; + } myForm.value.validate().then(async (result: boolean) => { if (result) { if (modalEdit.value) { - await editData(); + dialogConfirm( + $q, + async () => { + await editData(); + }, + "ยืนยันการแก้ไขข้อมูล", + "ต้องการยืนยันการแก้ไขข้อมูลนี้หรือไม่ ?" + ); } else { - await saveData(); + dialogConfirm( + $q, + async () => { + await saveData(); + }, + "ยืนยันการเพิ่มข้อมูล", + "ต้องการยืนยันการเพิ่มข้อมูลนี้หรือไม่ ?" + ); } } }); @@ -1872,7 +1919,7 @@ const addData = () => { modal.value = true; edit.value = true; date.value = new Date(); - amount.value = null; + amount.value = 0; positionSalaryAmount.value = null; mouthSalaryAmount.value = null; @@ -1944,7 +1991,7 @@ const clickHistory = async (row: RequestItemsEmployee) => { modalHistory.value = true; showLoader(); await http - .get(config.API.profileSalaryHisId(row.id)) + .get(config.API.profileSalaryEmployeeHisId(row.id)) .then((res) => { const data = res.data.result; // console.log("clickHistory", data); diff --git a/src/modules/04_registry/components/SalaryEmployeeTemp.vue b/src/modules/04_registry/components/SalaryEmployeeTemp.vue index 373848dec..ab24a1127 100644 --- a/src/modules/04_registry/components/SalaryEmployeeTemp.vue +++ b/src/modules/04_registry/components/SalaryEmployeeTemp.vue @@ -306,7 +306,7 @@ />
-->
- --> +
@@ -556,6 +565,7 @@ import HistoryTable from "@/components/TableHistory.vue"; import http from "@/plugins/http"; import config from "@/app.config"; import type { QTableProps } from "quasar"; +import CurrencyInput from "@/components/CurruncyInput.vue"; const props = defineProps({ statusEdit: { @@ -577,6 +587,7 @@ const { dialogMessage, showLoader, hideLoader, + dialogConfirm, } = mixin; const route = useRoute(); const id = ref(""); @@ -1522,16 +1533,35 @@ const fetchData = async () => { oc: e.oc, ocId: e.ocId, posNo: e.posNo, - posNoId: e.posNoId, + posNoId: + e.posNoId !== "00000000-0000-0000-0000-000000000000" + ? e.posNoId + : "", posNoEmployee: e.posNoEmployee, positionEmployeeGroup: e.positionEmployeeGroup, - positionEmployeeGroupId: e.positionEmployeeGroupId, + positionEmployeeGroupId: + e.positionEmployeeGroupId !== + "00000000-0000-0000-0000-000000000000" + ? e.positionEmployeeGroupId + : "", positionEmployeeLevel: e.positionEmployeeLevel, - positionEmployeeLevelId: e.positionEmployeeLevelId, + positionEmployeeLevelId: + e.positionEmployeeLevelId !== + "00000000-0000-0000-0000-000000000000" + ? e.positionEmployeeLevelId + : "", positionEmployeePosition: e.positionEmployeePosition, - positionEmployeePositionId: e.positionEmployeePositionId, + positionEmployeePositionId: + e.positionEmployeePositionId !== + "00000000-0000-0000-0000-000000000000" + ? e.positionEmployeePositionId + : "", positionEmployeePositionSide: e.positionEmployeePositionSide, - positionEmployeePositionSideId: e.positionEmployeePositionSideId, + positionEmployeePositionSideId: + e.positionEmployeePositionSideId !== + "00000000-0000-0000-0000-000000000000" + ? e.positionEmployeePositionSideId + : "", salaryClass: e.salaryClass, salaryRef: e.salaryRef, refCommandNo: e.refCommandNo, @@ -1716,12 +1746,29 @@ const templateDetail = async () => { * กดบันทึกใน dialog */ const clickSave = async () => { + if (amount.value == 0) { + amount.value = null; + } myForm.value.validate().then(async (result: boolean) => { if (result) { if (modalEdit.value) { - await editData(); + dialogConfirm( + $q, + async () => { + await editData(); + }, + "ยืนยันการแก้ไขข้อมูล", + "ต้องการยืนยันการแก้ไขข้อมูลนี้หรือไม่ ?" + ); } else { - await saveData(); + dialogConfirm( + $q, + async () => { + await saveData(); + }, + "ยืนยันการเพิ่มข้อมูล", + "ต้องการยืนยันการเพิ่มข้อมูลนี้หรือไม่ ?" + ); } } }); @@ -1901,7 +1948,7 @@ const addData = () => { modal.value = true; edit.value = true; date.value = new Date(); - amount.value = null; + amount.value = 0; positionSalaryAmount.value = null; mouthSalaryAmount.value = null; @@ -1973,7 +2020,7 @@ const clickHistory = async (row: RequestItemsEmployee) => { modalHistory.value = true; showLoader(); await http - .get(config.API.profileSalaryHisId(row.id)) + .get(config.API.profileSalaryEmployeeHisId(row.id)) .then((res) => { const data = res.data.result; // console.log("clickHistory", data); @@ -1988,16 +2035,33 @@ const clickHistory = async (row: RequestItemsEmployee) => { oc: e.oc, ocId: e.ocId, posNo: e.posNo, - posNoId: e.posNoId, + posNoId: + e.posNoId !== "00000000-0000-0000-0000-000000000000" + ? e.posNoId + : "", posNoEmployee: e.posNoEmployee, positionEmployeeGroup: e.positionEmployeeGroup, - positionEmployeeGroupId: e.positionEmployeeGroupId, + positionEmployeeGroupId: + e.positionEmployeeGroupId !== "00000000-0000-0000-0000-000000000000" + ? e.positionEmployeeGroupId + : "", positionEmployeeLevel: e.positionEmployeeLevel, - positionEmployeeLevelId: e.positionEmployeeLevelId, + positionEmployeeLevelId: + e.positionEmployeeLevelId !== "00000000-0000-0000-0000-000000000000" + ? e.positionEmployeeLevelId + : "", positionEmployeePosition: e.positionEmployeePosition, - positionEmployeePositionId: e.positionEmployeePositionId, + positionEmployeePositionId: + e.positionEmployeePositionId !== + "00000000-0000-0000-0000-000000000000" + ? e.positionEmployeePositionId + : "", positionEmployeePositionSide: e.positionEmployeePositionSide, - positionEmployeePositionSideId: e.positionEmployeePositionSideId, + positionEmployeePositionSideId: + e.positionEmployeePositionSideId !== + "00000000-0000-0000-0000-000000000000" + ? e.positionEmployeePositionSideId + : "", salaryClass: e.salaryClass, salaryRef: e.salaryRef, refCommandNo: e.refCommandNo, diff --git a/src/modules/04_registry/store.ts b/src/modules/04_registry/store.ts index 8b69ec17a..af09e0d0a 100644 --- a/src/modules/04_registry/store.ts +++ b/src/modules/04_registry/store.ts @@ -2,6 +2,7 @@ import { ref, computed } from "vue"; import { defineStore } from "pinia"; export const useProfileDataStore = defineStore("profile", () => { + const emplployeeClass = ref('') interface profile { main: { columns: String[] }; education: { columns: String[] }; @@ -79,5 +80,6 @@ export const useProfileDataStore = defineStore("profile", () => { changeBirth, retireText, changeRetireText, + emplployeeClass, }; }); diff --git a/src/modules/08_registryEmployee/views/Leave.vue b/src/modules/08_registryEmployee/views/Leave.vue index 6608958f3..f3c6517b5 100644 --- a/src/modules/08_registryEmployee/views/Leave.vue +++ b/src/modules/08_registryEmployee/views/Leave.vue @@ -390,7 +390,7 @@ const { dateToISO, showLoader, hideLoader, - dialogConfirm + dialogConfirm, } = mixin; const route = useRoute(); @@ -736,7 +736,10 @@ const fetchData = async () => { totalLeave: e.totalLeave, status: e.status, reason: e.reason, - typeLeaveId: e.typeLeaveId, + typeLeaveId: + e.typeLeaveId !== "00000000-0000-0000-0000-000000000000" + ? e.typeLeaveId + : "", }); }); }) @@ -791,7 +794,10 @@ const clickHistory = async (row: RequestItemsObject) => { totalLeave: e.totalLeave, status: e.status, reason: e.reason, - typeLeaveId: e.typeLeaveId, + typeLeaveId: + e.typeLeaveId !== "00000000-0000-0000-0000-000000000000" + ? e.typeLeaveId + : "", }); }); }) @@ -952,10 +958,10 @@ const clickCancel = async () => { // * กดบันทึกใน dialog // */ const clickSave = () => { - dialogConfirm($q,() => SaveData()) -} + dialogConfirm($q, () => SaveData()); +}; const SaveData = async () => { - await myFormAdd.value.validate().then(async (result: boolean) => { + await myFormAdd.value.validate().then(async (result: boolean) => { if (result) { if (modalEdit.value) { await editData(); diff --git a/src/modules/08_registryEmployee/views/SalaryEmployee.vue b/src/modules/08_registryEmployee/views/SalaryEmployee.vue index 8819beb13..f091f5739 100644 --- a/src/modules/08_registryEmployee/views/SalaryEmployee.vue +++ b/src/modules/08_registryEmployee/views/SalaryEmployee.vue @@ -1035,11 +1035,11 @@ const columns = ref([ a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), }, { - name: "posNo", + name: "posNoEmployee", align: "left", label: "ตำแหน่งเลขที่", sortable: true, - field: "posNo", + field: "posNoEmployee", headerStyle: "font-size: 14px", style: "font-size: 14px", sort: (a: string, b: string) => @@ -1286,7 +1286,7 @@ const visibleColumnsHistory = ref([ "mouthSalaryAmount", "oc", "positionEmployeePosition", - "posNo", + "posNoEmployee", "positionEmployeePositionSide", "positionEmployeeLevel", "positionEmployeeGroup", @@ -1710,18 +1710,33 @@ const templateDetail = async () => { /** * กดบันทึกใน dialog */ -const clickSave = () => { - dialogConfirm($q, () => SaveData()); -}; -const SaveData = async () => { +const clickSave = async () => { + // dialogConfirm($q, () => SaveData()); + if (amount.value == 0) { + amount.value = null; + } await myForm.value.validate().then(async (result: boolean) => { if (result && agencyId.value) { if (modalEdit.value) { - await editData(); + dialogConfirm( + $q, + async () => { + await editData(); + }, + "ยืนยันการแก้ไขข้อมูล", + "ต้องการยืนยันการแก้ไขข้อมูลนี้หรือไม่ ?" + ); } else { - await saveData(); + dialogConfirm( + $q, + async () => { + await saveData(); + }, + "ยืนยันการเพิ่มข้อมูล", + "ต้องการยืนยันการเพิ่มข้อมูลนี้หรือไม่ ?" + ); } - } else if (agencyId.value == "") { + } else if (result && agencyId.value == "") { dialogMessageNotify($q, "กรุณาเลือกหน่วยงาน"); } }); @@ -1903,7 +1918,7 @@ const addData = () => { modal.value = true; edit.value = true; date.value = new Date(); - amount.value = null; + amount.value = 0; positionSalaryAmount.value = null; mouthSalaryAmount.value = null; @@ -1975,7 +1990,7 @@ const clickHistory = async (row: RequestItemsEmployee) => { modalHistory.value = true; showLoader(); await http - .get(config.API.profileSalaryHisId(row.id)) + .get(config.API.profileSalaryEmployeeHisId(row.id)) .then((res) => { const data = res.data.result; console.log("clickHistory", data);