휴가선물 마이너스일 때 불가능
This commit is contained in:
parent
04391cc9d9
commit
c8662e72bf
@ -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 {
|
||||||
|
|||||||
@ -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"
|
||||||
/>
|
/>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user