Gestione flag Attivo in Template

This commit is contained in:
MatteoPistorello 2024-09-20 10:34:38 +02:00
parent ba157f40ac
commit 0f6acf1faa
4 changed files with 11 additions and 3 deletions

View File

@ -58,6 +58,7 @@ switch (post('op')) {
$template->setTranslation('body', post('body'));
$template->type = post('type');
$template->indirizzi_proposti = post('indirizzi_proposti');
$template->enabled = post('enabled');
$template->save();
$prints[] = post('prints');

View File

@ -40,13 +40,17 @@ if (!$record['predefined']) {
<div class="card-body">
<div class="row">
<div class="col-md-8">
<div class="col-md-6">
{[ "type": "text", "label": "<?php echo tr('Nome'); ?>", "name": "name", "value": "$title$", "required": 1, "extra": "<?php echo $attr; ?>" ]}
</div>
<div class="col-md-4">
{[ "type": "span", "label": "<?php echo tr('Modulo del template'); ?>", "name": "module", "values": "query=SELECT `zz_modules`.`id`, `title` AS descrizione FROM `zz_modules` LEFT JOIN `zz_modules_lang` ON (`zz_modules`.`id` = `zz_modules_lang`.`id_record` AND `zz_modules_lang`.`id_lang` = <?php echo prepare(Models\Locale::getDefault()->id); ?>) WHERE `enabled` = 1", "value": "<?php echo Module::find($record['id_module'])->getTranslation('title'); ?>" ]}
</div>
<div class="col-md-2">
{[ "type": "checkbox", "label": "<?php echo tr('Attivo'); ?>", "name": "enabled", "value": "$enabled$", "values": "Sì,No" ]}
</div>
</div>
<div class="row">

View File

@ -125,7 +125,7 @@ class ButtonManager implements ManagerInterface
if ($options['type'] == 'print') {
$results = \Prints::getModulePrints($options['id_module']);
} elseif ($options['type'] == 'email') {
$results = TemplateEmail::where('id_module', $options['id_module'])->with(['translations' => function ($query) {
$results = TemplateEmail::where('id_module', $options['id_module'])->where('enabled', 1)->with(['translations' => function ($query) {
$query->orderBy('title');
}])->get()->toArray();
} elseif ($options['type'] == 'sms') {

View File

@ -37,4 +37,7 @@ INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione`
INSERT INTO `zz_settings_lang` (`id`, `id_lang`, `id_record`, `title`, `help`) VALUES
(NULL, '1', (SELECT `zz_settings`.`id` FROM `zz_settings` WHERE `zz_settings`.`nome` = 'Tile server satellite'), 'Tile server satellite', ''),
(NULL, '2', (SELECT `zz_settings`.`id` FROM `zz_settings` WHERE `zz_settings`.`nome` = 'Tile server satellite'), 'Satellite tile server', '');
(NULL, '2', (SELECT `zz_settings`.`id` FROM `zz_settings` WHERE `zz_settings`.`nome` = 'Tile server satellite'), 'Satellite tile server', '');
-- Aggiunto flag Attivo in Template
ALTER TABLE `em_templates` ADD `enabled` BOOLEAN NOT NULL DEFAULT TRUE AFTER `note_aggiuntive`;