calendar not editable pandora_enterprise#3943
This commit is contained in:
parent
dca70fa8ec
commit
0e0e737283
|
@ -700,6 +700,7 @@ if ($step == 2) {
|
|||
[
|
||||
'message' => __('No alert has been scheduled yet'),
|
||||
'force_style' => 'display:none;',
|
||||
'force_class' => 'alert_schedule',
|
||||
],
|
||||
'',
|
||||
true
|
||||
|
@ -1509,6 +1510,8 @@ if ($step == 2) {
|
|||
}
|
||||
});
|
||||
|
||||
var is_management_allowed = parseInt('<?php echo (int) $is_management_allowed; ?>');
|
||||
|
||||
var eventsBBDD = $("#hidden-schedule").val();
|
||||
if(eventsBBDD === '') {
|
||||
eventsBBDD = '<?php echo json_encode($default_events_calendar); ?>';
|
||||
|
@ -1516,6 +1519,58 @@ if ($step == 2) {
|
|||
|
||||
var events = loadEventBBDD(eventsBBDD);
|
||||
var calendarEl = document.getElementById('calendar_map');
|
||||
|
||||
var options = {
|
||||
contentHeight: "auto",
|
||||
headerToolbar: {
|
||||
left: "",
|
||||
center: "",
|
||||
right: is_management_allowed === 0 ? '' : "timeGridWeek,dayGridWeek"
|
||||
},
|
||||
buttonText: {
|
||||
dayGridWeek: '<?php echo __('Simple'); ?>',
|
||||
timeGridWeek: '<?php echo __('Detailed'); ?>'
|
||||
},
|
||||
dayHeaderFormat: { weekday: "short" },
|
||||
initialView: "dayGridWeek",
|
||||
navLinks: false,
|
||||
selectable: true,
|
||||
selectMirror: true,
|
||||
slotDuration: "01:00:00",
|
||||
slotLabelInterval: "02:00:00",
|
||||
snapDuration: "01:00:00",
|
||||
slotMinTime: "00:00:00",
|
||||
slotMaxTime: "24:00:00",
|
||||
scrollTime: "01:00:00",
|
||||
locale: "en-GB",
|
||||
firstDay: 1,
|
||||
eventTimeFormat: {
|
||||
hour: "numeric",
|
||||
minute: "2-digit",
|
||||
hour12: false
|
||||
},
|
||||
eventColor: "#82b92e",
|
||||
editable: is_management_allowed === 0 ? false : true,
|
||||
dayMaxEvents: 3,
|
||||
dayPopoverFormat: { weekday: "long" },
|
||||
defaultAllDay: false,
|
||||
displayEventTime: true,
|
||||
displayEventEnd: true,
|
||||
selectOverlap: false,
|
||||
eventOverlap: false,
|
||||
allDaySlot: true,
|
||||
droppable: false,
|
||||
select: is_management_allowed === 0 ? false : select_alert_template,
|
||||
selectAllow: is_management_allowed === 0 ? false : selectAllow_alert_template,
|
||||
eventAllow: is_management_allowed === 0 ? false : eventAllow_alert_template,
|
||||
eventDrop: is_management_allowed === 0 ? false : eventDrop_alert_template,
|
||||
eventDragStop: is_management_allowed === 0 ? false : eventDragStop_alert_template,
|
||||
eventResize: is_management_allowed === 0 ? false : eventResize_alert_template,
|
||||
eventMouseEnter: is_management_allowed === 0 ? false : eventMouseEnter_alert_template,
|
||||
eventMouseLeave: is_management_allowed === 0 ? false : eventMouseLeave_alert_template,
|
||||
eventClick: is_management_allowed === 0 ? false : eventClick_alert_template,
|
||||
};
|
||||
|
||||
var settings = {
|
||||
timeFormat: '<?php echo TIME_FORMAT_JS; ?>',
|
||||
timeOnlyTitle: '<?php echo __('Choose time'); ?>',
|
||||
|
@ -1530,12 +1585,10 @@ if ($step == 2) {
|
|||
userLanguage: '<?php echo get_user_language(); ?>',
|
||||
loadingText: '<?php echo __('Loading, this operation might take several minutes...'); ?>',
|
||||
tooltipText: '<?php echo __('Drag out to remove'); ?>',
|
||||
simple: '<?php echo __('Simple'); ?>',
|
||||
detailed: '<?php echo __('Detailed'); ?>',
|
||||
alert: '<?php echo __('Alert'); ?>'
|
||||
}
|
||||
|
||||
var calendar = fullCalendarPandora(calendarEl, settings, events);
|
||||
var calendar = fullCalendarPandora(calendarEl, options, settings, events);
|
||||
calendar.render();
|
||||
<?php
|
||||
} else if ($step == 3) {
|
||||
|
|
|
@ -251,6 +251,7 @@ function ui_print_message($message, $class='', $attributes='', $return=false, $t
|
|||
$icon_image = '';
|
||||
$no_close_bool = false;
|
||||
$force_style = '';
|
||||
$force_class = '';
|
||||
if (is_array($message)) {
|
||||
if (!empty($message['title'])) {
|
||||
$text_title = $message['title'];
|
||||
|
@ -271,6 +272,10 @@ function ui_print_message($message, $class='', $attributes='', $return=false, $t
|
|||
if (!empty($message['force_style'])) {
|
||||
$force_style = $message['force_style'];
|
||||
}
|
||||
|
||||
if (empty($message['force_class']) === false) {
|
||||
$force_class = $message['force_class'];
|
||||
}
|
||||
} else {
|
||||
$text_message = $message;
|
||||
}
|
||||
|
@ -319,6 +324,10 @@ function ui_print_message($message, $class='', $attributes='', $return=false, $t
|
|||
|
||||
$id = 'info_box_'.uniqid();
|
||||
|
||||
if (empty($force_class) === false) {
|
||||
$class = $class.' '.$force_class;
|
||||
}
|
||||
|
||||
// Use the no_meta parameter because this image is only in the base console.
|
||||
$output = '<table cellspacing="0" cellpadding="0" id="'.$id.'" '.$attributes.'
|
||||
class="info_box '.$id.' '.$class.' textodialogo" style="'.$force_style.'">
|
||||
|
|
|
@ -1,275 +1,334 @@
|
|||
/* globals $, FullCalendar, uniqId, confirmDialog*/
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function fullCalendarPandora(calendarEl, settings, initialEvents) {
|
||||
function fullCalendarPandora(calendarEl, options, settings, initialEvents) {
|
||||
var calendar = new FullCalendar.Calendar(calendarEl, {
|
||||
//height: 200,
|
||||
contentHeight: "auto",
|
||||
headerToolbar: {
|
||||
left: "",
|
||||
center: "",
|
||||
right: "timeGridWeek,dayGridWeek"
|
||||
},
|
||||
buttonText: {
|
||||
dayGridWeek: settings.simple,
|
||||
timeGridWeek: settings.detailed
|
||||
},
|
||||
dayHeaderFormat: { weekday: "short" },
|
||||
initialView: "dayGridWeek",
|
||||
navLinks: false,
|
||||
selectable: true,
|
||||
selectMirror: true,
|
||||
slotDuration: "01:00:00",
|
||||
slotLabelInterval: "02:00:00",
|
||||
snapDuration: "01:00:00",
|
||||
//slotLabelFormat: {
|
||||
// hour: "numeric",
|
||||
// minute: "2-digit",
|
||||
// hour12: false
|
||||
//},
|
||||
slotMinTime: "00:00:00",
|
||||
slotMaxTime: "24:00:00",
|
||||
scrollTime: "01:00:00",
|
||||
locale: "en-GB",
|
||||
//timeZone: "local",
|
||||
firstDay: 1,
|
||||
eventTimeFormat: {
|
||||
hour: "numeric",
|
||||
minute: "2-digit",
|
||||
hour12: false
|
||||
},
|
||||
eventColor: "#82b92e",
|
||||
editable: true,
|
||||
dayMaxEvents: 3,
|
||||
dayPopoverFormat: { weekday: "long" },
|
||||
contentHeight: options.contentHeight,
|
||||
headerToolbar: options.headerToolbar,
|
||||
buttonText: options.buttonText,
|
||||
dayHeaderFormat: options.dayHeaderFormat,
|
||||
initialView: options.initialView,
|
||||
navLinks: options.navLinks,
|
||||
selectable: options.selectable,
|
||||
selectMirror: options.selectMirror,
|
||||
slotDuration: options.slotDuration,
|
||||
slotLabelInterval: options.slotLabelInterval,
|
||||
snapDuration: options.snapDuration,
|
||||
slotMinTime: options.slotMinTime,
|
||||
slotMaxTime: options.slotMaxTime,
|
||||
scrollTime: options.scrollTime,
|
||||
locale: options.locale,
|
||||
firstDay: options.firstDay,
|
||||
eventTimeFormat: options.eventTimeFormat,
|
||||
eventColor: options.eventColor,
|
||||
editable: options.editable,
|
||||
dayMaxEvents: options.dayMaxEvents,
|
||||
dayPopoverFormat: options.dayPopoverFormat,
|
||||
defaultAllDay: options.defaultAllDay,
|
||||
displayEventTime: options.displayEventTime,
|
||||
displayEventEnd: options.displayEventEnd,
|
||||
selectOverlap: options.selectOverlap,
|
||||
eventOverlap: options.eventOverlap,
|
||||
allDaySlot: options.allDaySlot,
|
||||
droppable: options.droppable,
|
||||
events: initialEvents,
|
||||
defaultAllDay: false,
|
||||
displayEventTime: true,
|
||||
displayEventEnd: true,
|
||||
select: function(info) {
|
||||
var nextDay = info.start.getDay() === 6 ? 0 : info.start.getDay() + 1;
|
||||
if (
|
||||
info.start.getDay() == info.end.getDay() ||
|
||||
(nextDay == info.end.getDay() && time_format(info.end) == "00:00:00")
|
||||
) {
|
||||
recalculate_events(calendar, {}, info.start, info.end, true);
|
||||
select:
|
||||
options.select != undefined && typeof options.select === "function"
|
||||
? function(info) {
|
||||
options.select(info, calendar);
|
||||
}
|
||||
: false,
|
||||
selectAllow:
|
||||
options.selectAllow != undefined &&
|
||||
typeof options.selectAllow === "function"
|
||||
? function(info) {
|
||||
return options.selectAllow(info);
|
||||
}
|
||||
: false,
|
||||
eventAllow:
|
||||
options.eventAllow != undefined &&
|
||||
typeof options.eventAllow === "function"
|
||||
? function(dropInfo, draggedEvent) {
|
||||
return options.eventAllow(dropInfo, draggedEvent);
|
||||
}
|
||||
: false,
|
||||
eventDrop:
|
||||
options.eventDrop != undefined && typeof options.eventDrop === "function"
|
||||
? function(info) {
|
||||
options.eventDrop(info, calendar);
|
||||
}
|
||||
: false,
|
||||
eventDragStop:
|
||||
options.eventDragStop != undefined &&
|
||||
typeof options.eventDragStop === "function"
|
||||
? function(info) {
|
||||
options.eventDragStop(info, calendar);
|
||||
}
|
||||
: false,
|
||||
eventResize:
|
||||
options.eventResize != undefined &&
|
||||
typeof options.eventResize === "function"
|
||||
? function(info) {
|
||||
options.eventResize(info, calendar);
|
||||
}
|
||||
: false,
|
||||
eventMouseEnter:
|
||||
options.eventMouseEnter != undefined &&
|
||||
typeof options.eventMouseEnter === "function"
|
||||
? function(info) {
|
||||
options.eventMouseEnter(info, settings.tooltipText);
|
||||
}
|
||||
: false,
|
||||
eventMouseLeave:
|
||||
options.eventMouseLeave != undefined &&
|
||||
typeof options.eventMouseLeave === "function"
|
||||
? function(info) {
|
||||
options.eventMouseLeave(info);
|
||||
}
|
||||
: false,
|
||||
eventClick:
|
||||
options.eventClick != undefined &&
|
||||
typeof options.eventClick === "function"
|
||||
? function(info) {
|
||||
options.eventClick(info, calendar, settings);
|
||||
}
|
||||
: false
|
||||
});
|
||||
|
||||
return calendar;
|
||||
}
|
||||
|
||||
// Specific functions Alerts templates && Correlated events.
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function select_alert_template(info, calendar) {
|
||||
var nextDay = info.start.getDay() === 6 ? 0 : info.start.getDay() + 1;
|
||||
if (
|
||||
info.start.getDay() == info.end.getDay() ||
|
||||
(nextDay == info.end.getDay() && time_format(info.end) == "00:00:00")
|
||||
) {
|
||||
recalculate_events(calendar, {}, info.start, info.end, true);
|
||||
}
|
||||
calendar.unselect();
|
||||
save_data_input(calendar);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function selectAllow_alert_template(info) {
|
||||
var nextDay = info.start.getDay() === 6 ? 0 : info.start.getDay() + 1;
|
||||
if (
|
||||
info.start.getDay() == info.end.getDay() ||
|
||||
(nextDay == info.end.getDay() && time_format(info.end) == "00:00:00")
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function eventAllow_alert_template(dropInfo, draggedEvent) {
|
||||
if (dropInfo.allDay != true) {
|
||||
var nextDay =
|
||||
draggedEvent.start.getDay() === 6 ? 0 : draggedEvent.start.getDay() + 1;
|
||||
if (
|
||||
(draggedEvent.start.getDay() == dropInfo.start.getDay() &&
|
||||
dropInfo.start.getDay() == dropInfo.end.getDay()) ||
|
||||
(nextDay == dropInfo.end.getDay() &&
|
||||
time_format(dropInfo.end) == "00:00:00")
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function eventDrop_alert_template(info, calendar) {
|
||||
if (info.event.allDay != true) {
|
||||
var nextDay =
|
||||
info.event.start.getDay() === 6 ? 0 : info.event.start.getDay() + 1;
|
||||
if (
|
||||
info.event.start.getDay() == info.event.end.getDay() ||
|
||||
(nextDay == info.event.end.getDay() &&
|
||||
time_format(info.event.end) == "00:00:00")
|
||||
) {
|
||||
recalculate_events(
|
||||
calendar,
|
||||
info.event,
|
||||
info.event.start,
|
||||
info.event.end,
|
||||
false
|
||||
);
|
||||
save_data_input(calendar);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function eventDragStop_alert_template(info, calendar) {
|
||||
var trashEl = $("#calendar_map");
|
||||
var ofs = trashEl.offset();
|
||||
|
||||
var x1 = ofs.left;
|
||||
var x2 = ofs.left + trashEl.outerWidth(true);
|
||||
var y1 = ofs.top;
|
||||
var y2 = ofs.top + trashEl.outerHeight(true);
|
||||
|
||||
if (
|
||||
x1 >= info.jsEvent.pageX ||
|
||||
x2 <= info.jsEvent.pageX ||
|
||||
y1 >= info.jsEvent.pageY ||
|
||||
y2 <= info.jsEvent.pageY
|
||||
) {
|
||||
// Remove event.
|
||||
info.event.remove();
|
||||
save_data_input(calendar);
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function eventResize_alert_template(info, calendar) {
|
||||
var nextDay =
|
||||
info.event.start.getDay() === 6 ? 0 : info.event.start.getDay() + 1;
|
||||
if (
|
||||
info.event.start.getDay() == info.event.end.getDay() ||
|
||||
(nextDay == info.event.end.getDay() &&
|
||||
time_format(info.event.end) == "00:00:00")
|
||||
) {
|
||||
recalculate_events(
|
||||
calendar,
|
||||
info.event,
|
||||
info.event.start,
|
||||
info.event.end,
|
||||
false
|
||||
);
|
||||
save_data_input(calendar);
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function eventMouseEnter_alert_template(info, tooltipText) {
|
||||
var tooltip = '<div class="tooltipevent">';
|
||||
tooltip += tooltipText;
|
||||
tooltip += "</div>";
|
||||
|
||||
$(tooltip).appendTo(info.el);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function eventMouseLeave_alert_template(info) {
|
||||
$(".tooltipevent").remove();
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function eventClick_alert_template(info, calendar, settings) {
|
||||
var calendar_date_from = new Date(calendar.view.activeStart);
|
||||
var calendar_days = [];
|
||||
var acum = 1;
|
||||
var i = 0;
|
||||
// Week date.
|
||||
for (var index = 1; index <= 7; index++) {
|
||||
// Sunday key 0.
|
||||
if (acum === 7) {
|
||||
acum = 0;
|
||||
}
|
||||
var date_acum = new Date(calendar_date_from);
|
||||
calendar_days[acum] = date_acum.setDate(calendar_date_from.getDate() + i);
|
||||
acum++;
|
||||
i++;
|
||||
}
|
||||
|
||||
confirmDialog({
|
||||
title: settings.alert,
|
||||
message: function() {
|
||||
var id = "div-" + uniqId();
|
||||
var loading = settings.loadingText;
|
||||
$.ajax({
|
||||
method: "post",
|
||||
url: settings.url,
|
||||
data: {
|
||||
page: "include/ajax/alert_list.ajax",
|
||||
resize_event_week: true,
|
||||
day_from: info.event.start.getDay(),
|
||||
day_to: info.event.end.getDay(),
|
||||
time_from: time_format(info.event.start),
|
||||
time_to: time_format(info.event.end)
|
||||
},
|
||||
dataType: "html",
|
||||
success: function(data) {
|
||||
$("#" + id)
|
||||
.empty()
|
||||
.append(data);
|
||||
$("#text-time_from_event, #text-time_to_event").timepicker({
|
||||
timeFormat: settings.timeFormat,
|
||||
timeOnlyTitle: settings.timeOnlyTitle,
|
||||
timeText: settings.timeText,
|
||||
hourText: settings.hourText,
|
||||
minuteText: settings.minuteText,
|
||||
secondText: settings.secondText,
|
||||
currentText: settings.currentText,
|
||||
closeText: settings.closeText
|
||||
});
|
||||
|
||||
$.datepicker.setDefaults(
|
||||
$.datepicker.regional[settings.userLanguage]
|
||||
);
|
||||
},
|
||||
error: function(error) {
|
||||
console.error(error);
|
||||
}
|
||||
});
|
||||
|
||||
return "<div id ='" + id + "'>" + loading + "</div>";
|
||||
},
|
||||
onAccept: function() {
|
||||
var replace_day_from = $("#hidden-day_from").val();
|
||||
var replace_time_from = $("#text-time_from_event").val();
|
||||
|
||||
var array_time_from = replace_time_from.split(":");
|
||||
var new_date_from = new Date(calendar_days[replace_day_from]);
|
||||
new_date_from.setHours(
|
||||
array_time_from[0],
|
||||
array_time_from[1],
|
||||
array_time_from[2]
|
||||
);
|
||||
|
||||
var replace_day_to = $("#hidden-day_to").val();
|
||||
var replace_time_to = $("#text-time_to_event").val();
|
||||
if (replace_time_to === "23:59:59") {
|
||||
replace_day_to++;
|
||||
replace_time_to = "00:00:00";
|
||||
}
|
||||
|
||||
var array_time_to = replace_time_to.split(":");
|
||||
var new_date_to = new Date(calendar_days[replace_day_to]);
|
||||
new_date_to.setHours(
|
||||
array_time_to[0],
|
||||
array_time_to[1],
|
||||
array_time_to[2]
|
||||
);
|
||||
|
||||
if (new_date_from < new_date_to) {
|
||||
recalculate_events(
|
||||
calendar,
|
||||
info.event,
|
||||
new_date_from,
|
||||
new_date_to,
|
||||
false
|
||||
);
|
||||
} else {
|
||||
console.error("You cannot add smaller events");
|
||||
}
|
||||
calendar.unselect();
|
||||
save_data_input(calendar);
|
||||
},
|
||||
selectAllow: function(info) {
|
||||
var nextDay = info.start.getDay() === 6 ? 0 : info.start.getDay() + 1;
|
||||
if (
|
||||
info.start.getDay() == info.end.getDay() ||
|
||||
(nextDay == info.end.getDay() && time_format(info.end) == "00:00:00")
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
eventAllow: function(dropInfo, draggedEvent) {
|
||||
if (dropInfo.allDay != true) {
|
||||
var nextDay =
|
||||
draggedEvent.start.getDay() === 6
|
||||
? 0
|
||||
: draggedEvent.start.getDay() + 1;
|
||||
if (
|
||||
(draggedEvent.start.getDay() == dropInfo.start.getDay() &&
|
||||
dropInfo.start.getDay() == dropInfo.end.getDay()) ||
|
||||
(nextDay == dropInfo.end.getDay() &&
|
||||
time_format(dropInfo.end) == "00:00:00")
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
eventDrop: function(info) {
|
||||
if (info.event.allDay != true) {
|
||||
var nextDay =
|
||||
info.event.start.getDay() === 6 ? 0 : info.event.start.getDay() + 1;
|
||||
if (
|
||||
info.event.start.getDay() == info.event.end.getDay() ||
|
||||
(nextDay == info.event.end.getDay() &&
|
||||
time_format(info.event.end) == "00:00:00")
|
||||
) {
|
||||
recalculate_events(
|
||||
calendar,
|
||||
info.event,
|
||||
info.event.start,
|
||||
info.event.end,
|
||||
false
|
||||
);
|
||||
save_data_input(calendar);
|
||||
}
|
||||
}
|
||||
},
|
||||
eventDragStop: function(info) {
|
||||
var trashEl = $("#calendar_map");
|
||||
var ofs = trashEl.offset();
|
||||
|
||||
var x1 = ofs.left;
|
||||
var x2 = ofs.left + trashEl.outerWidth(true);
|
||||
var y1 = ofs.top;
|
||||
var y2 = ofs.top + trashEl.outerHeight(true);
|
||||
|
||||
if (
|
||||
x1 >= info.jsEvent.pageX ||
|
||||
x2 <= info.jsEvent.pageX ||
|
||||
y1 >= info.jsEvent.pageY ||
|
||||
y2 <= info.jsEvent.pageY
|
||||
) {
|
||||
newButton: {
|
||||
text: settings.removeText,
|
||||
class: "",
|
||||
onFunction: function() {
|
||||
// Remove event.
|
||||
info.event.remove();
|
||||
save_data_input(calendar);
|
||||
}
|
||||
},
|
||||
eventResize: function(info) {
|
||||
var nextDay =
|
||||
info.event.start.getDay() === 6 ? 0 : info.event.start.getDay() + 1;
|
||||
if (
|
||||
info.event.start.getDay() == info.event.end.getDay() ||
|
||||
(nextDay == info.event.end.getDay() &&
|
||||
time_format(info.event.end) == "00:00:00")
|
||||
) {
|
||||
recalculate_events(
|
||||
calendar,
|
||||
info.event,
|
||||
info.event.start,
|
||||
info.event.end,
|
||||
false
|
||||
);
|
||||
save_data_input(calendar);
|
||||
}
|
||||
},
|
||||
eventMouseEnter: function(info) {
|
||||
var tooltip = '<div class="tooltipevent">';
|
||||
tooltip += settings.tooltipText;
|
||||
tooltip += "</div>";
|
||||
|
||||
$(tooltip).appendTo(info.el);
|
||||
},
|
||||
eventMouseLeave: function() {
|
||||
$(".tooltipevent").remove();
|
||||
},
|
||||
eventClick: function(info) {
|
||||
var calendar_date_from = new Date(calendar.view.activeStart);
|
||||
var calendar_days = [];
|
||||
var acum = 1;
|
||||
var i = 0;
|
||||
// Week date.
|
||||
for (var index = 1; index <= 7; index++) {
|
||||
// Sunday key 0.
|
||||
if (acum === 7) {
|
||||
acum = 0;
|
||||
}
|
||||
var date_acum = new Date(calendar_date_from);
|
||||
calendar_days[acum] = date_acum.setDate(
|
||||
calendar_date_from.getDate() + i
|
||||
);
|
||||
acum++;
|
||||
i++;
|
||||
}
|
||||
|
||||
confirmDialog({
|
||||
title: settings.alert,
|
||||
message: function() {
|
||||
var id = "div-" + uniqId();
|
||||
var loading = settings.loadingText;
|
||||
$.ajax({
|
||||
method: "post",
|
||||
url: settings.url,
|
||||
data: {
|
||||
page: "include/ajax/alert_list.ajax",
|
||||
resize_event_week: true,
|
||||
day_from: info.event.start.getDay(),
|
||||
day_to: info.event.end.getDay(),
|
||||
time_from: time_format(info.event.start),
|
||||
time_to: time_format(info.event.end)
|
||||
},
|
||||
dataType: "html",
|
||||
success: function(data) {
|
||||
$("#" + id)
|
||||
.empty()
|
||||
.append(data);
|
||||
$("#text-time_from_event, #text-time_to_event").timepicker({
|
||||
timeFormat: settings.timeFormat,
|
||||
timeOnlyTitle: settings.timeOnlyTitle,
|
||||
timeText: settings.timeText,
|
||||
hourText: settings.hourText,
|
||||
minuteText: settings.minuteText,
|
||||
secondText: settings.secondText,
|
||||
currentText: settings.currentText,
|
||||
closeText: settings.closeText
|
||||
});
|
||||
|
||||
$.datepicker.setDefaults(
|
||||
$.datepicker.regional[settings.userLanguage]
|
||||
);
|
||||
},
|
||||
error: function(error) {
|
||||
console.error(error);
|
||||
}
|
||||
});
|
||||
|
||||
return "<div id ='" + id + "'>" + loading + "</div>";
|
||||
},
|
||||
onAccept: function() {
|
||||
var replace_day_from = $("#hidden-day_from").val();
|
||||
var replace_time_from = $("#text-time_from_event").val();
|
||||
|
||||
var array_time_from = replace_time_from.split(":");
|
||||
var new_date_from = new Date(calendar_days[replace_day_from]);
|
||||
new_date_from.setHours(
|
||||
array_time_from[0],
|
||||
array_time_from[1],
|
||||
array_time_from[2]
|
||||
);
|
||||
|
||||
var replace_day_to = $("#hidden-day_to").val();
|
||||
var replace_time_to = $("#text-time_to_event").val();
|
||||
if (replace_time_to === "23:59:59") {
|
||||
replace_day_to++;
|
||||
replace_time_to = "00:00:00";
|
||||
}
|
||||
|
||||
var array_time_to = replace_time_to.split(":");
|
||||
var new_date_to = new Date(calendar_days[replace_day_to]);
|
||||
new_date_to.setHours(
|
||||
array_time_to[0],
|
||||
array_time_to[1],
|
||||
array_time_to[2]
|
||||
);
|
||||
|
||||
if (new_date_from < new_date_to) {
|
||||
recalculate_events(
|
||||
calendar,
|
||||
info.event,
|
||||
new_date_from,
|
||||
new_date_to,
|
||||
false
|
||||
);
|
||||
} else {
|
||||
console.error("You cannot add smaller events");
|
||||
}
|
||||
save_data_input(calendar);
|
||||
},
|
||||
newButton: {
|
||||
text: settings.removeText,
|
||||
class: "",
|
||||
onFunction: function() {
|
||||
// Remove event.
|
||||
info.event.remove();
|
||||
save_data_input(calendar);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
selectOverlap: false,
|
||||
eventOverlap: false,
|
||||
allDaySlot: true
|
||||
}
|
||||
});
|
||||
|
||||
return calendar;
|
||||
}
|
||||
|
||||
function time_format(date) {
|
||||
|
@ -367,9 +426,9 @@ function save_data_input(calendar) {
|
|||
});
|
||||
|
||||
if (data && Object.keys(data).length === 0) {
|
||||
$(".warning.textodialogo").show();
|
||||
$(".alert_schedule.textodialogo").show();
|
||||
} else {
|
||||
$(".warning").hide();
|
||||
$(".alert_schedule").hide();
|
||||
}
|
||||
|
||||
$("#hidden-schedule").val(JSON.stringify(data));
|
||||
|
@ -378,11 +437,11 @@ function save_data_input(calendar) {
|
|||
// eslint-disable-next-line no-unused-vars
|
||||
function loadEventBBDD(events) {
|
||||
if (events == undefined || events === null || events === "") {
|
||||
$(".warning").show();
|
||||
$(".alert_schedule").show();
|
||||
return {};
|
||||
}
|
||||
|
||||
$(".warning").hide();
|
||||
$(".alert_schedule").hide();
|
||||
|
||||
var current_day = new Date();
|
||||
|
||||
|
|
|
@ -8486,6 +8486,8 @@ div#err_msg_centralised {
|
|||
width: 70px;
|
||||
overflow-wrap: break-word;
|
||||
white-space: pre-wrap;
|
||||
font-size: 10px;
|
||||
line-height: 12px;
|
||||
}
|
||||
|
||||
#select_multiple_modules_filtered > div {
|
||||
|
@ -8524,3 +8526,8 @@ div#err_msg_centralised {
|
|||
width: 95%;
|
||||
height: 95%;
|
||||
}
|
||||
|
||||
.resume_calendar_map {
|
||||
width: 90%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue