diff --git a/src/modules/13_salary/components/SalaryLists/DialogMoveLevel.vue b/src/modules/13_salary/components/SalaryLists/DialogMoveLevel.vue index 927edf3d1..bf17891a0 100644 --- a/src/modules/13_salary/components/SalaryLists/DialogMoveLevel.vue +++ b/src/modules/13_salary/components/SalaryLists/DialogMoveLevel.vue @@ -14,8 +14,14 @@ import { useSalaryListSDataStore } from "@/modules/13_salary/store/SalaryListsSt /** use*/ const $q = useQuasar(); const store = useSalaryListSDataStore(); -const { dialogConfirm, success, messageError, showLoader, hideLoader } = - useCounterMixin(); +const { + dialogConfirm, + success, + messageError, + showLoader, + hideLoader, + dialogMessageNotify, +} = useCounterMixin(); /**porps*/ const modal = defineModel("modal", { required: true }); @@ -48,7 +54,15 @@ const typeRangeOps = computed(() => { /*** ฟังก์ชั่นสำหรับ validate ฟอร์ม */ function validateForm() { if (typeRef.value.validate()) { - onSubmit(); + if ( + store.roundMainCode === "APR" && + store.remaining === 0 && + type.value === "FULL" + ) { + dialogMessageNotify($q, "ไม่สามารถย้ายขั้นได้เนื่องจากโควตาลงเหลือไม่พอ"); + } else { + onSubmit(); + } } } diff --git a/src/modules/13_salary/components/SalaryLists/TabMain.vue b/src/modules/13_salary/components/SalaryLists/TabMain.vue index 2c3ecafd1..82029d672 100644 --- a/src/modules/13_salary/components/SalaryLists/TabMain.vue +++ b/src/modules/13_salary/components/SalaryLists/TabMain.vue @@ -187,6 +187,7 @@ async function fetchDataQuota(id: string) { .get(config.API.salaryListPeriodQuota(id)) .then((res) => { const data = res.data.result; + store.remaining = data.remaining; itemsCard.value[0].total = data.total; itemsCard.value[1].total = data.fifteenPercent; itemsCard.value[2].total = data.chosen; diff --git a/src/modules/13_salary/store/SalaryListsStore.ts b/src/modules/13_salary/store/SalaryListsStore.ts index 93fcb323c..b30efff38 100644 --- a/src/modules/13_salary/store/SalaryListsStore.ts +++ b/src/modules/13_salary/store/SalaryListsStore.ts @@ -16,6 +16,8 @@ export const useSalaryListSDataStore = defineStore("salaryListStore", () => { { id: "", name: "กลุ่ม2" }, ]); + const remaining = ref(0); + const groupId = ref(""); const rootId = ref(""); const roundMainCode = ref(""); @@ -63,6 +65,8 @@ export const useSalaryListSDataStore = defineStore("salaryListStore", () => { rootId, roundCode, groupOp, - roundMainCode + roundMainCode, + + remaining, }; });