gestione gare pubbliche
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.
 
 
 
 
 

203 righe
6.9 KiB

<?
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php";
include_once($configPath);
$error = true;
if( !empty($_SESSION["utente"]) && $_SESSION["utente"]->permission('rda')){
$error = false;
$rda = rda::getList(['codice_stato' => 10]);
if(!empty($rda)){
?>
<div class="card">
<div class="card-body">
<table class="table table-striped table-hover" id="tab-rda" width="100%" >
<thead>
<tr>
<th width="100"></th>
<th width="100"></th>
<th width="10"><?= __("ID") ?></th>
<th><?= __("Oggetto") ?></th>
<th width="100"><?= __("scadenza") ?></th>
<th width="160"><?= __("Richiedente") ?></th>
<th width="100"><?= __("Beneficiario") ?></th>
<th width="10"></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<div id="container-added-rda" class="card my-2 d-none">
<div class="card-body">
<div class="table-responsive">
<h4 id="table-title"><?= __('Rda selezionate') ?></h4>
<table class="table table-striped table-hover" id="tab-data-added-rda" width="100%">
<thead>
<tr>
<th width="20"></th>
<th width="100"></th>
<th width="10"><?= __("ID") ?></th>
<th><?= __("Oggetto") ?></th>
<th width="100"><?= __("scadenza") ?></th>
<th width="160"><?= __("Richiedente") ?></th>
<th width="100"><?= __("Beneficiario") ?></th>
<th width="10"></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<div class="card-footer">
<div class="col-12 text-right">
<button class="btn btn-primary btn-next" >
<?= __('Avanti') ?>
</button>
</div>
</div>
</div>
<script>
var tablerda = $("#tab-rda").DataTable({
"processing": true,
"serverSide": true,
"ajax": {
"url": "/backend/gare/rda/table.php",
"data": function (d) {
d.keyword = $('#keyword').val();
d.codice = $('.check-rda').map(function(i, e) {
console.log(i,e);
if (e.value != undefined && e.value != '') {
return e.value
}
}).toArray();
}
},
"order": [[2,'desc']],
"lengthMenu": [[5, 25, 50, -1], [10, 25, 50, '<?= __("tutti") ?>']],
"columns": [
{ "class": "text-right","orderable": false },
{ "class": "text-right","orderable": false },
{ "class": "text-right","orderable": false },
{ "class": "text-right","orderable": true },
{ "class": "text-right", "orderable": false },
{ "class": "text-right", "orderable": false },
{ "class": "text-right", "orderable": false },
{ "class": "text-right", "orderable": false },
],
"drawCallback": function(settings, json){
$('.add-rda').on('click', function(){
$('#container-added-rda').removeClass('d-none')
var params = $(this).data("params");
$('#tab-data-added-rda tbody').append(
$('<tr class="rda-'+params.codice+'">')
.append('<td><div id="flag_'+params.codice+'" class="fa fa-circle" style="color:'+params.colore+'"></div></td>')
.append($('<td>').append(params.titolo))
.append($('<td>').append(params.id))
.append($('<td class="font-weight-bold">').append(params.oggetto))
.append($('<td>').append(params.scadenza))
.append($('<td>').append(params.richiedente))
.append($('<td>').append(params.beneficiario))
.append("<td><button class='btn btn-sm btn-danger remove-rda'><i class='fas fa-minus'></i> <input type='hidden' class='check-rda' name='rda["+params.codice+"]' value='"+params.codice+"'></button></td>")
)
$("#tab-rda").DataTable().ajax.reload()
$('.remove-rda').on('click', function(){
$(this).parent().parent().remove();
var checkrda = $('.check-rda').map(function(i, e) {
if (e.value != undefined && e.value != '') {
return e.value
}
}).toArray();
if(checkrda.length == 0){
$('#container-added-rda').addClass('d-none')
}
$("#tab-rda").DataTable().ajax.reload()
})
})
}
});
$(function(){
$('.btn-next').on('click', function(){
var checkrda = $('.check-rda').map(function(i, e) {
if (e.value != undefined && e.value != '') {
return e.value
}
}).toArray()
if(checkrda.length > 0 ){
checkrda = JSON.stringify(checkrda)
url = "/backend/gare/edit.php?codice=0&codici_rda='" + btoa(checkrda);
document.location.href = url;
// showModalWithURL('/backend/gare/edit.php?codice=0&codice_rda=' + btoa(checkrda), null, null, true);
}else{
swal({title:js_dict.error,html:js_dict["error-generic"],type:"error"}).then(function() { window.location.reload(); });
}
})
// evento per i record salvati in sessione
$('.remove-rda').on('click', function(){
$(this).parent().parent().remove();
var checkrda = $('.check-rda').map(function(i, e) {
if (e.value != undefined && e.value != '') {
return e.value
}
}).toArray();
if(checkrda.length == 0){
$('#container-added-articoli').addClass('d-none')
}
$("#tab-data-add-articoli").DataTable().ajax.reload()
})
})
</script>
<?
}else{
alertManager::printWarningBox(__('Nessun Risultato'));
}
}
if($error){
header('HTTP/1.0 403 Forbidden');
die();
}
?>