diff --git a/src/modules/04_registryNew/components/detail/PersonalInformation/02_NameChangeHistory.vue b/src/modules/04_registryNew/components/detail/PersonalInformation/02_NameChangeHistory.vue index 91fd224cd..b5be35f35 100644 --- a/src/modules/04_registryNew/components/detail/PersonalInformation/02_NameChangeHistory.vue +++ b/src/modules/04_registryNew/components/detail/PersonalInformation/02_NameChangeHistory.vue @@ -24,20 +24,19 @@ const { success, dialogConfirm, messageError, - typeChangeName, showLoader, hideLoader, dialogRemove, } = mixin; -const { calculateAge, fetchPerson } = store; +const { fetchPerson } = store; const profileId = ref(route.params.id.toString()); const editId = ref(""); const dialog = ref(false); const dialogStatus = ref("create"); const filterSearch = ref(""); const filterHistory = ref(""); -const fileName = ref(""); + const modalHistory = ref(false); const rowsHistory = ref([]); const changeNameData = reactive({ @@ -50,20 +49,23 @@ const changeNameData = reactive({ documentId: "", }); +const profileInfo = ref([]); + const statusOption = ref([ "เปลี่ยนคำนำหน้าชื่อ", "เปลี่ยนชื่อ", "เปลี่ยนนามสกุล", "เปลี่ยนชื่อ-นามสกุล", + "เปลี่ยนคำนำหน้าชื่อ และชื่อ", "เปลี่ยนคำนำหน้าชื่อ และนามสกุล", "เปลี่ยนคำนำหน้าชื่อ และชื่อ-นามสกุล", ]); -const prefixFilter = ref([]); const statusOptionFilter = ref([ "เปลี่ยนคำนำหน้าชื่อ", "เปลี่ยนชื่อ", "เปลี่ยนนามสกุล", "เปลี่ยนชื่อ-นามสกุล", + "เปลี่ยนคำนำหน้าชื่อ และชื่อ", "เปลี่ยนคำนำหน้าชื่อ และนามสกุล", "เปลี่ยนคำนำหน้าชื่อ และชื่อ-นามสกุล", ]); @@ -258,13 +260,13 @@ function closeDialog() { dialog.value = false; } -function clearForm() { - changeNameData.status = ""; - changeNameData.prefix = ""; - changeNameData.firstName = ""; - changeNameData.lastName = ""; - alertUpload.value = false; -} +// function clearForm() { +// changeNameData.status = ""; +// changeNameData.prefix = ""; +// changeNameData.firstName = ""; +// changeNameData.lastName = ""; +// alertUpload.value = false; +// } async function onSubmit() { if (!!fileUpload.value) { @@ -334,6 +336,21 @@ async function uploadFileURL(uploadUrl: string, file: any) { }); } +async function fetchDataPersonal() { + showLoader(); + await http + .get(config.API.registryNewByProfileId(profileId.value)) + .then((res) => { + profileInfo.value = res.data.result; + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); +} + async function fetchProfile(id: string) { showLoader(); await http @@ -396,24 +413,23 @@ function editData(idData: string) { } function deleteData(idData: string) { - // dialogRemove($q, () => - http - .delete(config.API.profileNewChangeNameByChangeNameId(idData)) - .then(() => { - fetchData(profileId.value); - success($q, "ลบข้อมูลสำเร็จ"); - }) - .catch((err) => { - messageError($q, err); - }) - .finally(() => { - hideLoader(); - }); - // ); + dialogRemove($q, () => + http + .delete(config.API.profileNewChangeNameByChangeNameId(idData)) + .then(() => { + fetchData(profileId.value); + success($q, "ลบข้อมูลสำเร็จ"); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }) + ); } function deleteFileData(idData: string) { - // dialogRemove($q, () => http .delete( config.API.subFile( @@ -432,7 +448,6 @@ function deleteFileData(idData: string) { .finally(() => { hideLoader(); }); - // ); } async function fetchHistoryData(id: string) { @@ -487,9 +502,9 @@ onMounted(async () => { ) { await fetchPerson(); } - prefixFilter.value = store.Ops.prefixOps; fetchData(profileId.value); + fetchDataPersonal(); }); function filterSelector(val: string, update: Function, refData: string) { switch (refData) { @@ -502,7 +517,7 @@ function filterSelector(val: string, update: Function, refData: string) { break; case "prefixOps": update(() => { - store.Ops.prefixOps = prefixFilter.value.filter( + store.Ops.prefixOps = store.OpsFilter.prefixOps.filter( (v: any) => v.name.indexOf(val) > -1 ); }); @@ -523,9 +538,12 @@ function filterSelector(val: string, update: Function, refData: string) { size="16px" @click=" () => { + changeNameData.prefix = profileInfo.prefix; + changeNameData.firstName = profileInfo.firstName; + changeNameData.lastName = profileInfo.lastName; + changeNameData.status = ''; dialogStatus = 'create'; dialog = true; - clearForm(); } " > @@ -669,7 +687,7 @@ function filterSelector(val: string, update: Function, refData: string) { @@ -717,6 +735,15 @@ function filterSelector(val: string, update: Function, refData: string) {
-import { ref, onMounted, reactive, computed } from "vue"; +import { ref, onMounted, computed, watch } from "vue"; +import { useQuasar } from "quasar"; +import http from "@/plugins/http"; +import config from "@/app.config"; + import type { QTableProps } from "quasar"; import { useSalaryListSDataStore } from "@/modules/13_salary/store/SalaryListsStore"; +import { useCounterMixin } from "@/stores/mixin"; +const $q = useQuasar(); const store = useSalaryListSDataStore(); +const { messageError, showLoader, hideLoader } = useCounterMixin(); + +const props = defineProps({ + year: Number, + snapShot: String, + roundFilter: Object, +}); + +const gruup = ref("ALL"); +const options = ref([ + { id: "ALL", name: "ทั้งหมด" }, + { id: "group1", name: "กลุ่ม 1" }, + { id: "group2", name: "กลุ่ม 2" }, +]); /** itemsCard*/ const itemsCardAPR = ref([ @@ -256,8 +276,45 @@ const visibleColumns = ref( : [] ); -const gruup = ref("ทั้งหมด"); -const options = ref(["ทั้งหมด", "กลุ่ม 1", "กลุ่ม 2"]); +function fetchDataDashboard() { + const formData = { + year: props?.year, + group: gruup.value, + period: props?.roundFilter?.id, + snapshot: props?.snapShot, + }; + http + .post(config.API.salaryDashboardEmp, formData) + .then((res) => { + const quota = res.data.result.dashboard; + itemsCardAPR.value[0].total = quota.total; + itemsCardAPR.value[1].total = quota.fifteenPercent; + itemsCardAPR.value[2].total = quota.chosen; + itemsCardAPR.value[3].total = quota.remaining; + itemsCardAPR.value[4].total = quota.totalBackup; + + itemsCardOCT.value[0].total = quota.currentAmount; + itemsCardOCT.value[1].total = quota.sixPercentAmount; + itemsCardOCT.value[2].total = quota.spentAmount; + itemsCardOCT.value[3].total = quota.sixPercentSpentAmount; + itemsCardOCT.value[4].total = quota.useAmount; + itemsCardOCT.value[5].total = quota.remainingAmount; + itemsCardOCT.value[6].total = quota.totalBackup; + + rows.value = res.data.result.salaryOrg; + }) + .catch((err) => { + messageError($q, err); + }); +} + +onMounted(() => { + fetchDataDashboard(); +}); + +watch([() => props?.snapShot, () => props.roundFilter], () => { + fetchDataDashboard(); +});