{`${common.getTimeRange(new Date(shift.startTime), new Date(shift.endTime))}`}
{/* Copy All Names Button */}
{/* Hint Message */}
{showCopyHint && (
Имената са копирани
)}
{/* Assignments */}
{assignments.map((ass, index) => {
const publisherInfo = allPublishersInfo.find(info => info?.id === ass.publisher.id) || ass.publisher;
// Determine border styles
let borderStyles = '';
//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 {
//pub is not available for that shift assignment.
if (publisherInfo.availabilities?.length === 0 ||
publisherInfo.availabilities?.every(avail => avail.isFromPreviousAssignment)) {
borderStyles += 'border-l-3 border-r-3 border-orange-500 '; // Top border for manual publishers
}
// checkig if the publisher is available for this assignment
if (publisherInfo.availabilities?.some(av =>
av.startTime <= ass.startTime &&
av.endTime >= ass.endTime)) {
borderStyles += 'border-t-2 border-red-500 '; // Left border for specific availability conditions
}
//the pub is the same time as last month
// if (publisherInfo.availabilities?.some(av =>
// (!av.dayOfMonth || av.isFromPreviousMonth) &&
// av.startTime <= ass.startTime &&
// av.endTime >= ass.endTime)) {
// borderStyles += 'border-t-2 border-yellow-500 '; // Left border for specific availability conditions
// }
if (selectedPublisher && selectedPublisher.id === ass.publisher.id) {
borderStyles += 'border-2 border-blue-300'; // Bottom border for selected publishers
}
if (publisherInfo.hasUpToDateAvailabilities) {
//add green right border
borderStyles += 'border-r-2 border-green-300';
}
}
return (