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.
477 righe
17 KiB
477 righe
17 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"]); |
|
$contraenti = $contratto->getContraenti("oe"); |
|
|
|
?> |
|
<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/save.php" id="contratti-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 Classe Documentale*') ?></h5> |
|
<div class="text-right"> |
|
<span class="fa fa-search"></span> <input type="text" onkeyup="filtra($(this).val(),'#tab-data-add','tr');" class="input-sm" placeholder="<?= __("Cerca") ?>"> |
|
</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 mb-5"> |
|
<div class='card my-1'> |
|
<div class="card-header"> |
|
<h5 class="mb-0 font-weight-bold d-block " data-target="#card-summary"> |
|
<?= __('Riepilogo Selezione') ?>: |
|
</h5> |
|
</div> |
|
<div class='card-body p-0' id="card-summary" style="display:none"> |
|
<table class="table table-striped table-hover" > |
|
<thead> |
|
<tr> |
|
<th class="small py-2"><?= __("Informazioni") ?></th> |
|
<th class="small py-2" width="190"><?= __('Selezione') ?></th> |
|
</tr> |
|
</thead> |
|
<tbody id="summary"> |
|
</tbody> |
|
</table> |
|
</div> |
|
</div> |
|
</div> |
|
|
|
<div class="col-12"> |
|
<h5><?= __('Aggiungi descrizione e allega file alle Classi Documentali*') ?></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"> |
|
<?= __('Si invita l\'operatore economico all\'invio dei documenti per la suddetta richiesta') ?> |
|
</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 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="draft" type="button" class="btn btn-secondary"><?= __('Salva Bozza') ?></button> |
|
<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, #draft').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, #draft").css("display", "unset"); |
|
|
|
if (backId === "step1") { |
|
$(".back, #submit, #draft").css("display", "none"); |
|
$("#tab-data-add").DataTable().destroy() |
|
} |
|
|
|
if (backId === "step2") { |
|
$(".back, #submit, #draft").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.classe_documentale').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, #draft').css("display", "unset"); |
|
|
|
var idsClassiDocumentali = $('.classe_documentale:checked').map(function(i, e) { |
|
if (e.value != undefined && e.value != '') { |
|
return e.value |
|
} |
|
}).toArray() |
|
|
|
tabstep3(idsClassiDocumentali) |
|
}) |
|
|
|
|
|
|
|
function tabstep2() { |
|
if(<?= count($contraenti)?> == 1){ |
|
var codice_oe = <?= $contraenti[0]['codice_operatore'] ?>; |
|
$('<input>').attr({ |
|
type: 'hidden', |
|
name: 'codice_oe', |
|
value: codice_oe |
|
}).appendTo('#contratti-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, |
|
"pagingType": 'full_numbers', |
|
"language": { |
|
"url": "/dictionary/datatables/<?= $_SESSION["language"] ?>.lang" |
|
}, |
|
"ajax": { |
|
"url": "tables/tableCheckClassiDocumentali.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" |
|
} |
|
], |
|
"createdRow": function(row, data, dataIndex){ |
|
data.forEach(function(r,i){ |
|
if(r === 'true' && i == 3){ |
|
$('td:eq(1)', row).attr('colspan', 3).addClass('text-center text-success').text('<?=__('Già inviato')?>'); |
|
$('td:eq(2)', row).css('display', 'none').removeClass(); |
|
$('td:eq(3)', row).css('display', 'none').removeClass(); |
|
} |
|
}) |
|
}, |
|
"drawCallback": function(settings, json) { |
|
|
|
$('.bloccante').click(function(){ |
|
|
|
var codice = $(this).data('codice'); |
|
|
|
if($('input.bloccante').is(':checked')){ |
|
$(`.codice-classe_documentale-${codice}`).prop('checked', true) |
|
} |
|
|
|
if($('input.classe_documentale').is(':checked')){ |
|
$('.next').prop("disabled", false) |
|
}else{ |
|
$('.next').prop("disabled", true) |
|
} |
|
|
|
if(!$(`.codice-bloccante-${codice}`).is(':checked') && !$(`.codice-classe_documentale-${codice}`).is(':checked')){ |
|
$(`.codice-invio-comunicazione-${codice}`).prop('checked', false) |
|
} |
|
}) |
|
|
|
$('.classe_documentale').click(function(){ |
|
|
|
var codice = $(this).data('codice'); |
|
|
|
if(!$(`input.codice-classe_documentale-${codice}`).is(':checked')){ |
|
$(`.codice-bloccante-${codice}`).prop('checked', false) |
|
} |
|
|
|
if($('input.classe_documentale').is(':checked')){ |
|
$('.next').prop("disabled", false) |
|
}else{ |
|
$('.next').prop("disabled", true) |
|
} |
|
|
|
if(!$(`.codice-bloccante-${codice}`).is(':checked') && !$(`.codice-classe_documentale-${codice}`).is(':checked')){ |
|
$(`.codice-invio-comunicazione-${codice}`).prop('checked', false) |
|
} |
|
}) |
|
} |
|
}) |
|
} |
|
|
|
function tabstep3(idsClassiDocumentali){ |
|
|
|
var summary = $('.classe_documentale:checked').map(function(i, e) { |
|
if (e.value != undefined && e.value != '') { |
|
return { |
|
'bloccante': $('.bloccante:checked[data-codice="' + e.value +'"]').val(), |
|
'classe_documentale': e.value, |
|
'invio_comunicazione': $('.invio-comunicazione:checked[data-codice="' + e.value +'"]').val(), |
|
} |
|
} |
|
}).toArray() |
|
|
|
|
|
$.ajax({ |
|
type: "GET", |
|
url: "summary.php", |
|
data: { |
|
summary |
|
}, |
|
dataType: "json", |
|
beforeSend: function(e) { |
|
$('#wait').fadeIn(); |
|
} |
|
}) |
|
.done(function(response) { |
|
|
|
$('#summary').html(response) |
|
}) |
|
.fail(function(response) { |
|
swal({ |
|
title: js_dict.attenzione, |
|
text: js_dict["error-generic"], |
|
type: "error" |
|
}); |
|
}) |
|
|
|
|
|
|
|
if(<?= count($contraenti)?> == 1){ |
|
var codice_oe = <?= $contraenti[0]['codice_operatore'] ?>; |
|
$('<input>').attr({ |
|
type: 'hidden', |
|
name: 'codice_oe', |
|
value: codice_oe |
|
}).appendTo('#contratti-classe-documentale'); |
|
}else{ |
|
var codice_oe = $('.oe_check:checked').val(); |
|
} |
|
|
|
|
|
$.ajax({ |
|
type: "GET", |
|
url: "partials/addFileUploader.php", |
|
data: { |
|
idsClassiDocumentali: idsClassiDocumentali ?? [], |
|
codice_oe: codice_oe |
|
}, |
|
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, #draft').on('click', function(){ |
|
if($('input.classe_documentale').is(':checked')){ |
|
value = 'N'; |
|
if(this.id == 'draft'){ |
|
value = 'S'; |
|
} |
|
|
|
$('<input>').attr({ |
|
type: 'hidden', |
|
name: 'bozza', |
|
value: value |
|
}).appendTo('#contratti-classe-documentale'); |
|
$('#contratti-classe-documentale').submit(); |
|
}else{ |
|
$('#alert-box').removeClass('d-none').html("<?= __('Per proseguire, bisogna selezionare un operatore economico e una Classe documentale') ?>") |
|
} |
|
}) |
|
}) |
|
</script> |
|
<? |
|
} |
|
?>
|