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.
494 righe
19 KiB
494 righe
19 KiB
<? |
|
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php"; |
|
include_once($configPath); |
|
|
|
|
|
if (!empty($_SESSION["utente"]) && $_SESSION["utente"]->permission($radice) && $_SESSION['utente']->permission($radice, $_GET['codice'], 'classe-documentale') && !empty($_GET['codice'])) { |
|
$codice = $_GET['codice']; |
|
$contratto = stipula::init($_GET["codice"]); |
|
|
|
if(!empty($contratto->info['codice'])){ |
|
|
|
$richieste = RichiestaDocumentale::getRichieste(['codice_contratto' => $contratto->info['codice'], 'bozza' => 'S']); |
|
|
|
if(!empty($richieste)){ |
|
|
|
$tmpContraenti = array_values(array_unique(pluck('codice_oe', $richieste))); |
|
|
|
foreach ($tmpContraenti as $tmpContraente) { |
|
$contraenti[] = array_values($contratto->getContraenti("oe", null, $tmpContraente))[0]; |
|
} |
|
|
|
?> |
|
<div class="navbar d-none"> |
|
<div class="navbar-inner"> |
|
<ul class="nav nav-tabs nav-justified"> |
|
<li class=" <?php if(count($contraenti) > 1) echo 'active ' ?>"> |
|
<a href="#step1" data-toggle="tab" data-step="1"></a> |
|
</li> |
|
<li class=" <?php if(count($contraenti) == 1) echo 'active' ?>"> |
|
<a href="#step2" data-toggle="tab" data-step="2"></a> |
|
</li> |
|
<li> |
|
<a href="#step3" data-toggle="tab" data-step="3"></a> |
|
</li> |
|
</ul> |
|
</div> |
|
</div> |
|
|
|
<form rel="validate" method="post" action="/backend/contratti/documentale/gestione_bozza/save.php" id="richieste-bozza-classe-documentale"> |
|
<input id="codice_contratto" type="hidden" name="codice_contratto" value="<?= $contratto->info['codice'] ?>"> |
|
|
|
<div class="tab-content"> |
|
|
|
<!-- Tab 1 --> |
|
|
|
<div class="tab-pane fade <?php if(count($contraenti) > 1) echo 'active show' ?> " id="step1"> |
|
<div id="alert-box" class="alert alert-danger d-none" role="alert"> |
|
|
|
</div> |
|
<div class="col-12"> |
|
<label><?= __('Seleziona Operatori Economici*') ?></label> |
|
<div id="step1-box mb-5"> |
|
|
|
<? if (!empty($contraenti)) { ?> |
|
<table class="table table-striped table-hover px-2" id="tab-data-contraenti" > |
|
<thead> |
|
<tr> |
|
<th><?= __("Operatore Economico") ?></th> |
|
<th><?= __("C.F") ?></th> |
|
<th width="200"></th> |
|
</tr> |
|
</thead> |
|
<tbody> |
|
<? foreach ($contraenti as $key => $contraente) { ?> |
|
<tr> |
|
<td><?= $contraente['denominazione'] ?></td> |
|
<td><?= $contraente['cf'] ?></td> |
|
<td class="text-right pr-4"> |
|
<? if($contraente['codice_operatore'] == 0){ ?> |
|
<span class="text-warning "><?= __('Operatore Non registrato') ?></span> |
|
<? }else{ ?> |
|
<span class="w-100"> |
|
<input class="form-check-input big-checkbox oe_check" type="radio" name="codice_oe" id="oe-<?= $contraente['codice_operatore']?>" value="<?= $contraente['codice_operatore'] ?>"> |
|
</span> |
|
<? } ?> |
|
</td> |
|
</tr> |
|
<? } ?> |
|
</tbody> |
|
</table> |
|
|
|
<? }else{ ?> |
|
<?= alertManager::printWarningBox(__("Nessun Operatore Economico Associato al contratto"));?> |
|
<? } ?> |
|
</div> |
|
</div> |
|
|
|
</div> |
|
|
|
<!-- Tab 2 --> |
|
<div class="tab-pane fade <?php if(count($contraenti) == 1) echo 'active show' ?> " id="step2"> |
|
<div class="col-12"> |
|
<h5><?= __('Seleziona Richiesta') ?>:</h5> |
|
<div class="d-flex justify-content-between pt-2"> |
|
<div> |
|
<button class="select btn btn-outline-secondary mr-1" type="button"><?= __('Seleziona Tutti') ?></button> |
|
<button class="deselect btn btn-outline-secondary ml-1" type="button"><?= __('Deseleziona Tutti') ?></button> |
|
</div> |
|
|
|
<div> |
|
<div class="input-group mb-3"> |
|
<div class="input-group-prepend"> |
|
<span class="input-group-text " id="search-addon1"> |
|
<span class="fa fa-search"></span> |
|
</span> |
|
</div> |
|
<input type="text" class="form-control input-sm" aria-describedby="search-addon1" onkeyup="filtra($(this).val(),'#tab-data-add','tr');" placeholder="<?= __('Cerca') ?>"> |
|
</div> |
|
</div> |
|
</div> |
|
<div id="step2-box"> |
|
<table class="table table-striped table-hover" id="tab-data-add" width="100%"> |
|
<thead> |
|
<tr> |
|
<th><?= __("Titolo") ?></th> |
|
<th><?= __('Seleziona') ?>*</th> |
|
<th><?= __('Bloccante') ?></th> |
|
<th><?= __('Invia Comunicazione') ?></th> |
|
</tr> |
|
</thead> |
|
<tbody > |
|
</tbody> |
|
</table> |
|
</div> |
|
</div> |
|
</div> |
|
|
|
|
|
<!-- Tab 3 --> |
|
<div class="tab-pane fade" id="step3"> |
|
|
|
<div class="col-12"> |
|
<h5><?= __('Riepilogo Descrizione delle Richieste*') ?></h5> |
|
<hr> |
|
<div id="step3-box"> |
|
<div class="mt-3"> |
|
<div class="form-group"> |
|
<label for="descrizione"> |
|
<?= __('Descrizione') ?> |
|
</label> |
|
<textarea class="ckeditor_full" id="descrizione" name="descrizione" title="<?= __('descrizione') ?>" rel="S;2;0;A"> |
|
|
|
</textarea> |
|
</div> |
|
</div> |
|
<div class="row"> |
|
<div class="col-12"> |
|
<div class='card my-3'> |
|
<div class="card-header"> |
|
<h5 class="mb-0 font-weight-bold d-block " data-target="#otherFiles"> |
|
<?= __('Allega ulteriori file alle Richieste delle Classi Documentali') ?> |
|
</h5> |
|
</div> |
|
<div class='card-body' id="otherFiles" style="display:none"> |
|
<div class="row"> |
|
<div class="col-12 " id="box-files"> |
|
|
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
|
|
|
|
</div> |
|
</form> |
|
|
|
<div class="modal-footer d-flex justify-content-between"> |
|
<button type="button" class="btn btn-default back"><?= __('Indietro') ?></button> |
|
<button type="button" class="btn btn-default stop" onclick="location.reload()"><?= __('Annulla') ?></button> |
|
<div class="right-footer flex-grow-1 text-right"> |
|
<button type="button" class="btn btn-primary next" disabled><?= __('Avanti') ?></button> |
|
|
|
<div> |
|
<button id="submit" type="button" class="btn btn-info"><?= __('Invia') ?></button> |
|
</div> |
|
</div> |
|
</div> |
|
|
|
<style> |
|
.w-30{ |
|
width: 30%; |
|
} |
|
</style> |
|
|
|
<script type="text/javascript"> |
|
|
|
$(function(){ |
|
|
|
// var firstTab = $(".tab-pane:nth-last-child(1)").attr("id"); |
|
// var secondTab = $(".tab-pane:nth-last-child(2)").attr("id"); |
|
var prevTab = $(".tab-pane.active").prev().attr("id"); |
|
var nextTab = $(".tab-pane.active").next().attr("id"); |
|
var lastTab = $(".tab-pane:nth-last-child(3)").attr("id"); |
|
var table = $('').DataTable(); |
|
|
|
$('.back, #submit, .stop').css('display', 'none'); |
|
|
|
$(".next").click(function() { |
|
|
|
var nextId = $(".tab-pane.active").next().attr("id"); |
|
|
|
$('[href="#' + nextId + '"]').tab("show"); |
|
$(".back").css("display", "unset"); |
|
// $('#submit').css('display', 'unset').attr('disabled', true) |
|
if (nextId == lastTab) { |
|
$(".next").hide(); |
|
} |
|
|
|
}); |
|
|
|
$(".back").click(function() { |
|
$('#alert-box').addClass('d-none') |
|
var backId = $(".tab-pane.active").prev().attr("id"); |
|
|
|
$('[href="#' + backId + '"]').tab("show"); |
|
$(".next, #submit").css("display", "unset"); |
|
|
|
if (backId === "step1") { |
|
$(".back, #submit").css("display", "none"); |
|
$("#tab-data-add").DataTable().destroy() |
|
} |
|
|
|
if (backId === "step2") { |
|
$(".back, #submit").css("display", "none"); |
|
} |
|
|
|
}); |
|
|
|
// Modal 1 |
|
$('a[href="#step1"][data-toggle="tab"]').on('shown.bs.tab', function (e) { |
|
if($('input.oe_check').is(':checked')){ |
|
$('.next').prop("disabled", false) |
|
} |
|
}) |
|
|
|
|
|
$('.oe_check').click(function() { |
|
if ($('input.oe_check').is(':checked')) { |
|
$('.next').prop("disabled", false) |
|
}else{ |
|
$('.next').prop("disabled", true) |
|
} |
|
}); |
|
|
|
|
|
// Modal 2 |
|
if($('#step2').hasClass('show')){ |
|
tabstep2(); |
|
} |
|
|
|
$('a[href="#step2"][data-toggle="tab"]').on('shown.bs.tab', function (e) { |
|
if(!$('input.richiesta').is(':checked')){ |
|
$('.next').prop("disabled", true) |
|
} |
|
tabstep2(); |
|
}) |
|
|
|
|
|
// Modal 3 |
|
|
|
$('a[href="#step3"][data-toggle="tab"]').on('shown.bs.tab', function (e) { |
|
|
|
$('.next').css("display", "none") |
|
$('#submit').css("display", "unset"); |
|
|
|
var richieste = $('.richiesta:checked').map(function(i, e) { |
|
if (e.value != undefined && e.value != '') { |
|
return e.value |
|
} |
|
}).toArray() |
|
|
|
tabstep3(richieste) |
|
}) |
|
|
|
|
|
|
|
|
|
function format(d) { |
|
return ( |
|
'<dl>' + |
|
'<dt class="small">Descrizione:</dt>' + |
|
'<dd class="small">' + d[4] + '</dd>' + |
|
'<dt> <hr> </dt>' + |
|
'</dl>' |
|
); |
|
} |
|
|
|
function tabstep2() { |
|
|
|
if(<?= count($contraenti)?> == 1){ |
|
var codice_oe = <?= $contraenti[0]['codice_operatore'] ?>; |
|
$('<input>').attr({ |
|
type: 'hidden', |
|
name: 'codice_oe', |
|
value: codice_oe |
|
}).appendTo('#richieste-bozza-classe-documentale'); |
|
}else{ |
|
var codice_oe = $('.oe_check:checked').val(); |
|
} |
|
|
|
var table = $("#tab-data-add").DataTable({ |
|
"processing": true, |
|
"serverSide": true, |
|
"paging": false, |
|
"searching": false, |
|
"retrieve": true, |
|
"bAutoWidth": false, |
|
"pagingType": 'full_numbers', |
|
"language": { |
|
"url": "/dictionary/datatables/<?= $_SESSION["language"] ?>.lang" |
|
}, |
|
"ajax": { |
|
"url": "gestione_bozza/table.php", |
|
"data": function (d) { |
|
d.codice_contratto = <?= $contratto->info['codice'] ?>; |
|
d.codice_oe = codice_oe |
|
} |
|
}, |
|
"order": [[0,'ASC']], |
|
"lengthMenu": [[10, 25, 50, -1], [10, 25, 50, '<?= __("tutti") ?>']], |
|
"columns": [ |
|
{ |
|
orderable: false, |
|
width: "57%", |
|
className: "" |
|
}, |
|
{ |
|
orderable: false, |
|
width: "10%", |
|
className: " d-sm-table-cell d-md-table-cell d-lg-table-cel text-center align-middle" |
|
}, |
|
{ |
|
orderable: false, |
|
width: "10%", |
|
className: " d-sm-table-cell d-md-table-cell d-lg-table-cel text-center align-middle" |
|
}, |
|
{ |
|
orderable: false, |
|
width: "18%", |
|
className: " d-sm-table-cell d-md-table-cell d-lg-table-cel text-center align-middle" |
|
} |
|
], |
|
"drawCallback": function(settings, json) { |
|
|
|
$('.bloccante').click(function(){ |
|
|
|
var codice = $(this).data('codice'); |
|
|
|
if($('input.bloccante').is(':checked')){ |
|
$(`.codice-richiesta-${codice}`).prop('checked', true) |
|
} |
|
|
|
if($('input.richiesta').is(':checked')){ |
|
$('.next').prop("disabled", false) |
|
}else{ |
|
$('.next').prop("disabled", true) |
|
} |
|
|
|
if(!$(`.codice-bloccante-${codice}`).is(':checked') && !$(`.codice-richiesta-${codice}`).is(':checked')){ |
|
$(`.codice-invio-comunicazione-${codice}`).prop('checked', false) |
|
} |
|
}) |
|
|
|
$('.select, .deselect') .on('click', function(){ |
|
if($(this).hasClass('select')){ |
|
$("input.richiesta").each(function() { |
|
this.checked=true; |
|
}); |
|
}else{ |
|
$("input.richiesta").each(function() { |
|
this.checked=false; |
|
}); |
|
} |
|
|
|
if($('input.richiesta').is(':checked')){ |
|
$('.next').prop("disabled", false) |
|
}else{ |
|
$('.next').prop("disabled", true) |
|
} |
|
}) |
|
|
|
$('.richiesta').click(function(){ |
|
|
|
var codice = $(this).data('codice'); |
|
|
|
if(!$(`input.codice-richiesta-${codice}`).is(':checked')){ |
|
$(`.codice-bloccante-${codice}`).prop('checked', false) |
|
} |
|
|
|
if($('input.richiesta').is(':checked')){ |
|
$('.next').prop("disabled", false) |
|
}else{ |
|
$('.next').prop("disabled", true) |
|
} |
|
|
|
if(!$(`.codice-bloccante-${codice}`).is(':checked') && !$(`.codice-richiesta-${codice}`).is(':checked')){ |
|
$(`.codice-invio-comunicazione-${codice}`).prop('checked', false) |
|
} |
|
}) |
|
|
|
this.on('click', 'a.dt-control', function (e) { |
|
let tr = e.target.closest('tr'); |
|
let row = table.row(tr); |
|
|
|
if (row.child.isShown()) { |
|
row.child.hide(); |
|
}else { |
|
row.child(format(row.data())).show(); |
|
} |
|
}); |
|
} |
|
}) |
|
|
|
|
|
|
|
|
|
} |
|
|
|
function tabstep3(richieste){ |
|
|
|
// parte dedicata alla descrizione |
|
$.ajax({ |
|
type: "GET", |
|
url: "gestione_bozza/editDescription.php", |
|
data: { |
|
richieste |
|
}, |
|
dataType: "json", |
|
beforeSend: function(e) { |
|
$('#wait').fadeIn(); |
|
} |
|
}) |
|
.done(function(response) { |
|
$('#descrizione').val(response) |
|
}) |
|
.fail(function(response) { |
|
swal({ |
|
title: js_dict.attenzione, |
|
text: js_dict["error-generic"], |
|
type: "error" |
|
}); |
|
}) |
|
|
|
|
|
|
|
// parte degli allegati |
|
|
|
$.ajax({ |
|
type: "GET", |
|
url: "gestione_bozza/editFileUpload.php", |
|
data: { |
|
richieste: richieste ?? [] |
|
}, |
|
dataType: "json", |
|
beforeSend: function(e) { |
|
$('#wait').fadeIn(); |
|
} |
|
}) |
|
.fail(function(response) { |
|
swal({ |
|
title: js_dict.attenzione, |
|
text: js_dict["error-generic"], |
|
type: "error" |
|
}); |
|
}) |
|
.done(function(response) { |
|
$('#box-files').html(response) |
|
}) |
|
} |
|
|
|
$('#submit').on('click', function(){ |
|
if($('input.richiesta').is(':checked')){ |
|
$('#richieste-bozza-classe-documentale').submit(); |
|
}else{ |
|
$('#alert-box').removeClass('d-none').html("<?= __('Per proseguire, bisogna selezionare almeno una richiesta') ?>") |
|
} |
|
}) |
|
}) |
|
</script> |
|
|
|
|
|
<? |
|
} |
|
} |
|
|
|
} |
|
|
|
|
|
?>
|