Non puoi selezionare più di 25 argomenti
Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
104 righe
4.7 KiB
104 righe
4.7 KiB
<? if (isset($id) && !empty($elements)) { |
|
$fields = array_keys($elements); |
|
$fields = base64_encode(json_encode($fields)); |
|
if (!empty($data) && is_array($data)) { |
|
$data = http_build_query($data); |
|
} |
|
?> |
|
<div class="accordion" id="massivePanel<?= $id ?>"> |
|
<div class="card"> |
|
<div class="card-header" id="headingDownloadCSV"> |
|
<h5 class="mb-0 card-title"> |
|
<button class="btn " type="button" data-toggle="collapse" data-target="#downloadCSV" aria-expanded="true" aria-controls="downloadCSV"> |
|
<span class="fa fa-download"></span> <?= __("Download") ?> CSV |
|
</button> |
|
</h5> |
|
</div> |
|
<div id="downloadCSV" class="collapse show" aria-labelledby="headingDownloadCSV" data-parent="#massivePanel<?= $id ?>"> |
|
<div class="card-body text-center"> |
|
<a class="btn btn-block btn-success" href="<?= empty($overideDownload) ? "/backend/common/massiveHelper/model.php?fields={$fields}" : $overideDownload ?>" target="_blank" download="model.csv"> |
|
<span class="fa fa-download fa-5x"></span><br> |
|
<?= __("Download") ?> CSV |
|
</a> |
|
<button class="btn btn-block btn-info" data-toggle="collapse" data-target="#compilaCSV" ><?= __("Step successivo") ?> <span class="fa fa-forward"></span> </button> |
|
</div> |
|
</div> |
|
</div> |
|
<div class="card"> |
|
<div class="card-header" id="headingCompilaCSV"> |
|
<h5 class="mb-0 card-title"> |
|
<button class="btn collapsed" type="button" data-toggle="collapse" data-target="#compilaCSV" aria-expanded="false" aria-controls="compilaCSV"> |
|
<span class="fa fa-table"></span> <?= __("Compila") ?> CSV |
|
</button> |
|
</h5> |
|
</div> |
|
<div id="compilaCSV" class="collapse" aria-labelledby="headingCompilaCSV" data-parent="#massivePanel<?= $id ?>"> |
|
<div class="card-body"> |
|
<h4><?= __("Guida di compilazione") ?></h4> |
|
<? alertManager::printWarningBox(__("Il file da caricare dovrà essere generato includendo ogni campo in doppi apici (\") ed utilizzando il separatore punto e virgola (;)")); ?> |
|
<div class="table-responsive"> |
|
<table class="table table-striped"> |
|
<thead> |
|
<tr> |
|
<th><?= __("Nome colonna") ?></th> |
|
<th><?= __("Obbligatorio") ?></th> |
|
<th><?= __("Descrizione") ?></th> |
|
<th><?= __("Tipologia") ?></th> |
|
<th width="150"><?= __("Valori") ?></th> |
|
</tr> |
|
</thead> |
|
<tbody> |
|
<? foreach($elements AS $key => $descr) { ?> |
|
<tr> |
|
<td><strong><?= $key ?></strong></td> |
|
<td class="text-center"><?= $descr["obbligatorio"] ?></td> |
|
<td><?= __($descr["descrizione"]) ?></td> |
|
<td class="text-center"><?= __($descr["tipo"]) ?></td> |
|
<td><?= implode("<br>",$descr["valori"] ?? []) ?></td> |
|
</tr> |
|
<? } ?> |
|
</tbody> |
|
</table> |
|
</div> |
|
<button class="btn btn-block btn-info" data-toggle="collapse" data-target="#uploadCSV<?= $id ?>" ><?= __("Step successivo") ?> <span class="fa fa-forward"></span> </button> |
|
</div> |
|
</div> |
|
</div> |
|
<div class="card"> |
|
<div class="card-header" id="headingUploadCSV<?= $id ?>"> |
|
<h5 class="mb-0"> |
|
<button class="btn collapsed" type="button" data-toggle="collapse" data-target="#uploadCSV<?= $id ?>" aria-expanded="false" aria-controls="uploadCSV<?= $id ?>"> |
|
<span class="fa fa-upload"></span> <?= __("Upload") ?> CSV |
|
</button> |
|
</h5> |
|
</div> |
|
<div id="uploadCSV<?= $id ?>" class="collapse" aria-labelledby="headingUploadCSV<?= $id ?>" data-parent="#massivePanel<?= $id ?>"> |
|
<div class="card-body"> |
|
<? |
|
ob_start(); |
|
?> |
|
$("#wait_div").show(); |
|
$.ajax({ |
|
url: '<?= $action ?>', |
|
type: 'POST', |
|
dataType: 'text', |
|
data: "<?= (!empty($data)) ? ($data."&") : "" ?>filechunk="+file.name |
|
}) |
|
.done(function(response) { |
|
$("#wait_div").hide(); |
|
$("#massivePanel<?= $id ?>").html(response); |
|
}) |
|
.fail(function() { |
|
swal(js_dict["error-retry"]); |
|
}); |
|
<? |
|
$successScript = ob_get_clean(); |
|
filesManager::insertUploadForm($successScript,"loadCSV{$id}",["maxNumberOfFiles"=>1,"allowedTypes"=>[".csv"]]); |
|
?> |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
<? } else { |
|
alertManager::printAlertBox(__("Errore configurazione")); |
|
} ?>
|