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.
339 righe
12 KiB
339 righe
12 KiB
|
|
var counter = 2; |
|
$(document).ready(function () { |
|
var template = $('#sections .section:first').clone(); |
|
var sectionsCount = 1; |
|
$('body').on('click', '.addsection', function () { |
|
sectionsCount++; |
|
counter++; |
|
var section = template.clone(true, true).find(':input').each(function () { |
|
var newId = this.id + sectionsCount; |
|
//console.log(counter); |
|
//update for label |
|
$(this).prev().attr('for', newId); |
|
//update id |
|
this.id = newId; |
|
}).end() |
|
//inject new section |
|
.appendTo('#sections'); |
|
return false; |
|
}); |
|
$('#sections').on('click', '.remove', function () { |
|
if (counter == 2) { |
|
functionSwall('error', "Attenzione non è possibile eliminare questo campo", ""); |
|
} else { |
|
//fade out section |
|
$(this).parent().fadeOut(300, function () { |
|
counter--; |
|
//remove parent element (main section) |
|
$(this).parent().parent().empty(); |
|
return false; |
|
}); |
|
return false; |
|
} |
|
|
|
}); |
|
}); |
|
|
|
|
|
|
|
function saveDomanda() { |
|
var istituto_di_credito = $("#istituto_di_credito").val(); |
|
var filiale_di = $("#filiale_di").val(); |
|
var iban = $("#vi_c_Iban").val(); |
|
var ripeti_iban = $("#ripeti_iban").val(); |
|
var pec = $("#pec").val(); |
|
var regolarita_contributiva = $("input[name='REGOLARITA_CONTRIBUTIVA']:checked").val(); |
|
var motivazione = $("#motivazione").val(); |
|
|
|
if (iban != ripeti_iban) { |
|
functionSwall('error', "Campi Codice IBAN non corrispondenti!", ""); |
|
} else if (regolarita_contributiva == 1 && motivazione == "") { |
|
functionSwall('error', "Campo Motivazione Regolarità Contributiva Obbligatorio", ""); |
|
} else { |
|
$('#loader').show(); |
|
var form = document.getElementById('form-iban'); |
|
var formInvio = new FormData(form); |
|
postdata(WS_CALL + "?module=domanda&action=saveDomanda", formInvio, function (response) { |
|
// console.log(response) |
|
var risp = jQuery.parseJSON(response); |
|
if (risp.esito === 1) { |
|
$('#loader').hide(); |
|
functionSwall("success", "Operazione completata con successo", "DOMANDA", risp.cod_fis); |
|
} else { |
|
$('#loader').hide(); |
|
functionSwall('error', risp.erroreDescrizione, ""); |
|
} |
|
}); |
|
} |
|
} |
|
/* |
|
* |
|
* @param {type} iban |
|
* @returns {undefined} |
|
* Controllo di verifica dell'iban inserito |
|
* |
|
*/ |
|
function alertValidIBAN(iban) { |
|
//console.log(isValidIBANNumber(iban)); |
|
} |
|
/* |
|
* Returns 1 if the IBAN is valid |
|
* Returns FALSE if the IBAN"s length is not as should be (for CY the IBAN Should be 28 chars long starting with CY ) |
|
* Returns any other number (checksum) when the IBAN is invalid (check digits do not match) |
|
*/ |
|
function isValidIBANNumber(input) { |
|
var CODE_LENGTHS = { |
|
AD: 24, AE: 23, AT: 20, AZ: 28, BA: 20, BE: 16, BG: 22, BH: 22, BR: 29, |
|
CH: 21, CR: 21, CY: 28, CZ: 24, DE: 22, DK: 18, DO: 28, EE: 20, ES: 24, |
|
FI: 18, FO: 18, FR: 27, GB: 22, GI: 23, GL: 18, GR: 27, GT: 28, HR: 21, |
|
HU: 28, IE: 22, IL: 23, IS: 26, IT: 27, JO: 30, KW: 30, KZ: 20, LB: 28, |
|
LI: 21, LT: 20, LU: 20, LV: 21, MC: 27, MD: 24, ME: 22, MK: 19, MR: 27, |
|
MT: 31, MU: 30, NL: 18, NO: 15, PK: 24, PL: 28, PS: 29, PT: 25, QA: 29, |
|
RO: 24, RS: 22, SA: 24, SE: 24, SI: 19, SK: 24, SM: 27, TN: 24, TR: 26 |
|
}; |
|
var iban = String(input).toUpperCase().replace(/[^A-Z0-9]/g, ""), // keep only alphanumeric characters |
|
code = iban.match(/^([A-Z]{2})(d{2})([A-Zd]+)$/), // match and capture (1) the country code, (2) the check digits, and (3) the rest |
|
digits; |
|
// check syntax and length |
|
if (!code || iban.length !== CODE_LENGTHS[code[1]]) { |
|
return false; |
|
} |
|
// rearrange country code and check digits, and convert chars to ints |
|
digits = (code[3] + code[1] + code[2]).replace(/[A-Z]/g, function (letter) { |
|
return letter.charCodeAt(0) - 55; |
|
}); |
|
// final check |
|
return mod97(digits); |
|
} |
|
function mod97(string) { |
|
var checksum = string.slice(0, 2), fragment; |
|
for (var offset = 2; offset < string.length; offset += 7) { |
|
fragment = String(checksum) + string.substring(offset, offset + 7); |
|
checksum = parseInt(fragment, 10) % 97; |
|
} |
|
return checksum; |
|
} |
|
function redirectDomanda(cod_fis_impresa) { |
|
var object = { |
|
cod_fis_impresa: cod_fis_impresa |
|
} |
|
$.redirect("domanda.php", object); |
|
} |
|
function saveDocs() { |
|
$('#loader').show(); |
|
var file = document.getElementById("documento"); |
|
var estensione = file.files[0].type; |
|
//if (estensione == "application/pkcs7-mime" || estensione == "application/pkcs7") { |
|
var form = document.getElementById('form-document'); |
|
var formInvio = new FormData(form); |
|
formInvio.append('module', 'domanda'); |
|
formInvio.append('action', 'saveDocumento'); |
|
postdata(WS_CALL, formInvio, function (response) { |
|
// postdata(WS_CALL + "?module=domanda&action=saveDocumento", formInvio, function (response) { |
|
$('#loader').hide(); |
|
var risp = jQuery.parseJSON(response); |
|
if (risp.esito === 1) { |
|
$('#loader').hide(); |
|
functionSwall("success", "Operazione completata con successo", "DOMANDA", risp.cod_fis); |
|
} else { |
|
$('#loader').hide(); |
|
functionSwall('error', risp.erroreDescrizione, ""); |
|
} |
|
}); |
|
// } else { |
|
// functionSwall('error', "Estensione del file non valida", ""); |
|
// } |
|
|
|
} |
|
function generaDomanda(cod_fis_impresa) { |
|
if (cod_fis_impresa != "") { |
|
var obj = { |
|
cod_fis_impresa: cod_fis_impresa, |
|
mod: 'domanda', |
|
act: 'scarica_file', |
|
fileTypeDescr: 'Scarica la dichiarazione per procedere alla firma in .P7M' |
|
} |
|
// $('#loader').show(); |
|
$.redirect("domandaPDF.php", obj, "POST", "_blank"); |
|
//postdataClassic(WS_CALL + "?module=logs&action=save", obj, function (response) { |
|
// postdataClassic(WS_CALL + "?module=domanda&action=generaPdf", obj, function (response) { |
|
// var object = { |
|
// cod_fis_impresa: cod_fis_impresa, |
|
// tab_active: 'istaTab' |
|
// } |
|
// |
|
// var risp = jQuery.parseJSON(response); |
|
// |
|
// $('#loader').hide(); |
|
// if (risp.success) { |
|
// var urlD = BASE_FOLDER + 'modules/file_download.php?f=' + risp.url + '&versione=0'; |
|
// downloadURL(urlD); |
|
// } else { |
|
// functionSwall('error', risp.erroreDescrizione, ""); |
|
// } |
|
//// $.redirect("domanda.php", object); |
|
// }); |
|
|
|
} else { |
|
functionSwall('error', "Al momento non è possibile completare l'operazione", ""); |
|
} |
|
|
|
// var object = { |
|
// cod_fis_impresa: cod_fis_impresa |
|
// } |
|
// $('#loader').show(); |
|
// $.redirect("domandaPDF.php", object, "POST", "_blank"); |
|
// var obj = { |
|
// cod_fis_impresa: cod_fis_impresa, |
|
// tab_active: 'istaTab' |
|
// } |
|
// $.redirect("domanda.php", obj); |
|
//// setTimeout(function(){ |
|
//// }, 3000); |
|
|
|
|
|
} |
|
//function redirectDomandaAm(cod_fis_impresa) { |
|
// var object = { |
|
// cod_fis_impresa: cod_fis_impresa |
|
// } |
|
// $.redirect("vdomanda.php", object); |
|
//} |
|
|
|
//function modificaDomanda(id, cf) { |
|
// |
|
// Swal.fire({ |
|
// title: 'Sei sicuro di voler proseguire?', |
|
// text: "Confermando, tutti i file caricati saranno eliminati dal sistema. Il processo di esportazione, firma e caricamento del file P7M dovrà essere pertanto ripetuto.", |
|
// icon: 'warning', |
|
// showCancelButton: true, |
|
// confirmButtonColor: '#3085d6', |
|
// cancelButtonColor: '#d33', |
|
// confirmButtonText: 'Si, confermo!' |
|
// }).then((result) => { |
|
// if (result.value) { |
|
// |
|
// var object = { |
|
// IDDomanda: id |
|
// }; |
|
// var cfiscale = cf; |
|
// $('#loader').show(); |
|
// postdataClassic(WS_CALL + "?module=domanda&action=modifica_domanda", object, function (response) { |
|
// $('#loader').hide(); |
|
// var risp = jQuery.parseJSON(response); |
|
// if (risp.esito === 1) { |
|
// var obj = { |
|
// cod_fis_impresa: cfiscale |
|
// }; |
|
// $.redirect("domanda.php", obj); |
|
// } else { |
|
// //functionSwall('error', risp.erroreDescrizione, ""); |
|
// Swal.fire( |
|
// '', |
|
// 'risp.erroreDescrizione', |
|
// 'error' |
|
// ) |
|
// } |
|
// }); |
|
// } |
|
// }); |
|
// |
|
// |
|
//} |
|
|
|
//function calcolaValore(ricevo) { |
|
// var totale = ricevo; |
|
// var ris_divisione; |
|
// var ris_moltiplicazione; |
|
// var ris_percentuale; |
|
// var ritorno; |
|
// if (isNaN(totale) || totale < 0) { |
|
// $('#vi_contributo_dichiarato').val($('#vi_cluster_contributo_previsto').val()); |
|
// return; |
|
// } |
|
// ris_divisione = Number(totale / MESI); |
|
//// console.log(ris_divisione); |
|
// ris_moltiplicazione = Number(ris_divisione * MESI_RIFERIMENTO); |
|
//// console.log(ris_moltiplicazione); |
|
// ris_percentuale = Number((Number(ris_moltiplicazione * PERCENTUALE)) / 100); |
|
// |
|
// if (typeof ris_percentuale === 'undefined') { |
|
// ris_percentuale = 0; |
|
// } |
|
// |
|
// ritorno = (Number(CONTRIBUTO_MIN)) + (Number(ris_percentuale.toFixed(2))); |
|
// ritorno = parseFloat(ritorno.toFixed(2)); |
|
// |
|
// if (ritorno <= CONTRIBUTO_MIN) { |
|
// ritorno = (Number(CONTRIBUTO_MIN)); |
|
// } else if (ritorno >= CONTRIBUTO_MAX) { |
|
// ritorno = (Number(CONTRIBUTO_MAX)); |
|
// } |
|
// |
|
// |
|
//// return; |
|
// |
|
//// console.log(ritorno); |
|
// |
|
// |
|
// |
|
// |
|
//// if (ris_percentuale <= CONTRIBUTO_MIN || typeof ris_percentuale === 'undefined') { |
|
//// ritorno = (Number(CONTRIBUTO_MIN)) + (Number(ris_percentuale.toFixed(2))); |
|
//// } else if (ris_percentuale >= CONTRIBUTO_MAX) { |
|
//// ritorno = (Number(CONTRIBUTO_MAX)); |
|
//// } else { |
|
//// ritorno = (Number(CONTRIBUTO_MIN)) + (Number(ris_percentuale.toFixed(2))); |
|
//// } |
|
// return ritorno; |
|
//} |
|
|
|
|
|
|
|
//function downloadPdf(ricevuto) { |
|
// var object = { |
|
// cod_fis_impresa: ricevuto |
|
// } |
|
// $.redirect("domandaProt.php", object, 'POST', '_blank'); |
|
// |
|
//} |
|
|
|
|
|
//function opsDomanda(id) { |
|
// |
|
// Swal.fire({ |
|
// title: 'Sei sicuro di voler proseguire?', |
|
// text: "Confermando, tutti i dati caricati saranno eliminati dal sistema.", |
|
// icon: 'warning', |
|
// showCancelButton: true, |
|
// confirmButtonColor: '#3085d6', |
|
// cancelButtonColor: '#d33', |
|
// confirmButtonText: 'Si, confermo!' |
|
// }).then((result) => { |
|
// if (result.value) { |
|
// |
|
// var object = { |
|
// IDDomanda: id |
|
// }; |
|
// |
|
// $('#loader').show(); |
|
// postdataClassic(WS_CALL + "?module=domanda&action=ops_domanda", object, function (response) { |
|
// $('#loader').hide(); |
|
// var risp = jQuery.parseJSON(response); |
|
// if (risp.esito === 1) { |
|
// $('#lista_Logs').DataTable().ajax.reload(); |
|
// } else { |
|
// //functionSwall('error', risp.erroreDescrizione, ""); |
|
// Swal.fire( |
|
// '', |
|
// 'risp.erroreDescrizione', |
|
// 'error' |
|
// ); |
|
// } |
|
// }); |
|
// } |
|
// }); |
|
// |
|
// |
|
//}
|