diff --git a/modules/dashboard/ajax.php b/modules/dashboard/ajax.php
index 23cce788f..f3aa19131 100644
--- a/modules/dashboard/ajax.php
+++ b/modules/dashboard/ajax.php
@@ -21,6 +21,7 @@ include_once __DIR__.'/../../core.php';
$modulo_interventi = Modules::get('Interventi');
$modulo_preventivi = Modules::get('Preventivi');
+$modulo_eventi = Modules::get('Eventi');
if (!isset($user['idanagrafica'])) {
$user['idanagrafica'] = '';
@@ -118,7 +119,7 @@ switch (filter('op')) {
}
if (setting('Visualizza informazioni aggiuntive sul calendario')) {
- //# Box allDay
+ //# Box allDay preventivi
$query = 'SELECT
co_preventivi.id,
co_preventivi.nome,
@@ -175,6 +176,34 @@ switch (filter('op')) {
];
}
}
+
+ //# Box allDay eventi
+ $query = 'SELECT
+ *
+ FROM
+ zz_events
+ WHERE
+ data >= '.prepare($start).' AND data <= '.prepare($end);
+
+ $alldays = $dbo->fetchArray($query);
+
+ foreach ($alldays as $evento) {
+ $results[] = [
+ 'id' => $modulo_eventi->id.'_'.$evento['id'],
+ 'idintervento' => $evento['id'],
+ 'idtecnico' => '',
+ 'title' => ''.tr('Evento').': '.$evento['nome'].'
+ '.tr('Festività').': '.($evento['is_bank_holiday'] ? '' : ''),
+ 'start' => $evento['data'],
+ 'end' => $evento['data'],
+ 'url' => base_path().'/editor.php?id_module='.$modulo_eventi->id.'&id_record='.$evento['id'],
+ 'backgroundColor' => '#ffebcd',
+ 'textColor' => color_inverse('#ffebcd'),
+ 'borderColor' => '#ffebcd',
+ 'allDay' => true,
+ 'eventStartEditable' => false,
+ ];
+ }
}
echo json_encode($results);
diff --git a/modules/eventi/actions.php b/modules/eventi/actions.php
index f326cf2bb..428f0096b 100644
--- a/modules/eventi/actions.php
+++ b/modules/eventi/actions.php
@@ -53,11 +53,13 @@ switch (post('op')) {
case 'add':
$nome = post('nome');
+ $data = post('data');
$id_nazione = post('id_nazione');
- if ($dbo->fetchNum('SELECT * FROM `zz_events` WHERE `id_nazione` = '.prepare($id_nazione).' AND `nome`='.prepare($nome)) == 0) {
+ if ($dbo->fetchNum('SELECT * FROM `zz_events` WHERE `id_nazione` = '.prepare($id_nazione).' AND `nome`='.prepare($nome).' AND `data`='.prepare($data)) == 0) {
$dbo->insert('zz_events', [
'nome' => $nome,
+ 'data' => $data,
'id_nazione' => $id_nazione,
]);
diff --git a/modules/eventi/add.php b/modules/eventi/add.php
index e937fa9f0..f43278c7f 100644
--- a/modules/eventi/add.php
+++ b/modules/eventi/add.php
@@ -28,7 +28,11 @@ include_once __DIR__.'/../../core.php';
{[ "type": "text", "label": "", "name": "nome", "required": 1 ]}
-