Aggiunto ajax-source per zone

This commit is contained in:
Luca 2019-11-20 10:24:56 +01:00
parent a89f954e62
commit ed96f1ed28
3 changed files with 21 additions and 2 deletions

View File

@ -0,0 +1,19 @@
<?php
include_once __DIR__.'/../../../core.php';
switch ($resource) {
case 'zone':
$query = 'SELECT `id`, CONCAT(`nome`, \' - \', `descrizione`) AS `descrizione` FROM an_zone |where| ORDER BY descrizione ASC';
foreach ($elements as $element) {
$filter[] = 'id='.prepare($element);
}
if (!empty($search)) {
$search_fields[] = 'nome LIKE '.prepare('%'.$search.'%');
$search_fields[] = 'descrizione LIKE '.prepare('%'.$search.'%');
}
break;
}

View File

@ -47,7 +47,7 @@ echo '
{[ "type": "select", "label": "'.tr('Nazione').'", "name": "id_nazione", "ajax-source": "nazioni" ]}
</div>
<div class="col-md-6">
{[ "type": "select", "label": "'.tr('Zona').'", "name": "idzona", "values": "query=SELECT `id`, CONCAT(`nome`, \' - \', `descrizione`) AS `descrizione` FROM `an_zone` ORDER BY `descrizione` ASC" ]}
{[ "type": "select", "label": "'.tr('Zona').'", "name": "idzona", "ajax-source": "zone", "placeholder": "'.tr('Nessuna zona').'", "icon-after": "add|'.Modules::get('Zone')['id'].'" ]}
</div>
</div>

View File

@ -80,7 +80,7 @@ echo '
</div>
<div class="col-md-6">
{[ "type": "select", "label": "'.tr('Zona').'", "name": "idzona", "values": "query=SELECT `id`, CONCAT_WS(\' - \', `nome`, `descrizione`) AS `descrizione` FROM `an_zone` ORDER BY `descrizione` ASC", "value": "$idzona$", "placeholder": "'.tr('Nessuna zona').'", "icon-after": "add|'.Modules::get('Zone')['id'].'" ]}
{[ "type": "select", "label": "'.tr('Zona').'", "name": "idzona", "ajax-source": "zone", "value": "$idzona$", "placeholder": "'.tr('Nessuna zona').'", "icon-after": "add|'.Modules::get('Zone')['id'].'" ]}
</div>
</div>
<div class="row">