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.
367 righe
18 KiB
367 righe
18 KiB
<!doctype html> |
|
<?php |
|
include '../../lib/api.php'; |
|
|
|
if (!Utils::isStatoSportelloPreparazione()) { |
|
Utils::RedirectTo(HTTP_PRIVATE_SECTION . 'info.php'); |
|
} |
|
|
|
$state = $LoggedAccount->checkStateEditableFieldPage(); |
|
|
|
//Utils::print_array($state); |
|
//exit(); |
|
?> |
|
<html lang="en"> |
|
<? include_once ROOT . 'layout/head.php'; ?> |
|
<body> |
|
<? |
|
include_once ROOT . 'layout/header.php'; |
|
?> |
|
<main role="main"> |
|
<header class="masthead masthead-page"> |
|
<div class="container-fluid"> |
|
<div class="row "> |
|
<div class="col-lg-12"> |
|
<h6><?= TEXT_ASSESSORATO_BANDO ?></h6> |
|
<h6><?= TEXT_DESCRIZIONE_BANDO ?></h6> |
|
<? |
|
$txtBenvenuto = ($LoggedAccount->Anagrafica->SESSO == "M" ? "Benvenuto Sig." : "Benvenuta Sig.ra"); |
|
$contenuto = $txtBenvenuto . ' <b>' . $LoggedAccount->Anagrafica->COGNOME . ' ' . $LoggedAccount->Anagrafica->NOME . '</b>'; |
|
$nucleo = $LoggedAccount->loadNucleoFamiliare(); |
|
?> |
|
<h3 class="mb-2"><?= $contenuto ?></h3> |
|
</div> |
|
</div> |
|
</div> |
|
<? |
|
include_once ROOT . 'layout/header_svg.php'; |
|
?> |
|
</header> |
|
<div class="container-fluid"> |
|
<? include_once ROOT . 'layout/loader.php'; ?> |
|
<div class="row"> |
|
<div class="col-sm-12"> |
|
<nav aria-label="breadcrumb"> |
|
<ol class="breadcrumb"> |
|
<li class="breadcrumb-item"><a href="javascript:goBack()">Pagina iniziale</a></li> |
|
<li class="breadcrumb-item active" aria-current="page">Sezione nucleo familiare del richiedente. </li> |
|
</ol> |
|
</nav> |
|
</div> |
|
</div> |
|
<div class="row"> |
|
<div class="col-sm-12"> |
|
<h3>Sezione nucleo familiare del richiedente.</h3> |
|
</div> |
|
</div> |
|
<hr> |
|
<div class="row"> |
|
<div class="col-sm-12"> |
|
|
|
<div class="card"> |
|
<div class="card-header bg-primary text-white"> |
|
<div class="row"> |
|
<div class="col-lg-2"> |
|
<i class="fas fa-users"></i> Componenti |
|
</div> |
|
<div class="col-lg-10 text-right"> |
|
<? if ($state['stato'] === 1) { ?> |
|
<button type="button" id="confermanucleo" class="btn btn-sm btn-success invisible" onclick="confirmNucleo()"><i class="fas fa-check-square"></i> Conferma Composizione Nucleo Familiare</button> |
|
<button type="button" onclick="openModal()" class="btn btn-sm btn-success"><i class="fas fa-plus"></i> Aggiungi Componente Nucleo Familiare</button> |
|
<? } ?> |
|
</div> |
|
</div> |
|
</div> |
|
<div class="card-body"> |
|
<b class="infoPresentazione"> |
|
Indicare i componenti del proprio stato di famiglia, residenti nell'anno <strong><?= ANNO_RIFERIMENTO ?></strong> negli appartamenti per i quali si chiede il contributo.<br> |
|
Nella specifica dei componenti <strong><u>non sono da inserire i nati dopo il <?= ANNO_RIFERIMENTO ?></u></strong>. |
|
</b> |
|
<table id="dt_nucleo_familiare" class="table table-striped table-bordered" style="width:100%"> |
|
<thead> |
|
<tr> |
|
<th>#</th> |
|
<th>Cognome</th> |
|
<th>Nome</th> |
|
<th>Codice Fiscale</th> |
|
<th>Comune di Nascita</th> |
|
<th>Data di Nascita</th> |
|
<th>Rapporto di Parentela</th> |
|
<th>Gestione</th> |
|
</tr> |
|
</thead> |
|
</table> |
|
<br> |
|
</div> |
|
<div class="card-footer text-right"> |
|
<button type="button" id="btn-dashboard" class="btn btn-md btn-primary" onclick="goBack()"><i class="fas fa-tachometer-alt"></i> Torna alla pagina iniziale</button> |
|
</div> |
|
|
|
</div> |
|
</div> |
|
</div> |
|
|
|
|
|
|
|
<div class="modal fade" id="componenteModal" tabindex="-1" role="dialog" aria-hidden="true"> |
|
<div class="modal-dialog" role="document" style="max-width: 70%;" > |
|
<div class="modal-content"> |
|
<div class="modal-header"> |
|
<h5 class="modal-title" id="exampleModalLabel">Registrazione Componente Nucleo Familiare </h5> |
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
|
<span aria-hidden="true">×</span> |
|
</button> |
|
</div> |
|
<form id="form-add-componente" action="javascript:saveComponente()" > |
|
<div class="modal-body"> |
|
<input type="hidden" name="ID" id="ID_COMPONENTE"> |
|
<div class="form-group row"> |
|
<label for="Cognome" class="col-sm-4 col-form-label">Cognome:<span class="text-danger">* </span></label> |
|
<div class="col-sm-8"> |
|
<input type="text" required autocomplete="new-password" maxlength="150" class="form-control" id="COGNOME" name="COGNOME"> |
|
</div> |
|
</div> |
|
<div class="form-group row"> |
|
<label for="Nome" class="col-sm-4 col-form-label">Nome:<span class="text-danger">* </span></label> |
|
<div class="col-sm-8"> |
|
<input type="text" autocomplete="new-password" maxlength="150" required class="form-control" id="NOME" name="NOME"> |
|
</div> |
|
</div> |
|
<div class="form-group row"> |
|
<label for="CF" class="col-sm-4 col-form-label">Codice Fiscale:<span class="text-danger">* </span></label> |
|
<div class="col-sm-8"> |
|
<input type="text" autocomplete="new-password" required minlength="16" maxlength="16" class="form-control" id="CODICE_FISCALE" name="CODICE_FISCALE"> |
|
</div> |
|
</div> |
|
<div class="form-group row"> |
|
<label for="ComuneNascita" class="col-sm-4 col-form-label">Comune di Nascita:<span class="text-danger">* </span></label> |
|
<div class="col-sm-8"> |
|
<select autocomplete="new-password" required="" style="width: 100%" class="form-control" id="COMUNE_NASCITA" name="COMUNE_NASCITA"></select> |
|
</div> |
|
</div> |
|
<div class="form-group row"> |
|
<label for="DataNascita" class="col-sm-4 col-form-label">Data di Nascita:<span class="text-danger">* </span></label> |
|
<div class="col-sm-8"> |
|
<input type="date" required autocomplete="off" max="<?= Date::FormatDate(DATA_NASCITA_MAX_NUCLEO_FAMILIARE, DATE_FORMAT_ISO) ?>" class="form-control" id="DATA_NASCITA" name="DATA_NASCITA"> |
|
</div> |
|
</div> |
|
<div class="form-group row"> |
|
<label for="RapportoParentela" class="col-sm-4 col-form-label">Rapporto di Parentela:<span class="text-danger">* </span></label> |
|
<div class="col-sm-8"> |
|
<select class="form-control" required name="RAPPORTO_PARENTELA" id="RAPPORTO_PARENTELA"> |
|
<option value="">...Seleziona...</option> |
|
<? |
|
foreach ($RAPPORTI_PARENTELA as $key => $value) { |
|
if ($key > RAPPORTO_PARENTELA_DEFAULT) { |
|
?> |
|
<option value="<?= $key ?>"><?= $value; ?></option> |
|
<? |
|
} |
|
} |
|
?> |
|
<? ?> |
|
</select> |
|
</div> |
|
</div> |
|
</div> |
|
<div class="modal-footer"> |
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Chiudi</button> |
|
<button type="submit" class="btn btn-primary" >Salva</button> |
|
</div> |
|
</form> |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
</main> |
|
<? include_once ROOT . 'layout/footer.php'; ?> |
|
</body> |
|
<script> |
|
//var dt; |
|
$(document).ready(function () { |
|
listNucleo(); |
|
|
|
$("#COMUNE_NASCITA").select2({ |
|
language: "it", |
|
minimumInputLength: 3, |
|
dropdownParent: $('#componenteModal'), |
|
ajax: { |
|
url: WS_CALL + "?module=account&action=searchComune", |
|
type: "post", |
|
dataType: 'json', |
|
delay: 250, |
|
data: function (params) { |
|
return { |
|
searchTerm: params.term // search term |
|
}; |
|
}, |
|
processResults: function (response) { |
|
return { |
|
results: response |
|
}; |
|
}, |
|
cache: true |
|
} |
|
}); |
|
|
|
}); |
|
|
|
function confirmNucleo() { |
|
$('#loader').show(); |
|
postdataClassic(WS_CALL + "?module=nucleo_familiare&action=confirmNucleo", {}, function (response) { |
|
$('#loader').hide(); |
|
var risp = jQuery.parseJSON(response); |
|
if (risp.esito === 1) { |
|
functionSwall('success', 'Conferma completata con successo'); |
|
listNucleo(true); |
|
} else { |
|
functionSwall("error", risp.erroreDescrizione); |
|
} |
|
}); |
|
} |
|
function checkConfermati(json) { |
|
if (json.countConfermati === 1) { |
|
$("#confermanucleo").removeClass('invisible').addClass('visible'); |
|
}else{ |
|
$("#confermanucleo").removeClass('visible').addClass('invisible'); |
|
} |
|
} |
|
function saveComponente() { |
|
$('#loader').show(); |
|
var form = document.getElementById('form-add-componente'); |
|
var formInvio = new FormData(form); |
|
formInvio.append('module', 'nucleo_familiare'); |
|
formInvio.append('action', 'addComponente'); |
|
postdata(WS_CALL, formInvio, function (response) { |
|
var risp = jQuery.parseJSON(response); |
|
if (risp.esito === 1) { |
|
$("#componenteModal").modal('toggle'); |
|
$('#loader').hide(); |
|
functionSwall('success', 'Operazione Completata con Successo'); |
|
|
|
listNucleo(true); |
|
} else { |
|
$('#loader').hide(); |
|
functionSwall('error', risp.erroreDescrizione, ""); |
|
} |
|
}); |
|
} |
|
|
|
|
|
function editComponente(ricevo) { |
|
document.getElementById("form-add-componente").reset(); |
|
var ricreo = jQuery.parseJSON(b64DecodeUnicode(ricevo)); |
|
$("#ID_COMPONENTE").val(ricreo.ID); |
|
$("#COGNOME").val(ricreo.COGNOME); |
|
$("#NOME").val(ricreo.NOME); |
|
$("#CODICE_FISCALE").val(ricreo.CODICE_FISCALE); |
|
$("#COMUNE_NASCITA").select2("trigger", "select", { |
|
data: { |
|
id: ricreo.COMUNE_NASCITA, |
|
text: ricreo.COMUNE_NASCITA, |
|
} |
|
}); |
|
$("#DATA_NASCITA").val(ricreo.DT_ENG); |
|
$("#RAPPORTO_PARENTELA").val(ricreo.RAPPORTO_PARENTELA); |
|
$("#componenteModal").modal('toggle'); |
|
} |
|
function deleteComponente(ricevo) { |
|
var object = { |
|
module: 'nucleo_familiare', |
|
action: 'deleteComponente', |
|
id: ricevo |
|
} |
|
Swal.fire({ |
|
title: "Attenzione", |
|
text: "Sei sicuro di voler proseguire con l'operazione selezionata?", |
|
icon: 'warning', |
|
showCancelButton: true, |
|
confirmButtonColor: '#3085d6', |
|
cancelButtonColor: '#d33', |
|
confirmButtonText: 'OK' |
|
}).then((result) => { |
|
if (result.value) { |
|
$('#loader').show(); |
|
postdataClassic(WS_CALL, object, function (response) { |
|
var risp = jQuery.parseJSON(response); |
|
if (risp.esito === 1) { |
|
$('#loader').hide(); |
|
functionSwall('success', 'Operazione Completata con Successo'); |
|
|
|
listNucleo(true); |
|
} else { |
|
$('#loader').hide(); |
|
functionSwall('error', risp.erroreDescrizione, ""); |
|
} |
|
}); |
|
} |
|
}); |
|
} |
|
|
|
function openModal() { |
|
document.getElementById("form-add-componente").reset(); |
|
$("#form-add-componente input:hidden").val(''); |
|
$("#COMUNE_NASCITA").select2("trigger", "select", { |
|
data: { |
|
id: "", |
|
text: "", |
|
} |
|
}); |
|
$("#ID_COMPONENTE").val(""); |
|
$("#componenteModal").modal('toggle'); |
|
} |
|
|
|
// function reloadTable() { |
|
// dt.DataTable().ajax.reload(function (json) { |
|
// checkConfermati(json.countConfermati); |
|
// }); |
|
// } |
|
|
|
|
|
function goBack() { |
|
$.redirect(HTTP_PRIVATE_SECTION + "dashboard.php"); |
|
} |
|
|
|
function listNucleo(reload){ |
|
var dt = $("#dt_nucleo_familiare"); |
|
if (!reload) { |
|
|
|
dtNucleo = dt.DataTable({ |
|
'searching': false, |
|
'processing': true, |
|
'serverSide': true, |
|
'paging': false, |
|
"info": false, |
|
'serverMethod': 'post', |
|
"order": [[0, 'ASC']], |
|
'ajax': { |
|
'url': WS_CALL, |
|
'data': { |
|
'module': 'nucleo_familiare', |
|
'action': 'listNucleo' |
|
} |
|
}, |
|
'columns': [ |
|
{data: 'NR', orderable: false}, |
|
{data: 'COGNOME', orderable: false}, |
|
{data: 'NOME', orderable: false}, |
|
{data: 'CODICE_FISCALE', orderable: false}, |
|
{data: 'COMUNE_NASCITA', orderable: false}, |
|
{data: 'DATA_NASCITA', orderable: false}, |
|
{data: 'RAPPORTO_PARENTELA', orderable: false}, |
|
{data: 'OP', orderable: false} |
|
], |
|
'initComplete': function (settings, json) { |
|
checkConfermati(json); |
|
} |
|
}); |
|
}else{ |
|
dt.DataTable().ajax.reload(function (json) { |
|
checkConfermati(json); |
|
}); |
|
} |
|
} |
|
|
|
|
|
</script> |
|
</html>
|