Skip to content
Snippets Groups Projects
Commit 4782c138 authored by Carlos Vega's avatar Carlos Vega
Browse files

Issue #278 Avoid deleting availabilities from the daily planning and add more...

Issue #278 Avoid deleting availabilities from the daily planning and add more control for undefined values
parent c512d660
No related branches found
Tags v0.12.1
2 merge requests!196v0.12.2 into master,!195Issue #278 Avoid deleting availabilities from the daily planning and add more…
Pipeline #7574 passed
......@@ -47,12 +47,12 @@ function add_event(event, color, subjectId, locationId, boxBody) {
if (event_title === undefined || event_title === "") {
event_title = event.title;
}
eventElement.data('event', {
event_data = {
appointment_start: event.appointment_start,
appointment_end: event.appointment_end,
title: event_title,
stick: true,
color: color + " !important",
duration: event.duration,
original_duration: event.duration,
subject: event.subject,
......@@ -70,8 +70,13 @@ function add_event(event, color, subjectId, locationId, boxBody) {
end: $.fullCalendar.moment(event.appointment_end)
},
borderColor: borderColor
}
});
if(color != undefined){
event_data['color'] = color + " !important";
}
eventElement.data('event', event_data);
eventElement.draggable({
zIndex: 999,
revert: true,
......@@ -227,6 +232,10 @@ function get_subjects_events(day) {
}
function remove_event(event) {
if(event.className.includes("background-event")){ //avoid removing availabilities
return;
}
$('#calendar').fullCalendar('removeEvents', event.id);
var selector;
if (event.subject_id !== undefined) {
......@@ -239,7 +248,10 @@ function remove_event(event) {
event.duration = event.original_duration;
event.removed = true;
//remove !important
event.color = event.color.substring(0, 7);
if(event.color != undefined){
event.color = event.color.substring(0, 7);
}
if (event.link_id !== undefined) {
eventsCleared.push(event.link_id);
} else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment