2018-02-23 19:04:05 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
include_once __DIR__.'/../../core.php';
|
|
|
|
|
|
|
|
$list = [];
|
2020-08-06 18:51:56 +02:00
|
|
|
foreach ($moduli_disponibili as $id => $value) {
|
|
|
|
$modulo = Modules::get($id);
|
|
|
|
|
2018-02-23 19:04:05 +01:00
|
|
|
$list[] = [
|
2020-08-06 18:51:56 +02:00
|
|
|
'id' => $id,
|
|
|
|
'text' => $modulo['title'],
|
2018-02-23 19:04:05 +01:00
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
?><form action="" method="post" id="add-form" enctype="multipart/form-data">
|
2020-08-06 18:51:56 +02:00
|
|
|
<input type="hidden" name="op" value="add">
|
2018-02-23 19:04:05 +01:00
|
|
|
<input type="hidden" name="backto" value="record-edit">
|
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-6">
|
2020-08-06 18:51:56 +02:00
|
|
|
{[ "type": "file", "label": "<?php echo tr('File'); ?>", "name": "file", "required": 1, "accept": ".csv" ]}
|
2018-02-23 19:04:05 +01:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="col-md-6">
|
2020-08-06 18:51:56 +02:00
|
|
|
{[ "type": "select", "label": "<?php echo tr('Modulo'); ?>", "name": "module", "required": 1, "values": <?php echo json_encode($list); ?> ]}
|
2018-02-23 19:04:05 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- PULSANTI -->
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-12 text-right">
|
2020-08-06 18:51:56 +02:00
|
|
|
<button id="example" type="button" class="btn btn-info hidden">
|
|
|
|
<i class="fa fa-file"></i> <?php echo tr('Scarica esempio CSV'); ?>
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<button type="submit" class="btn btn-primary">
|
|
|
|
<i class="fa fa-plus"></i> <?php echo tr('Aggiungi'); ?>
|
|
|
|
</button>
|
2018-02-23 19:04:05 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
2018-05-23 11:54:49 +02:00
|
|
|
|
|
|
|
<script>
|
2020-08-06 18:51:56 +02:00
|
|
|
$("#module").change(function () {
|
|
|
|
if ($(this).val()) {
|
|
|
|
$("#example").removeClass("hidden");
|
|
|
|
} else {
|
|
|
|
$("#example").addClass("hidden");
|
|
|
|
}
|
|
|
|
});
|
2018-05-23 11:54:49 +02:00
|
|
|
|
2020-08-06 18:51:56 +02:00
|
|
|
$("#example").click(function() {
|
|
|
|
$.ajax({
|
|
|
|
url: globals.rootdir + "/actions.php",
|
|
|
|
type: "post",
|
|
|
|
data: {
|
|
|
|
op: "example",
|
|
|
|
id_module: globals.id_module,
|
|
|
|
module: $('#module').val(),
|
|
|
|
},
|
|
|
|
success: function(data) {
|
|
|
|
if (data) {
|
|
|
|
window.location = data;
|
|
|
|
}
|
2018-09-19 09:51:36 +02:00
|
|
|
|
2020-08-06 18:51:56 +02:00
|
|
|
$('#main_loading').fadeOut();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
2018-09-19 09:51:36 +02:00
|
|
|
</script>
|