fix initial calendar loading;
show unpublished events in calendar for ADMINS mark unavailable publishers when they are available on another time on the same day;
This commit is contained in:
@ -76,8 +76,8 @@ export default function AvailabilityForm({ publisherId, existingItems, inline, o
|
||||
const maxTime = d.set({ hour: 19, minute: 30 }).toJSDate();
|
||||
|
||||
useEffect(() => {
|
||||
setTimeSlots(generateTimeSlots(new Date(minTime), new Date(maxTime), cartEvent.shiftDuration, availabilities));
|
||||
console.log("AvailabilityForm: minTime: " + common.getTimeFormatted(minTime) + ", maxTime: " + common.getTimeFormatted(maxTime), ", " + cartEvent.shiftDuration + " min. shifts");
|
||||
setTimeSlots(generateTimeSlots(new Date(minTime), new Date(maxTime), cartEvent?.shiftDuration || 90, availabilities));
|
||||
console.log("AvailabilityForm: minTime: " + common.getTimeFormatted(minTime) + ", maxTime: " + common.getTimeFormatted(maxTime), ", " + cartEvent?.shiftDuration || 90 + " min. shifts", cartEvent ? "cartEvent" : "cartEvent MISSING!!!");
|
||||
}, []);
|
||||
|
||||
|
||||
|
@ -173,6 +173,9 @@ function ShiftComponent({ shift, onShiftSelect, isSelected, onPublisherSelect, a
|
||||
borderStyles += 'border-l-2 border-blue-500 '; // Left border for specific availability conditions
|
||||
ass.canTransport = av.isWithTransportIn || av.isWithTransportOut;
|
||||
}
|
||||
else {
|
||||
borderStyles += 'border-l-4 border-red-500 ';
|
||||
}
|
||||
|
||||
if (publisherInfo.hasUpToDateAvailabilities) {
|
||||
//add green right border
|
||||
|
@ -74,7 +74,10 @@ const AvCalendar = ({ publisherId, events, selectedDate, cartEvents }) => {
|
||||
return ce;
|
||||
}
|
||||
|
||||
useEffect(() => { setCartEvent(getCartEvent(date)); },
|
||||
useEffect(() => {
|
||||
//console.log("useEffect: ", date, selectedEvents, cartEvents);
|
||||
setCartEvent(getCartEvent(date));
|
||||
},
|
||||
[date, selectedEvents]);
|
||||
|
||||
// Update internal state when `events` prop changes
|
||||
@ -236,7 +239,9 @@ const AvCalendar = ({ publisherId, events, selectedDate, cartEvents }) => {
|
||||
console.log("handleSelect: ", existingEvents);
|
||||
|
||||
// Use the updated startdate for getCartEvent and ensure it reflects in the state properly
|
||||
setCartEvent(getCartEvent(startdate));
|
||||
const cartEvent = getCartEvent(startdate);
|
||||
setCartEvent(cartEvent);
|
||||
console.log("cartEvent: ", cartEvent.dayofweek);
|
||||
setSelectedEvents(existingEvents);
|
||||
setIsModalOpen(true);
|
||||
};
|
||||
|
@ -24,7 +24,7 @@ function PublisherSearchBox({ id, selectedId, onChange, isFocused, filterDate, s
|
||||
const fetchPublishers = async () => {
|
||||
console.log("fetchPublishers called");
|
||||
try {
|
||||
let url = `/api/?action=filterPublishers&select=id,firstName,lastName,email,isActive&searchText=${searchText}&availabilities=false`;
|
||||
let url = `/api/?action=filterPublishers&select=id,firstName,lastName,email,isActive&availabilities=false`;
|
||||
|
||||
if (filterDate) {
|
||||
url += `&filterDate=${common.getISODateOnly(filterDate)}`;
|
||||
|
Reference in New Issue
Block a user