diff --git a/components/calendar/avcalendar.tsx b/components/calendar/avcalendar.tsx index 3a9014d..f83f238 100644 --- a/components/calendar/avcalendar.tsx +++ b/components/calendar/avcalendar.tsx @@ -62,6 +62,28 @@ const AvCalendar = ({ publisherId, events, selectedDate, cartEvents, lastPublish }, []); //const isAdmin = ProtectedRoute.IsInRole(UserRole.ADMIN); + //block dates between 1 and 18 august 2024 + const blockedDates = [ + new Date(2024, 7, 1), + new Date(2024, 7, 2), + new Date(2024, 7, 3), + new Date(2024, 7, 4), + new Date(2024, 7, 5), + new Date(2024, 7, 6), + new Date(2024, 7, 7), + new Date(2024, 7, 8), + new Date(2024, 7, 9), + new Date(2024, 7, 10), + new Date(2024, 7, 11), + new Date(2024, 7, 12), + new Date(2024, 7, 13), + new Date(2024, 7, 14), + new Date(2024, 7, 15), + new Date(2024, 7, 16), + new Date(2024, 7, 17), + new Date(2024, 7, 18), + ]; + const [date, setDate] = useState(new Date()); //ToDo: see if we can optimize this const [evts, setEvents] = useState(events); // Existing events @@ -243,6 +265,11 @@ const AvCalendar = ({ publisherId, events, selectedDate, cartEvents, lastPublish return; } + + if (blockedDates[0] <= startdate && startdate <= blockedDates[blockedDates.length - 1]) { + toast.error(`Не можете да въвеждате предпочитания за ${common.getDateFormattedShort(startdate)}`, { autoClose: 5000 }); + return; + } } // Check if start and end are on the same day if (startdate.toDateString() !== enddate.toDateString()) { @@ -539,6 +566,27 @@ const AvCalendar = ({ publisherId, events, selectedDate, cartEvents, lastPublish }, // ... other custom components }} + dayPropGetter={(date) => { + // Highlight the current day + // if (date.toDateString() === new Date().toDateString()) { + // return { + // style: { + // // white-500 from Tailwind CSS + // backgroundColor: '#f9fafb', + // color: 'white' + // } + // }; + // } + if (blockedDates[0] <= date && date <= blockedDates[blockedDates.length - 1]) { + return { + style: { + // red-100 from Tailwind CSS + backgroundColor: '#fee2e2', + color: 'white' + } + }; + } + }} eventPropGetter={(eventStyleGetter)} date={date} showAllEvents={true}