eaiovnaovbqoebvqoeavibavo $(document).ready(function(){ $("#id_encargadoE").select2(); var form = document.getElementById("form_alumno"); form.addEventListener('submit', function (event) { if (!form.checkValidity()) { event.preventDefault(); event.stopPropagation(); }else{ enviar_alumno(); } form.classList.add('was-validated'); }, false); $("#existente").hide(); }); var num_encargado=0; function agregarT(){ var i=num_encargado; var id_telefono=0; $("#telefonos"+i).find("input").each(function(){ id_telefono++; }); $("#telefonos"+i).append( '
'+ ''+ '
'+ ''+ ''+ '
'+ 'Complete este campo'+ '
'+ '
'+ '
'+ '
'+ '

'+ '
' ); } function agregarC(){ var i = num_encargado; var id_correo=0; $("#correos"+i).find("input").each(function(){ id_correo++; }); $("#correos"+i).append( '
'+ ''+ '
'+ ''+ ''+ '
'+ 'Complete este campo'+ '
'+ '
'+ '
'+ '
'+ '

'+ '
' ); } function eliminarT(t){ $("#divT1"+t).remove(); $("#divT2"+t).remove(); } function eliminarC(c){ $("#divC1"+c).remove(); $("#divC2"+c).remove(); } function agregarEncargado(){ num_encargado++; var i = num_encargado; $("#form_alumno").append( '
'+ 'Datos del(los) encargado(s) '+ '
'+ ' '+ '
'+ '
'+ ''+ '
'+ ' '+ ' '+ '
'+ ''+ '
'+ ''+ ' '+ '
'+ ''+ '
'+ ''+ ''+ '
'+ '
'+ 'Telefonos encargado '+ '
'+ ' '+ '
'+ '
'+ ''+ '
'+ ''+ ''+ '
'+ '
'+ '
'+ '
'+ '
'+ 'Correos encargado '+ '
'+ ' '+ '
'+ '
'+ ''+ '
'+ ''+ ''+ '
'+ '
'+ '
'+ '
'+ '
'+ '
'+ '
' ); } function enviar_alumno(){ var formData= new FormData(document.getElementById('form_alumno')); formData.append('cant_encargado',num_encargado); $('#loading-screen').css('display','block'); $.ajax({ type: "POST", url: "https://juliojodi.com/CEGSystem/Insertar/inscripcionPI", data: formData, cache: false, contentType: false, processData: false }).done(function(response){ //console.log(response); //var mensaje =JSON.parse(response); var carnet = JSON.parse(response); $('#loading-screen').css('display','none'); swal({ icon: 'success', title: 'Atención', text: '¡Se ha registrado correctamente!', }).then(function () { swal({ title: "¿Desea imprimir?", text: "Esta a punto de imprimir", icon: "info", buttons: { confirm : {text:'Si ',className:'sweet-info'}, cancel : 'Cancelar' }, dangerMode: false }) .then((willDelete) => { if (willDelete) { window.open('https://juliojodi.com/CEGSystem/Reporte_inscripcion/alumno/'+carnet,"_blank"); window.location.href='https://juliojodi.com/CEGSystem/Page/alumnos'; } else { window.location.href='https://juliojodi.com/CEGSystem/Page/alumnos'; } }); }); }); } function mostrar(){ var check = document.getElementById("checkPadre").checked; if(check){ $("#existente").show(); $("#noExistente").hide(); $('#nombreP0').removeAttr("required"); $('#direccion0').removeAttr("required"); $('#parentesco0').removeAttr("required"); $('#telefono00').removeAttr("required"); $('#correo00').removeAttr("required"); }else{ $("#existente").hide(); $("#noExistente").show(); $('#nombreP0').prop("required", true); $('#direccion0').prop("required", true); $('#parentesco0').prop("required", true); $('#telefono00').prop("required", true); $('#correo00').prop("required", true); } }