휴가선물 마이너스일 때 불가능

This commit is contained in:
dyhj625 2025-03-25 16:06:14 +09:00
parent 04391cc9d9
commit c8662e72bf
2 changed files with 14 additions and 3 deletions

View File

@ -13,7 +13,7 @@
<button @click="increaseCount" :disabled="grantCount >= availableQuota" class="count-btn">+</button> <button @click="increaseCount" :disabled="grantCount >= availableQuota" class="count-btn">+</button>
</div> </div>
<div class="custom-button-container"> <div class="custom-button-container">
<button class="custom-button" @click="saveVacationGrant" :disabled="grantCount === 0"> <button class="custom-button" @click="saveVacationGrant" :disabled="grantCount === 0 || isGiftButtonDisabled">
<i class="bx bx-gift"></i> <i class="bx bx-gift"></i>
</button> </button>
</div> </div>
@ -23,14 +23,16 @@
</template> </template>
<script setup> <script setup>
import { ref, defineProps, defineEmits, watch, onMounted } from "vue"; import { ref, defineProps, defineEmits, watch, onMounted, computed } from "vue";
import axios from "@api"; import axios from "@api";
import { useToastStore } from '@s/toastStore'; import { useToastStore } from '@s/toastStore';
import { useUserInfoStore } from "@s/useUserInfoStore";
const userStore = useUserInfoStore();
const toastStore = useToastStore(); const toastStore = useToastStore();
const props = defineProps({ const props = defineProps({
isOpen: Boolean, isOpen: Boolean,
targetUser: Object, targetUser: Object,
remainingVacationData: Object,
}); });
const emit = defineEmits(["close", "updateVacation"]); const emit = defineEmits(["close", "updateVacation"]);
@ -39,6 +41,14 @@ const maxQuota = 2;
const sentCount = ref(0); const sentCount = ref(0);
const availableQuota = ref(2); const availableQuota = ref(2);
const myUserId = computed(() => userStore.user.id);
const myRemainingQuota = computed(() => {
return props.remainingVacationData?.[myUserId.value] ?? 0;
});
const isGiftButtonDisabled = computed(() => {
return myRemainingQuota.value <= 0;
});
console.log(myRemainingQuota.value)
// //
const fetchSentVacationCount = async () => { const fetchSentVacationCount = async () => {
try { try {

View File

@ -32,6 +32,7 @@
:isOpen="isGrantModalOpen" :isOpen="isGrantModalOpen"
:targetUser="selectedUser" :targetUser="selectedUser"
:remainingQuota="remainingVacationData[selectedUser?.MEMBERSEQ] || 0" :remainingQuota="remainingVacationData[selectedUser?.MEMBERSEQ] || 0"
:remainingVacationData="remainingVacationData"
@close="isGrantModalOpen = false" @close="isGrantModalOpen = false"
@updateVacation="fetchRemainingVacation" @updateVacation="fetchRemainingVacation"
/> />