휴가 수정정
This commit is contained in:
parent
f100706a83
commit
ec2f7cae09
@ -16,6 +16,7 @@
|
||||
height: 8px !important;
|
||||
border-radius: 2px !important;
|
||||
font-size: 0px !important;
|
||||
margin-left: -0.5% !important;
|
||||
}
|
||||
/* 오후 반차 그래프 (오른쪽 절반) */
|
||||
.fc-daygrid-event.half-day-pm {
|
||||
@ -24,6 +25,7 @@
|
||||
margin-left: auto !important;
|
||||
border-radius: 2px !important;
|
||||
font-size: 0px !important;
|
||||
margin-right: -0.5% !important;
|
||||
}
|
||||
/* 연차 그래프 (풀) */
|
||||
.fc-daygrid-event.full-day {
|
||||
@ -69,7 +71,7 @@ background-color: rgba(0, 0, 0, 0.05); /* 연한 배경 효과 */
|
||||
.fc-day-sat-sun {
|
||||
cursor: not-allowed !important;
|
||||
}
|
||||
/* 과거 날짜 (오늘 이전) */
|
||||
/* 과거 날짜 (오늘 -7일일) */
|
||||
.fc-daygrid-day.past {
|
||||
cursor: not-allowed !important;
|
||||
}
|
||||
|
||||
@ -291,5 +291,7 @@ onMounted(() => {
|
||||
color: #ff5733;
|
||||
border-radius: 4px;
|
||||
padding: 2px 6px;
|
||||
position: relative;
|
||||
top: -1px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -152,23 +152,30 @@ function handleMonthChange(viewInfo) {
|
||||
loadCalendarData(year, month);
|
||||
}
|
||||
// 캘린더 클릭
|
||||
// 캘린더 클릭
|
||||
function handleDateClick(info) {
|
||||
const clickedDateStr = info.dateStr;
|
||||
const clickedDate = info.date;
|
||||
const todayStr = new Date().toISOString().split("T")[0];
|
||||
const todayObj = new Date(todayStr);
|
||||
const oneWeekAgoObj = new Date(todayObj);
|
||||
oneWeekAgoObj.setDate(todayObj.getDate() - 8); // 오늘 기준 7일 전 날짜
|
||||
|
||||
// 주말(토, 일) 또는 공휴일 또는 오늘 -7일 날짜 → 클릭 불가능
|
||||
if (
|
||||
clickedDate.getDay() === 0 ||
|
||||
clickedDate.getDay() === 6 ||
|
||||
holidayDates.value.has(clickedDateStr) ||
|
||||
clickedDateStr < todayStr
|
||||
clickedDate.getDay() === 0 || // 일요일
|
||||
clickedDate.getDay() === 6 || // 토요일
|
||||
holidayDates.value.has(clickedDateStr) || // 공휴일
|
||||
clickedDateStr <= oneWeekAgoObj.toISOString().split("T")[0] // 오늘 -7일 날짜 포함 과거 날짜 클릭 방지
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
const isMyVacation = myVacations.value.some(vac => {
|
||||
const vacDate = vac.date ? vac.date.substring(0, 10) : "";
|
||||
return vacDate === clickedDateStr && !vac.receiverId;
|
||||
});
|
||||
|
||||
if (isMyVacation) {
|
||||
if (selectedDates.value.get(clickedDateStr) === "delete") {
|
||||
selectedDates.value.delete(clickedDateStr);
|
||||
@ -178,45 +185,55 @@ function handleDateClick(info) {
|
||||
updateCalendarEvents();
|
||||
return;
|
||||
}
|
||||
|
||||
if (selectedDates.value.has(clickedDateStr)) {
|
||||
selectedDates.value.delete(clickedDateStr);
|
||||
updateCalendarEvents();
|
||||
return;
|
||||
}
|
||||
|
||||
const type = halfDayType.value
|
||||
? (halfDayType.value === "AM" ? "700101" : "700102")
|
||||
: "700103";
|
||||
|
||||
selectedDates.value.set(clickedDateStr, type);
|
||||
halfDayType.value = null;
|
||||
updateCalendarEvents();
|
||||
|
||||
if (halfDayButtonsRef.value) {
|
||||
halfDayButtonsRef.value.resetHalfDay();
|
||||
}
|
||||
}
|
||||
// 오늘 이후의 날짜만 클릭 가능하도록 설정
|
||||
|
||||
function markClickableDates() {
|
||||
nextTick(() => {
|
||||
const todayStr = new Date().toISOString().split("T")[0]; // 오늘 날짜 YYYY-MM-DD
|
||||
const todayStr = new Date().toISOString().split("T")[0]; // 오늘 날짜 (YYYY-MM-DD)
|
||||
const todayObj = new Date(todayStr);
|
||||
const oneWeekAgoObj = new Date(todayObj);
|
||||
oneWeekAgoObj.setDate(todayObj.getDate() - 8); // 오늘 기준 7일 전 날짜
|
||||
|
||||
document.querySelectorAll(".fc-daygrid-day").forEach((cell) => {
|
||||
const dateStr = cell.getAttribute("data-date");
|
||||
if (!dateStr) return; // 날짜가 없으면 스킵
|
||||
|
||||
const dateObj = new Date(dateStr);
|
||||
// 주말 (토요일, 일요일)
|
||||
if (dateObj.getDay() === 0 || dateObj.getDay() === 6 || holidayDates.value.has(dateStr)) {
|
||||
|
||||
// 주말(토요일, 일요일) 또는 공휴일 또는 오늘 -7일 날짜 → 클릭 불가능
|
||||
if (
|
||||
dateObj.getDay() === 0 || // 일요일
|
||||
dateObj.getDay() === 6 || // 토요일
|
||||
holidayDates.value.has(dateStr) || // 공휴일
|
||||
dateObj.getTime() === oneWeekAgoObj.getTime() // 오늘 -7일 날짜
|
||||
) {
|
||||
cell.classList.remove("clickable");
|
||||
cell.classList.add("fc-day-sat-sun");
|
||||
cell.removeEventListener("click", handleDateClick); // 클릭 이벤트 제거
|
||||
}
|
||||
// 과거 날짜 (오늘 이전)
|
||||
else if (dateObj < todayObj) {
|
||||
cell.classList.remove("clickable");
|
||||
cell.classList.add("past"); // 과거 날짜 비활성화
|
||||
}
|
||||
// 오늘 & 미래 날짜 (클릭 가능)
|
||||
// 오늘 -6일부터 미래 날짜까지 클릭 가능
|
||||
else {
|
||||
cell.classList.add("clickable");
|
||||
cell.classList.remove("past", "fc-day-sat-sun");
|
||||
cell.addEventListener("click", handleDateClick); // 클릭 이벤트 추가
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user