1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2024-12-23 22:03:18 +01:00

Fix selezione sottocategorie in Combinazioni

This commit is contained in:
MatteoPistorello 2022-09-09 12:11:28 +02:00
parent f22794bb24
commit 2484ac2d6f
2 changed files with 21 additions and 4 deletions

View File

@ -21,7 +21,6 @@ echo '
<div class="row">
<div class="col-md-6">
'.Modules::link('Categorie articoli', $record['id_categoria'], null, null, 'class="pull-right"').'
{[ "type": "select", "label": "'.tr('Categoria').'", "name": "id_categoria", "required": 0, "value": "$id_categoria$", "ajax-source": "categorie", "icon-after": "add|'.Modules::get('Categorie articoli')['id'].'" ]}
</div>
@ -44,4 +43,12 @@ echo '
</button>
</div>
</div>
</form>';
</form>
<script>
$("#id_categoria").change(function() {
updateSelectOption("id_categoria", $(this).val());
$("#id_sottocategoria").val(null).trigger("change");
});
</script>';

View File

@ -26,8 +26,12 @@ echo '
</div>
<div class="row">
<div class="col-md-6">
'.Modules::link('Categorie articoli', $record['id_categoria'], null, null, 'class="pull-right"').'
<div class="col-md-6">';
if (!empty($record['id_categoria'])) {
echo '
'.Modules::link('Categorie articoli', $record['id_categoria'], null, null, 'class="pull-right"');
}
echo '
{[ "type": "select", "label": "'.tr('Categoria').'", "name": "id_categoria", "required": 0, "value": "$id_categoria$", "ajax-source": "categorie", "icon-after": "add|'.Modules::get('Categorie articoli')['id'].'" ]}
</div>
@ -127,4 +131,10 @@ function generaVarianti(button) {
backto: "record-edit",
});
}
$("#id_categoria").change(function() {
updateSelectOption("id_categoria", $(this).val());
$("#id_sottocategoria").val(null).trigger("change");
});
</script>';