$(document).ready(function () { $('#iban').bind("cut copy", function (e) { e.preventDefault(); console.log('operazione non consentita'); }); $("#iban").on("input", function () { $("#ripeti_iban").val(""); }); }); function settaMotivazione(ricevo) { if (ricevo.value == 0) { $("#rigamotivazione").attr("hidden", true); $("#motivazione").attr("required", false); $("#motivazione").val(""); } else if (ricevo.value == 1) { $("#rigamotivazione").attr("hidden", false); $("#motivazione").attr("required", true); } } function saveDomanda() { var istituto_di_credito = $("#istituto_di_credito").val(); var filiale_di = $("#filiale_di").val(); var iban = $("#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-adesione'); var formInvio = new FormData(form); postdata(WS_CALL + "?module=domanda_adesione&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_ADESIONE", risp.cod_fis_impresa); } else { $('#loader').hide(); functionSwall('error', risp.erroreDescrizione, ""); } }); } } function generaDomandaAdesione(cf_impresa, id) { if (cf_impresa != "" && id != "") { var obj = { cod_fis_impresa: cf_impresa, id: id, mod: 'domanda_adesione', act: 'scarica_file', fileTypeDescr: 'Scarica la dichiarazione per procedere alla firma in .P7M' } // $('#loader').show(); $.redirect("domandaAdesionePDF.php", obj, "POST", "_blank"); // postdataClassic(WS_CALL + "?module=logs&action=save", obj, function (response) { // postdataClassic(WS_CALL + "?module=domanda_adesione&action=generaPdf", obj, function (response) { // var object = { // cod_fis_impresa: cf_impresa, // id: id, // tab_active: 'istaTab' // } // // var risp = jQuery.parseJSON(response); // // $('#loader').hide(); // if (risp.success) { // console.log("sono in success"); // var urlD = BASE_FOLDER + 'modules/file_download.php?f=' + risp.url + '&versione=1'; // downloadURL(urlD, object); // } else { // functionSwall('error', risp.erroreDescrizione, ""); // } //// setTimeout(function () { //// $.redirect("presenta_domanda.php", object); //// }, 100); // // }); } else { functionSwall('error', "Al momento non è possibile completare l'operazione", ""); } } function saveDocs() { $('#loader').show(); var form = document.getElementById('form-document'); var formInvio = new FormData(form); formInvio.append('module', 'domanda_adesione'); formInvio.append('action', 'saveDocumento'); postdata(WS_CALL, formInvio, function (response) { $('#loader').hide(); var risp = jQuery.parseJSON(response); if (risp.esito === 1) { $('#loader').hide(); functionSwall("success", "Operazione completata con successo", "aziende.php"); } else { $('#loader').hide(); functionSwall('error', risp.erroreDescrizione, ""); } }); }