ui fixes
This commit is contained in:
@ -151,27 +151,24 @@ function ShiftComponent({ shift, onShiftSelect, isSelected, onPublisherSelect, a
|
||||
let borderStyles = '';
|
||||
let canTransport = false;
|
||||
if (selectedPublisher && selectedPublisher.id === ass.publisher.id) {
|
||||
borderStyles += 'border-2 border-blue-300'; // Bottom border for selected publishers
|
||||
borderStyles += 'bg-blue-200 font-bold '; // Bottom border for selected publishers
|
||||
}
|
||||
else {
|
||||
if (publisherInfo.availabilityCount == 0) //user has never the form
|
||||
|
||||
if (publisherInfo.availabilityCount == 0 || !publisherInfo.availabilities || publisherInfo.availabilities.length == 0)
|
||||
//user has never the filled the avalabilities form or if there is no publisherInfo - draw red border - publisher is no longer available for the day!
|
||||
{
|
||||
borderStyles = 'border-2 border-orange-300 ';
|
||||
}
|
||||
else
|
||||
//if there is no publisherInfo - draw red border - publisher is no longer available for the day!
|
||||
if (!publisherInfo.availabilities || publisherInfo.availabilities.length == 0) {
|
||||
borderStyles = 'border-2 border-red-500 ';
|
||||
}
|
||||
else {
|
||||
borderStyles += 'border-2 border-red-500 ';
|
||||
} else {
|
||||
|
||||
// checkig if the publisher is available for this assignment
|
||||
//ToDo: verify if that check is correct
|
||||
const av = publisherInfo.availabilities?.find(av =>
|
||||
av.startTime <= shift.startTime && av.endTime >= shift.endTime
|
||||
);
|
||||
if (av) {
|
||||
borderStyles += 'border-l-2 border-blue-500 '; // Left border for specific availability conditions
|
||||
borderStyles += 'border-b-2 border-blue-500 '; // Left border for specific availability conditions
|
||||
ass.canTransport = av.isWithTransportIn || av.isWithTransportOut;
|
||||
// console.log(publisherInfo.firstName, "available for shift", shift.id, "at", common.getDateFormattedShort(new Date(shift.startTime)), "av-" + av.id, ": a." + common.getTimeFormatted(av.startTime), "<=", common.getTimeFormatted(shift.startTime), "; a." + common.getTimeFormatted(av.endTime), ">=", common.getTimeFormatted(shift.endTime));
|
||||
}
|
||||
else {
|
||||
borderStyles += 'border-l-4 border-red-500 ';
|
||||
@ -192,7 +189,6 @@ function ShiftComponent({ shift, onShiftSelect, isSelected, onPublisherSelect, a
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return (
|
||||
<div key={index}
|
||||
|
@ -31,7 +31,7 @@ export default function DashboardPage({ initialItems, initialUserId, cartEvents,
|
||||
const router = useRouter();
|
||||
const { newLogin } = router.query;
|
||||
const { data: session } = useSession();
|
||||
const [userName, setUserName] = useState(session?.user?.name);
|
||||
const [userName, setUserName] = useState('');
|
||||
const [userId, setUserId] = useState(initialUserId);
|
||||
const [events, setEvents] = useState(initialItems?.map(item => ({
|
||||
...item,
|
||||
@ -43,7 +43,7 @@ export default function DashboardPage({ initialItems, initialUserId, cartEvents,
|
||||
})));
|
||||
|
||||
useEffect(() => {
|
||||
if (session) {
|
||||
if (session && userName === '' && session.user.name) {
|
||||
setUserName(session.user.name);
|
||||
setUserId(session.user.id);
|
||||
//handleUserSelection({ id: session.user.id, firstName: session.user.name, lastName: '' });
|
||||
|
Reference in New Issue
Block a user