mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
alert template schedule #3943
This commit is contained in:
parent
e6a4eb3059
commit
89931ef564
@ -1566,7 +1566,7 @@ if ($step == 2) {
|
|||||||
|
|
||||||
function time_format(date) {
|
function time_format(date) {
|
||||||
var d = new Date(date)
|
var d = new Date(date)
|
||||||
hours = format_two_digits(d.getHours() - 1);
|
hours = format_two_digits(d.getHours());
|
||||||
minutes = format_two_digits(d.getMinutes());
|
minutes = format_two_digits(d.getMinutes());
|
||||||
seconds = format_two_digits(d.getSeconds());
|
seconds = format_two_digits(d.getSeconds());
|
||||||
return hours + ":" + minutes + ":" + seconds;
|
return hours + ":" + minutes + ":" + seconds;
|
||||||
@ -1591,7 +1591,7 @@ if ($step == 2) {
|
|||||||
selectMirror: true,
|
selectMirror: true,
|
||||||
slotDuration: '01:00:00',
|
slotDuration: '01:00:00',
|
||||||
slotLabelInterval: '02:00:00',
|
slotLabelInterval: '02:00:00',
|
||||||
snapDuration: '00:05:00',
|
snapDuration: '01:00:00',
|
||||||
slotLabelFormat: {
|
slotLabelFormat: {
|
||||||
hour: 'numeric',
|
hour: 'numeric',
|
||||||
minute: '2-digit',
|
minute: '2-digit',
|
||||||
@ -1599,15 +1599,15 @@ if ($step == 2) {
|
|||||||
},
|
},
|
||||||
slotMinTime: '00:00:00',
|
slotMinTime: '00:00:00',
|
||||||
slotMaxTime: '24:00:00',
|
slotMaxTime: '24:00:00',
|
||||||
scrollTime: '00:00:00',
|
scrollTime: '01:00:00',
|
||||||
timeFormat: 'H:mm',
|
timeFormat: 'H:mm',
|
||||||
locale: 'en-GB',
|
locale: 'en-GB',
|
||||||
timeZone: "local",
|
//timeZone: "local",
|
||||||
firstDay: 1,
|
firstDay: 1,
|
||||||
|
eventOverlap: false,
|
||||||
select: function(arg) {
|
select: function(arg) {
|
||||||
//console.log(arg);
|
|
||||||
calendar.addEvent({
|
calendar.addEvent({
|
||||||
title: 'hummmm',
|
title: '',
|
||||||
start: arg.start,
|
start: arg.start,
|
||||||
end: arg.end,
|
end: arg.end,
|
||||||
});
|
});
|
||||||
@ -1617,25 +1617,26 @@ if ($step == 2) {
|
|||||||
event.revert();
|
event.revert();
|
||||||
},
|
},
|
||||||
eventClick: function(info) {
|
eventClick: function(info) {
|
||||||
console.log('event click');
|
|
||||||
//console.log(calendar);
|
|
||||||
//console.log(calendar.getDate());
|
|
||||||
//console.log(calendar.getEvents());
|
|
||||||
|
|
||||||
var calendar_date_from = new Date(calendar.view.activeStart);
|
var calendar_date_from = new Date(calendar.view.activeStart);
|
||||||
var calendar_date_to = new Date(calendar.view.activeEnd);
|
var calendar_date_to = new Date(calendar.view.activeEnd);
|
||||||
var calendar_day_from = calendar_date_from.getDate();
|
var calendar_day_from = calendar_date_from.getDate();
|
||||||
var calendar_day_to = calendar_date_to.getDate();
|
var calendar_day_to = calendar_date_to.getDate();
|
||||||
|
|
||||||
var calendar_days = [];
|
var calendar_days = [];
|
||||||
|
var acum = 1;
|
||||||
|
var i = 0;
|
||||||
for (var index = calendar_day_from; index < calendar_day_to; index++) {
|
for (var index = calendar_day_from; index < calendar_day_to; index++) {
|
||||||
calendar_days[index] = index;
|
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++;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(calendar_days);
|
|
||||||
|
|
||||||
confirmDialog({
|
confirmDialog({
|
||||||
title: 'Eventoooooo',
|
title: 'Event',
|
||||||
message: function () {
|
message: function () {
|
||||||
var id = "div-" + uniqId();
|
var id = "div-" + uniqId();
|
||||||
var loading = "<?php echo __('Loading, this operation might take several minutes...'); ?>";
|
var loading = "<?php echo __('Loading, this operation might take several minutes...'); ?>";
|
||||||
@ -1645,16 +1646,15 @@ if ($step == 2) {
|
|||||||
data: {
|
data: {
|
||||||
page: 'include/ajax/alert_list.ajax',
|
page: 'include/ajax/alert_list.ajax',
|
||||||
resize_event_week: true,
|
resize_event_week: true,
|
||||||
day_from: info.el.fcSeg.start.getDay(),
|
day_from: info.event.start.getDay(),
|
||||||
day_to: info.el.fcSeg.end.getDay(),
|
day_to: info.event.end.getDay(),
|
||||||
time_from: time_format(info.el.fcSeg.start),
|
time_from: time_format(info.event.start),
|
||||||
time_to: time_format(info.el.fcSeg.end),
|
time_to: time_format(info.event.end),
|
||||||
},
|
},
|
||||||
dataType: "html",
|
dataType: "html",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
$('#' + id).empty().append(data);
|
$('#' + id).empty().append(data);
|
||||||
$("#text-time_from, #text-time_to").timepicker({
|
$("#text-time_from_event, #text-time_to_event").timepicker({
|
||||||
showSecond: false,
|
|
||||||
timeFormat: '<?php echo TIME_FORMAT_JS; ?>',
|
timeFormat: '<?php echo TIME_FORMAT_JS; ?>',
|
||||||
timeOnlyTitle: '<?php echo __('Choose time'); ?>',
|
timeOnlyTitle: '<?php echo __('Choose time'); ?>',
|
||||||
timeText: '<?php echo __('Time'); ?>',
|
timeText: '<?php echo __('Time'); ?>',
|
||||||
@ -1668,30 +1668,47 @@ if ($step == 2) {
|
|||||||
$.datepicker.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]);
|
$.datepicker.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]);
|
||||||
},
|
},
|
||||||
error: function(error) {
|
error: function(error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return "<div id ='" + id + "'>" + loading + "</div>";
|
return "<div id ='" + id + "'>" + loading + "</div>";
|
||||||
},
|
},
|
||||||
onAccept: function() {
|
onAccept: function() {
|
||||||
var replace_day_from = $('#day_from').val();
|
var remove_event = $('#checkbox-remove_event').is(':checked');
|
||||||
var replace_day_to = $('#day_to').val();
|
if(remove_event === false) {
|
||||||
var replace_time_from = $('#text-time_from').val();
|
var replace_day_from = $('#hidden-day_from').val();
|
||||||
var replace_time_to = $('#text-time_to').val();
|
var replace_time_from = $('#text-time_from_event').val();
|
||||||
|
|
||||||
console.log(replace_day_from);
|
var array_time_from = replace_time_from.split(':');
|
||||||
console.log(replace_day_to);
|
var new_date_from = new Date(calendar_days[replace_day_from]);
|
||||||
console.log(replace_time_from);
|
new_date_from.setHours(
|
||||||
console.log(replace_time_to);
|
array_time_from[0],
|
||||||
|
array_time_from[1],
|
||||||
|
array_time_from[2]
|
||||||
|
);
|
||||||
|
|
||||||
//info.el.remove();
|
var replace_day_to = $('#hidden-day_to').val();
|
||||||
console.log(info.event);
|
var replace_time_to = $('#text-time_to_event').val();
|
||||||
//info.event.setDates('2022-01-24T00:00:00','2022-01-24T23:59:59')
|
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]
|
||||||
|
);
|
||||||
|
|
||||||
|
info.event.setDates(new_date_from,new_date_to);
|
||||||
|
} else {
|
||||||
|
info.event.remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//arg.event.remove()
|
|
||||||
},
|
},
|
||||||
eventOverlap: function(stillEvent, movingEvent) {
|
eventOverlap: function(stillEvent, movingEvent) {
|
||||||
return stillEvent.allDay && movingEvent.allDay;
|
return stillEvent.allDay && movingEvent.allDay;
|
||||||
|
@ -571,35 +571,18 @@ if ($resize_event_week === true) {
|
|||||||
$time_from = get_parameter('time_from', '');
|
$time_from = get_parameter('time_from', '');
|
||||||
$time_to = get_parameter('time_to', '');
|
$time_to = get_parameter('time_to', '');
|
||||||
|
|
||||||
hd($day_from, true);
|
|
||||||
hd($day_to, true);
|
|
||||||
|
|
||||||
$days = [
|
|
||||||
__('Sunday'),
|
|
||||||
__('Monday'),
|
|
||||||
__('Tuesday'),
|
|
||||||
__('Wednesday'),
|
|
||||||
__('Thursday'),
|
|
||||||
__('Friday'),
|
|
||||||
__('Saturday'),
|
|
||||||
];
|
|
||||||
|
|
||||||
$table = new StdClass();
|
$table = new StdClass();
|
||||||
$table->class = 'databox filters';
|
$table->class = 'databox filters';
|
||||||
$table->width = '100%';
|
$table->width = '100%';
|
||||||
$table->data = [];
|
$table->data = [];
|
||||||
$table->data[0][0] = __('From:');
|
$table->data[0][0] = __('From:');
|
||||||
$table->data[0][1] = html_print_select(
|
$table->data[0][1] = html_print_input_hidden(
|
||||||
$days,
|
|
||||||
'day_from',
|
'day_from',
|
||||||
$day_from,
|
$day_from,
|
||||||
'',
|
|
||||||
'',
|
|
||||||
0,
|
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
$table->data[0][2] = html_print_input_text(
|
$table->data[0][1] .= html_print_input_text(
|
||||||
'time_from',
|
'time_from_event',
|
||||||
$time_from,
|
$time_from,
|
||||||
'',
|
'',
|
||||||
9,
|
9,
|
||||||
@ -607,24 +590,28 @@ if ($resize_event_week === true) {
|
|||||||
true
|
true
|
||||||
);
|
);
|
||||||
$table->data[1][0] = __('To:');
|
$table->data[1][0] = __('To:');
|
||||||
$table->data[1][1] = html_print_select(
|
$table->data[1][1] = html_print_input_hidden(
|
||||||
$days,
|
|
||||||
'day_to',
|
'day_to',
|
||||||
$day_to,
|
$day_from,
|
||||||
'',
|
|
||||||
'',
|
|
||||||
0,
|
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
$table->data[1][2] = html_print_input_text(
|
$table->data[1][1] .= html_print_input_text(
|
||||||
'time_to',
|
'time_to_event',
|
||||||
$time_to,
|
($time_to === '00:00:00') ? '23:59:59' : $time_to,
|
||||||
'',
|
'',
|
||||||
9,
|
9,
|
||||||
9,
|
9,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
|
echo __('Remove');
|
||||||
|
echo html_print_checkbox_switch(
|
||||||
|
'remove_event',
|
||||||
|
1,
|
||||||
|
false,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
echo html_print_table($table, true);
|
echo html_print_table($table, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user