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.
253 righe
14 KiB
253 righe
14 KiB
<? |
|
if(! empty($showTable)) { |
|
$sendAll = false; |
|
$tokenEsportazione = base64_encode(generateStrongPassword()); |
|
// if(Ente::hasProviderConservazione() && $_SESSION["utente"]->isSupportoOrRoot()) { |
|
// $p = $pdo->go("SELECT COUNT(codice) FROM b_conservazione WHERE stato = 5")->fetch(PDO::FETCH_COLUMN, 0); |
|
// if($p > 0) { $sendAll = true; } |
|
// } |
|
switch ($radice) { |
|
case 'gare': |
|
$createNewArchive = true; |
|
$reference = $gara->info["codice"]; |
|
break; |
|
case 'contratti': |
|
$createNewArchive = true; |
|
$reference = $contratto->info["codice"]; |
|
break; |
|
default: |
|
$createNewArchive = false; |
|
break; |
|
} |
|
|
|
?> |
|
<div class="row"> |
|
<div class="col-12 text-right"> |
|
<? if($sendAll) : ?> |
|
<a class="btn btn-primary" href="send-all.php" role="button"><i class="fas fa-upload mr-2"></i><?= __("Invia tutti i pacchetti") ?></a> |
|
<? endif; ?> |
|
<? if(empty($hideFilters)) : ?> |
|
<a class="btn btn-warning" data-toggle="collapse" href="#filters" role="button" aria-expanded="false" aria-controls="filters"><i class="fas fa-filter mr-2"></i><?= __("Filtri") ?></a> |
|
<? endif; ?> |
|
<? if(! empty($createNewArchive)) : ?> |
|
<div class="dropdown d-inline"> |
|
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> |
|
<i class="fas fa-archive mr-2"></i><?= __("Crea nuovo archivio") ?> |
|
</button> |
|
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton"> |
|
<a class="dropdown-item text-primary" href="javascript:void(0)" role="button" onclick="archive('<?= $reference ?>', true)"><i class="fas fa-download mr-2"></i><?= __("Archivio di download") ?></a> |
|
<? if(Ente::hasProviderConservazione() && $radice == "gare") : ?> |
|
<a class="dropdown-item text-info" href="javascript:void(0)" role="button" onclick="archive('<?= $reference ?>', false)"><i class="fas fa-cloud mr-2"></i><?= __("Archivio di conservazione") ?></a> |
|
<? endif ?> |
|
</div> |
|
</div> |
|
<script type="text/javascript"> |
|
var archive = function(codice, download) { |
|
if(download) { |
|
Swal({ |
|
title: "Desidera includere i file già presenti in altri archivi?", |
|
text: "Cliccando su si il sistema genererà un fascicolo di gara contenente tutti i documenti rinvenibili per la procedura, viceversa sarà creato un archivio con i soli documenti non presenti in alcun altro fascicolo.", |
|
type: "info", |
|
showCancelButton: true, |
|
confirmButtonColor: 'var(--success)', |
|
cancelButtonColor: 'var(--danger)', |
|
confirmButtonText: 'Si', |
|
cancelButtonText: 'No', |
|
showCloseButton: true, |
|
focusConfirm: false, |
|
closeOnConfirm: true, |
|
reverseButtons: true, |
|
}).then((result) => { |
|
var full = false; |
|
var text = "Stai per creare un nuovo archivio con i soli file non inclusi in nessun altro fascicolo." |
|
if(result.value) { |
|
var full = true; |
|
var text = "Stai per creare un nuovo archivio con tutti i documenti disponibili nella procedura." |
|
} |
|
console.log(full); |
|
Swal({ |
|
title: "Sei sicuro di voler procedere?", |
|
text: text, |
|
type: "warning", |
|
showCancelButton: true, |
|
confirmButtonColor: 'var(--success)', |
|
cancelButtonColor: 'var(--danger)', |
|
confirmButtonText: 'Si', |
|
cancelButtonText: 'No', |
|
showCloseButton: false, |
|
}).then((result) => { |
|
if(result.value) { |
|
$.ajax({ |
|
type: "POST", |
|
url: 'fascicolo.php', |
|
data: {codice: codice, full: full, download: true}, |
|
dataType: "script", |
|
beforeSend: function () { |
|
$('#wait').fadeIn(); |
|
} |
|
}).done(function(script) { |
|
script; |
|
}).fail(function() { |
|
swal(js_dict["error-retry"]); |
|
}).always(function() { |
|
$('#wait').fadeOut(); |
|
}); |
|
} |
|
}); |
|
}); |
|
} else { |
|
Swal({ |
|
title: "Sei sicuro di voler procedere?", |
|
text: "Stai per creare un nuovo archivio da inviare in conservazione.", |
|
type: "warning", |
|
showCancelButton: true, |
|
confirmButtonColor: 'var(--success)', |
|
cancelButtonColor: 'var(--danger)', |
|
confirmButtonText: 'Si', |
|
cancelButtonText: 'No', |
|
showCloseButton: false, |
|
}).then((result) => { |
|
if(result.value) { |
|
$.ajax({ |
|
type: "POST", |
|
url: 'fascicolo.php', |
|
data: {codice: codice, full: false, download: false}, |
|
dataType: "script", |
|
beforeSend: function () { |
|
$('#wait').fadeIn(); |
|
} |
|
}).done(function(script) { |
|
script; |
|
}).fail(function() { |
|
swal(js_dict["error-retry"]); |
|
}).always(function() { |
|
$('#wait').fadeOut(); |
|
}); |
|
} |
|
}); |
|
} |
|
} |
|
</script> |
|
<? endif; ?> |
|
</div> |
|
<div class="collapse col-12 mt-3" id="filters"> |
|
<form class="w-100" id="table-filters"> |
|
<div class="card"> |
|
<div class="card-body"> |
|
<div class="row"> |
|
<div class="col-sm-2"> |
|
<div class="form-group"> |
|
<label for="modulo" class="small font-weight-bold"><?= __("Modulo") ?>:</label> |
|
<select class="form-control" name="modulo" id="modulo" aria-describedby="help-modulo"> |
|
<option value=""><?= __("Seleziona..") ?></option> |
|
<option value="gare"><?= __("Gare") ?></option> |
|
<? if($_SESSION["ente"]->hasModulo("concorsi")) { ?><option value="concorsi" disabled><?= __("Concorsi") ?></option><? } ?> |
|
<? if($_SESSION["ente"]->hasModulo("pcp")) { ?><option value="pcp" disabled><?= __("PCP") ?></option><? } ?> |
|
</select> |
|
<small id="help-modulo" class="form-text text-muted"><?= __("Modulo di riferimento") ?></small> |
|
</div> |
|
</div> |
|
<div class="col-sm-2"> |
|
<div class="form-group"> |
|
<label for="stato" class="small font-weight-bold"><?= __("Stato") ?>:</label> |
|
<select class="form-control" name="stato" id="stato"> |
|
<option value=""><?= __("Seleziona..") ?></option> |
|
<? |
|
$stati = file_get_contents('stati.json'); |
|
$stati = json_decode($stati, TRUE); |
|
foreach($stati as $valore => $stato) { |
|
?><option value="<?= $valore ?>"><?= __($stato["titolo"]) ?></option><? |
|
} |
|
?> |
|
</select> |
|
</div> |
|
</div> |
|
<div class="col"> |
|
<div class="form-group"> |
|
<label for="elemento" class="small font-weight-bold"><?= __("Elemento") ?>:</label> |
|
<input type="text" class="form-control" name="elemento" id="elemento" aria-describedby="help-elemento" placeholder="<?= __("Elemento") ?>"> |
|
<small id="help-elemento" class="form-text text-muted">Ad es.: <?= __("Oggetto, CIG, CUP, ...") ?></small> |
|
</div> |
|
</div> |
|
</div> |
|
<div class="row"> |
|
<div class="col-12"> |
|
<button type="button" onclick="table.ajax.reload(null, false)" name="filter" id="filter" class="btn btn-warning btn-lg btn-block"><i class="fas fa-filter mr-2"></i><?= __("Applica Filtri") ?></button> |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
<? if(isset($reference)) : ?><input type="hidden" name="riferimento" value="<?= $reference ?>"><? endif; ?> |
|
<? if(! empty($hideFilters)) : ?><input type="hidden" name="modulo" value="<?= $radice ?>"><? endif; ?> |
|
</form> |
|
</div> |
|
</div> |
|
<div class="card mt-3"> |
|
<style> |
|
#table-paginate ul.pagination { |
|
margin-bottom: 0 !important; |
|
float: right; |
|
} |
|
.table td { |
|
padding: 0.75rem !important; |
|
vertical-align: middle; |
|
} |
|
</style> |
|
<table class="table table-striped table-hover w-100" style="margin: 0px !important" id="tab-data" width="100%"> |
|
<thead> |
|
<tr> |
|
<th class="fit-width"></th> |
|
<th class="fit-width">#</th> |
|
<th class="fit-width">Modulo</th> |
|
<th>Elemento</th> |
|
<th class="fit-width">Schedulazione</th> |
|
<th class="fit-width text-center"><i class="fas fa-cogs"></i></th> |
|
</tr> |
|
</thead> |
|
<tbody></tbody> |
|
</table> |
|
<div class="card-footer"> |
|
<div class="row d-flex align-items-center"> |
|
<div id="table-info" class="col-4"></div> |
|
<div id="table-paginate" class="col-8"></div> |
|
</div> |
|
</div> |
|
</div> |
|
<script> |
|
var table = $("#tab-data").DataTable({ |
|
"processing": true, |
|
"serverSide": true, |
|
"searching": false, |
|
"pageLength": 100, |
|
"lengthChange": false, |
|
"autoWidth": false, |
|
"language": { |
|
"url": "/dictionary/datatables/<?= $_SESSION["language"] ?>.lang" |
|
}, |
|
"fnDrawCallback": function(oSettings) { |
|
$('#tab-data_info').detach().appendTo('#table-info'); |
|
$('#tab-data_paginate').detach().appendTo('#table-paginate'); |
|
$('[data-toggle="tooltip"]').tooltip(); |
|
}, |
|
"ajax": { |
|
"url": "/backend/conservazione/table.php", |
|
"method": "POST", |
|
"data": function (d) { |
|
d.filters = $("#table-filters").serialize(), |
|
d.token = "<?= $tokenEsportazione ?>"; |
|
} |
|
}, |
|
"columns": [ |
|
{ "orderable": false, "class": 'fit-width' }, |
|
{ "orderable": true, "class": 'fit-width' }, |
|
{ "orderable": true, "class": 'fit-width' }, |
|
{ "orderable": false, "class": 'fit-width w-100' }, |
|
{ "orderable": true, "class": 'fit-width' }, |
|
{ "orderable": false, "class": 'fit-width text-right' } |
|
] |
|
}); |
|
</script> |
|
<? |
|
} |
|
?> |
|
|