This commit is contained in:
Dobromir Popov
2024-03-26 01:08:57 +02:00
parent 3fcdfc1347
commit acd776e988
37 changed files with 143 additions and 107 deletions

View File

@ -206,7 +206,7 @@ const AvCalendar = ({ publisherId, events, selectedDate }) => {
// startTime: start,
// endTime: end,
// dayOfMonth: start.getDate(),
// isactive: true,
// isActive: true,
// publisherId: publisherId,
// // Add any other initial values needed
// //set dayOfMonth to null, so that we repeat the availability every week
@ -273,9 +273,9 @@ const AvCalendar = ({ publisherId, events, selectedDate }) => {
//if event.type is availability show in blue. if it is schedule - green if confirmed, yellow if not confirmed
//if event is not active - show in gray
let bgColorClass = 'bg-gray-500'; // Default color for inactive events
var bgColor = event.isactive ? "" : "bg-gray-500";
var bgColor = event.isActive ? "" : "bg-gray-500";
if (event.type === "assignment") {
bgColor = event.isTentative ? "bg-red-500" : (event.isConfirmed ? "bg-green-500" : "bg-yellow-500");
bgColor = event.isBySystem ? "bg-red-500" : (event.isConfirmed ? "bg-green-500" : "bg-yellow-500");
//event.title = event.publisher.name; //ToDo: add other publishers names
//event.title = common.getTimeFomatted(event.startTime) + " - " + common.getTimeFomatted(event.endTime);
@ -319,7 +319,7 @@ const AvCalendar = ({ publisherId, events, selectedDate }) => {
toast.info("Потвърдено!", { autoClose: 2000 });
// Update the event data
event.isConfirmed = true;
event.isTentative = false;
event.isBySystem = false;
// Update the events array by first removing the old event and then adding the updated one
setEvents(currentEvents => {
const filteredEvents = currentEvents.filter(e => e.id !== event.id);
@ -328,7 +328,7 @@ const AvCalendar = ({ publisherId, events, selectedDate }) => {
//store the updated event in the database
var assignment = {
isConfirmed: true,
isTentative: false
isBySystem: false
};
axiosInstance.put('/api/data/assignments/' + event.id, assignment)
.then((response) => {
@ -388,7 +388,7 @@ const AvCalendar = ({ publisherId, events, selectedDate }) => {
// orange-500 from Tailwind CSS
backgroundColor = '#f56565';
}
if (event.isactive) {
if (event.isActive) {
switch (event.type) {
case 'assignment':
backgroundColor = event.isConfirmed ? '#48bb78' : '#f6e05e'; // green-500 and yellow-300 from Tailwind CSS