import/parse and generate respects withTransport and requiresTransport properties. parsing rransport initials

This commit is contained in:
Dobromir Popov
2024-03-05 23:49:23 +02:00
parent 1dfd30afa2
commit cf17cc74a2
5 changed files with 41 additions and 13 deletions

View File

@ -194,17 +194,31 @@ function ShiftComponent({ shift, onShiftSelect, isSelected, onPublisherSelect, a
}
}
function toggleTransport(id: any): void {
throw new Error('Function not implemented.');
}
return (
<div key={index}
className={`flow space-x-2 rounded-md px-2 py-1 my-1 ${ass.isConfirmed ? 'bg-yellow-100' : 'bg-gray-100'} ${borderStyles}`}
className={`flow space-x-2 rounded-md px-2 py-1 my-1 ${ass.isConfirmed ? 'bg-green-100' : 'bg-gray-100'} ${borderStyles}`}
>
<div className="flex justify-between items-center" onClick={() => handlePublisherClick(ass.publisher)}>
<span className="text-gray-700">{publisherInfo.firstName} {publisherInfo.lastName}</span>
<button onClick={() => removeAssignment(ass.id)}
className="text-white bg-red-500 hover:bg-red-600 px-3 py-1 ml-2 rounded-md"
>
махни
</button>
<div className="flex items-left" >
{/* //if shift.isWithTransport, add trnsport button toggle, which sets ass.isWithTransportIn */}
{shift.requiresTransport &&
(
<button onClick={() => toggleTransport(ass.id)} className={`text-white hover:bg-orange-600 px-3 py-1 ml-2 rounded-md ${ass.isWithTransport ? 'bg-green-500' : 'bg-orange-500'}`} >
транспорт
</button>
)
}
<button onClick={() => removeAssignment(ass.id)} className="text-white bg-red-500 hover:bg-red-600 px-3 py-1 ml-2 rounded-md" >
махни
</button>
</div>
</div>
</div>
);