Jakweb.ch stuff
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
clouddesk/operator/template/js_dashboard.php

89 lines
3.3 KiB

<script src="<?php echo BASE_URL;?>js/fullcalendar.js"></script>
<script src="<?php echo BASE_URL;?>js/fullcalendar-locale.js"></script>
<!-- JavaScript for select all -->
<script>
$(document).ready(function() {
var initialLocaleCode = '<?php echo ($USER_LANGUAGE == 'en' ? 'en-gb' : $USER_LANGUAGE);?>';
//init DateTimePickers
md.initFormExtendedDatetimepickers();
});
var initialLocaleCode = '<?php echo ($USER_LANGUAGE == 'en' ? 'en-gb' : $USER_LANGUAGE);?>';
document.addEventListener('DOMContentLoaded', function() {
var calendarEl = document.getElementById('calendar');
var calendar = new FullCalendar.Calendar(calendarEl, {
initialView: 'timeGridWeek',
headerToolbar: {
left: 'prev,next today',
center: 'title',
right: 'dayGridMonth,timeGridWeek,timeGridDay,listMonth'
},
scrollTime: '09:00:00',
weekNumbers: true,
navLinks: true, // can click day/week names to navigate views
editable: true,
locale: initialLocaleCode,
selectable: true,
select: function(info) {
$('#calModal #calModalLabel').html('<?php echo stripslashes($jkl['hd245']);?>');
$('#calModal #cal-start').val(moment(info.startStr).format('YYYY-MM-DD HH:mm:ss'));
$('#calModal #cal-end').val(moment(info.endStr).format('YYYY-MM-DD HH:mm:ss'));
$('#calModal #cal-action').val("cal-new");
$('#calModal #cal-delete').hide();
$('#calModal').modal('show');
},
eventClick: function(info) {
$('#calModal #cal-id').val(info.event.id);
$('#calModal #cal-action').val("cal-edit");
$('#calModal #cal-start').val(moment(info.event.startStr).format('YYYY-MM-DD HH:mm:ss'));
$('#calModal #cal-end').val(moment(info.event.endStr).format('YYYY-MM-DD HH:mm:ss'));
$('#calModal #cal-title').val(info.event.title);
$('#calModal #cal-content').val(info.event.extendedProps.content);
$('#calModal #color').val(info.event.backgroundColor);
$('#calModal #cal-delete').show();
$('#calModal').modal('show');
$('.selectpicker').selectpicker('refresh');
$('#calModal').on('hidden.bs.modal', function (e) {
$('#calModal #cal-title').val("");
$('#calModal #cal-content').val("");
});
},
eventDrop: function(info) {
cal_edit_event(info.event.id, moment(info.event.start).format('YYYY-MM-DD HH:mm:ss'), false);
},
eventResize: function(info) {
cal_edit_event(info.event.id, moment(info.event.start).format('YYYY-MM-DD HH:mm:ss'), moment(info.event.end).format('YYYY-MM-DD HH:mm:ss'));
},
events: '<?php echo BASE_URL;?>ajax/events.php'
});
calendar.render();
});
function cal_edit_event(evid, evstart, evend) {
$.ajax({
url: '<?php echo BASE_URL;?>ajax/calendar.php',
type: "POST",
data: "cal-id=" + evid + "&cal-action=cal-date&cal-start=" + evstart + "&cal-end=" + evend,
dataType: "json",
cache: false
}).done(function(data) {
if (data.status == 1) {
md.showNotification('check', '<?php echo addslashes($jkl['g14']);?>', 'success', 'top', 'right');
} else {
md.showNotification('warning', '<?php echo addslashes($jkl['i3']);?>', 'danger', 'top', 'right');
}
});
}
ls.main_url = "<?php echo BASE_URL_ADMIN;?>";
ls.orig_main_url = "<?php echo BASE_URL_ORIG;?>";
ls.main_lang = "<?php echo JAK_LANG;?>";
</script>