diff --git a/pandora_console/godmode/alerts/alert_special_days.php b/pandora_console/godmode/alerts/alert_special_days.php
index 2e4242e90f..a742068795 100644
--- a/pandora_console/godmode/alerts/alert_special_days.php
+++ b/pandora_console/godmode/alerts/alert_special_days.php
@@ -59,10 +59,10 @@ if (is_ajax() === true) {
$id_group = get_parameter('id_group', 0);
$same_day = get_parameter('same_day', '');
- echo '
'.__('Same as %s', ucfirst($same_day));
- echo ' » ';
- echo __('Templates not being fired');
- echo '
';
+ $output = ''.__('Same as %s', ucfirst($same_day));
+ $output .= ' » ';
+ $output .= __('Templates not being fired');
+ $output .= '
';
$columns = [
'name',
@@ -90,10 +90,10 @@ if (is_ajax() === true) {
__('Sun'),
];
try {
- ui_print_datatable(
+ $output .= ui_print_datatable(
[
'id' => 'templates_alerts_special_days',
- 'return' => false,
+ 'return' => true,
'class' => 'info_table',
'style' => 'width: 100%',
'columns' => $columns,
@@ -132,9 +132,11 @@ if (is_ajax() === true) {
]
);
} catch (Exception $e) {
- echo $e->getMessage();
+ $output .= $e->getMessage();
}
+ echo $output;
+
return;
}
@@ -158,7 +160,7 @@ if (is_ajax() === true) {
$data = [];
if (empty($templates) === false) {
foreach ($templates as $template) {
- if ((bool) $template[$same_day] === true) {
+ if ((bool) $template[$same_day] === false) {
$data[] = [
'name' => $template['name'],
'id_group' => ui_print_group_icon(
@@ -814,6 +816,36 @@ for ($month = 1; $month <= 12; $month++) {
$cal_table->data[$cal_line][$week] .= '';
$cal_table->data[$cal_line][$week] .= '';
if ($special_day['id_group'] || ($can_manage_group_all && $special_day['id_group'] == 0)) {
+ $script_delete = '';
+ $dateformat = date_create($special_day['date']);
+ $options_zoom = htmlspecialchars(
+ json_encode(
+ [
+ 'date' => $special_day['date'],
+ 'id_group' => $special_day['id_group'],
+ 'same_day' => $special_day['same_day'],
+ 'btn_ok_text' => __('Create'),
+ 'btn_cancel_text' => __('Cancel'),
+ 'title' => date_format($dateformat, 'd M Y'),
+ 'url' => ui_get_full_url('ajax.php', false, false, false),
+ 'page' => 'godmode/alerts/alert_special_days',
+ 'loading' => __('Loading, this operation might take several minutes...'),
+ ]
+ ),
+ ENT_QUOTES,
+ 'UTF-8'
+ );
+
+ $onclick_zoom = 'load_templates_alerts_special_days('.$options_zoom.')';
+ $cal_table->data[$cal_line][$week] .= '
data[$cal_line][$week] .= 'title="';
+ $cal_table->data[$cal_line][$week] .= __('Show templates');
+ $cal_table->data[$cal_line][$week] .= '">';
+ $cal_table->data[$cal_line][$week] .= html_print_image(
+ 'images/zoom.png',
+ true,
+ ['class' => 'invert_filter']
+ ).'';
$cal_table->data[$cal_line][$week] .= '
data[$cal_line][$week] .= '>'.html_print_image(
diff --git a/pandora_console/godmode/alerts/configure_alert_special_days.php b/pandora_console/godmode/alerts/configure_alert_special_days.php
index 14269e5a77..93d70238a5 100644
--- a/pandora_console/godmode/alerts/configure_alert_special_days.php
+++ b/pandora_console/godmode/alerts/configure_alert_special_days.php
@@ -172,19 +172,26 @@ if (empty($id) === false) {
echo ' ';
echo '';
echo '';
+
ui_require_javascript_file('pandora_alerts');
?>
';
+ // Load buttons.dataTables.min.js.
+ $output .= '';
+ // Load dataTables.buttons.min.js.
+ $output .= '';
+ // Load buttons.html5.min.js.
+ $output .= '';
+ // Load buttons.print.min.js.
+ $output .= '';
}
- ui_require_javascript_file('datatables.min');
- ui_require_javascript_file('buttons.dataTables.min');
- ui_require_javascript_file('dataTables.buttons.min');
- ui_require_javascript_file('buttons.html5.min');
- ui_require_javascript_file('buttons.print.min');
-
if (isset($parameters['return']) && $parameters['return'] == true) {
// Compat.
$parameters['print'] = false;
diff --git a/pandora_console/include/javascript/pandora_alerts.js b/pandora_console/include/javascript/pandora_alerts.js
index ce71c5e3e5..9eff390916 100644
--- a/pandora_console/include/javascript/pandora_alerts.js
+++ b/pandora_console/include/javascript/pandora_alerts.js
@@ -75,10 +75,9 @@ function load_templates_alerts_special_days(settings) {
},
datatype: "html",
success: function(data) {
- console.log(data);
$("#" + id)
.empty()
- .append(data);
+ .html(data);
},
error: function(e) {
showMsg(e);