Miglioramento orari lavorativi (#287)

This commit is contained in:
Thomas Zilio 2018-09-18 17:58:15 +02:00
parent 06ab3b0558
commit f12103192b
3 changed files with 25 additions and 16 deletions

View File

@ -574,12 +574,12 @@ if (empty($domenica)) {
slotDuration: '00:15:00',
defaultView: '<?php echo $def; ?>',
<?php
$orario_lavorativo = setting('Abilitare orario lavorativo');
if (!empty($orario_lavorativo)) {
echo "
minTime: '08:00:00',
maxTime: '20:00:00',";
}
echo "
minTime: '".setting('Inizio orario lavorativo')."',
maxTime: '".setting('Fine orario lavorativo')."',
";
?>
lazyFetching: true,
selectHelper: true,

View File

@ -135,16 +135,18 @@ class Settings
// Lista predefinita
if (preg_match("/list\[(.+?)\]/", $setting->tipo, $m)) {
$m = explode(',', $m[1]);
$list = '';
for ($j = 0; $j < count($m); ++$j) {
if ($j != 0) {
$list .= ',';
}
$list .= '\\"'.$m[$j].'\\": \\"'.$m[$j].'\\"';
$values = explode(',', $m[1]);
$list = [];
foreach ($values as $value) {
$list[] = [
'id' => $value,
'text' => $value,
];
}
$result = '
{[ "type": "select", "label": "'.$setting->nome.'", "name": "setting['.$setting->id.']", "values": "list='.$list.'", "value": "'.$setting->valore.'", "required": "'.intval($required).'" ]}';
{[ "type": "select", "label": "'.$setting->nome.'", "name": "setting['.$setting->id.']", "values": '.json_encode($list).', "value": "'.$setting->valore.'", "required": "'.intval($required).'" ]}';
}
// Lista da query
@ -159,8 +161,8 @@ class Settings
{[ "type": "checkbox", "label": "'.$setting->nome.'", "name": "setting['.$setting->id.']", "placeholder": "'.tr('Attivo').'", "value": "'.$setting->valore.'", "required": "'.intval($required).'" ]}';
}
// Textarea
elseif ($setting->tipo == 'textarea' || $setting->tipo == 'ckeditor') {
// Campi di default
elseif (in_array($setting->tipo, ['textarea', 'ckeditor', 'timestamp', 'date', 'time'])) {
$result = '
{[ "type": "'.$setting->tipo.'", "label": "'.$setting->nome.'", "name": "setting['.$setting->id.']", "value": '.json_encode($setting->valore).', "required": "'.intval($required).'" ]}';
}

View File

@ -293,3 +293,10 @@ DROP TABLE `co_preventivi_interventi`;
-- Aggiunto input CKEditor automatico
UPDATE `zz_settings` SET `tipo` = 'ckeditor' WHERE `nome` = 'Dicitura fissa fattura';
-- Miglioramento dell'impostazione "Orario lavorativo"
UPDATE `zz_settings` SET `sezione` = 'Dashboard' WHERE `nome` IN ('Vista dashboard', 'Visualizzare la domenica sul calendario', 'Utilizzare i tooltip sul calendario');
DELETE FROM `zz_settings` WHERE `nome` = 'Abilitare orario lavorativo';
INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione`, `order`) VALUES
(NULL, 'Inizio orario lavorativo', '00:00:00', 'time', 1, 'Dashboard', 1),
(NULL, 'Fine orario lavorativo', '23:59:00', 'time', 1, 'Dashboard', 2);