이미 사용된 타입휴가 활성화 방지

This commit is contained in:
dyhj625 2025-03-25 10:35:09 +09:00
parent 44de501340
commit 0636f74c9b

View File

@ -143,6 +143,12 @@ const calendarOptions = reactive({
dateClick: handleDateClick,
datesSet: handleMonthChange,
events: calendarEvents,
customButtons: {
today: {
text: 'TODAY',
click: () => fullCalendarRef.value?.getApi().today(),
},
},
});
//
function handleMonthChange(viewInfo) {
@ -178,6 +184,21 @@ function handleDateClick(info) {
const isMyVacation = myVacations.value.some(vac => vac.date.substring(0, 10) === clickedDateStr && !vac.receiverId);
if (!selectedDates.value.has(clickedDateStr) && isMyVacation && halfDayType.value) {
const existingVacation = myVacations.value.find(vac => vac.date.substring(0, 10) === clickedDateStr && !vac.receiverId);
const selectedType =
halfDayType.value === "AM" ? "700101" :
halfDayType.value === "PM" ? "700102" : "700103";
if (existingVacation.type === selectedType) {
toastStore.onToast("이미 사용한 연차입니다.", "e");
if (halfDayButtonsRef.value) {
halfDayButtonsRef.value.resetHalfDay();
}
halfDayType.value = null;
return;
}
}
//
if (currentValue && currentValue !== "delete") {
selectedDates.value.delete(clickedDateStr);