2017-08-04 16:28:16 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
include_once __DIR__.'/../../core.php';
|
|
|
|
|
|
|
|
unset($_SESSION['superselect']['id_categoria']);
|
|
|
|
|
2018-02-23 16:04:50 +01:00
|
|
|
?><form action="" method="post" id="add-form">
|
2017-08-04 16:28:16 +02:00
|
|
|
<input type="hidden" name="op" value="add">
|
|
|
|
<input type="hidden" name="backto" value="record-edit">
|
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-6">
|
2017-09-04 12:02:29 +02:00
|
|
|
{[ "type": "text", "label": "<?php echo tr('Inserisci il codice:'); ?>", "name": "codice", "required": 1, "value": "" ]}
|
2017-08-04 16:28:16 +02:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="col-md-6">
|
2017-09-04 12:02:29 +02:00
|
|
|
{[ "type": "text", "label": "<?php echo tr('Inserisci la descrizione:'); ?>", "name": "descrizione", "required": 1, "value": "" ]}
|
2017-08-04 16:28:16 +02:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="col-md-6">
|
2017-09-22 15:19:59 +02:00
|
|
|
{[ "type": "select", "label": "<?php echo tr('Inserisci la categoria:'); ?>", "name": "categoria", "required": 1, "value": "", "ajax-source": "categorie", "icon-after": "add|<?php echo Modules::get('Categorie')['id']; ?>" ]}
|
2017-08-04 16:28:16 +02:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="col-md-6">
|
2017-12-16 19:03:26 +01:00
|
|
|
{[ "type": "select", "label": "<?php echo tr('Inserisci la subcategoria:'); ?>", "name": "subcategoria", "id": "subcategoria_add", "value": "", "ajax-source": "sottocategorie", "icon-after": "add|<?php echo Modules::get('Categorie')['id']; ?>||hide" ]}
|
2017-08-04 16:28:16 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- PULSANTI -->
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-12 text-right">
|
2017-09-04 12:02:29 +02:00
|
|
|
<button type="submit" class="btn btn-primary"><i class="fa fa-plus"></i> <?php echo tr('Aggiungi'); ?></button>
|
2017-08-04 16:28:16 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
|
|
|
|
<script>
|
2017-09-04 17:08:26 +02:00
|
|
|
$(document).ready(function () {
|
2018-02-23 16:04:50 +01:00
|
|
|
var sub = $('#add-form').find('#subcategoria_add');
|
2017-09-04 17:08:26 +02:00
|
|
|
var original = sub.parent().find(".input-group-addon button").data("href");
|
|
|
|
|
2018-02-23 16:04:50 +01:00
|
|
|
$('#add-form').find('#categoria').change( function(){
|
2017-09-04 17:08:26 +02:00
|
|
|
session_set('superselect,id_categoria', $(this).val(), 0);
|
|
|
|
|
|
|
|
sub.selectReset();
|
|
|
|
|
|
|
|
if($(this).val()){
|
|
|
|
sub.parent().find(".input-group-addon button").removeClass("hide");
|
|
|
|
sub.parent().find(".input-group-addon button").data("href", original + "&id_original="+$(this).val());
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
sub.parent().find(".input-group-addon button").addClass("hide");
|
|
|
|
}
|
|
|
|
});
|
2017-08-04 16:28:16 +02:00
|
|
|
});
|
|
|
|
</script>
|