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

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>
</div>
<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>
</button>
</div>
@ -23,14 +23,16 @@
</template>
<script setup>
import { ref, defineProps, defineEmits, watch, onMounted } from "vue";
import { ref, defineProps, defineEmits, watch, onMounted, computed } from "vue";
import axios from "@api";
import { useToastStore } from '@s/toastStore';
import { useUserInfoStore } from "@s/useUserInfoStore";
const userStore = useUserInfoStore();
const toastStore = useToastStore();
const props = defineProps({
isOpen: Boolean,
targetUser: Object,
remainingVacationData: Object,
});
const emit = defineEmits(["close", "updateVacation"]);
@ -39,6 +41,14 @@ const maxQuota = 2;
const sentCount = ref(0);
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 () => {
try {

View File

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