eaiovnaovbqoebvqoeavibavo function enviar_curso(id) { var formData = new FormData(document.getElementById("campos_input" + id)); $("#loading-screen").css("display", "block"); $.ajax({ type: "POST", url: "https://juliojodi.com/CEGSystem/Insertar/curso/" + id, data: formData, cache: false, contentType: false, processData: false, }).done(function (response) { //var mensaje =JSON.parse(response); console.log(response); $("#loading-screen").css("display", "none"); swal({ icon: "success", title: "Atención", text: "¡Se ha registrado correctamente!", }).then(function () { window.location.href = "https://juliojodi.com/CEGSystem/Page/cursos"; }); }); } function enviar_lab() { var formData = new FormData(document.getElementById("form-lab")); $("#loading-screen").css("display", "block"); $.ajax({ type: "POST", url: "https://juliojodi.com/CEGSystem/Insertar/cursoLab", data: formData, cache: false, contentType: false, processData: false, }).done(function (response) { //var mensaje =JSON.parse(response); console.log(response); $("#loading-screen").css("display", "none"); swal({ icon: "success", title: "Atención", text: "¡Se ha registrado correctamente!", }).then(function () { window.location.href = "https://juliojodi.com/CEGSystem/Page/cursos"; }); }); } function mostrar_msg(id) { swal({ title: "¿Está seguro eliminar el dato", text: "Esta acción es irreversible", icon: "warning", buttons: { confirm: { text: "Si deseo eliminarlo", className: "sweet-warning" }, cancel: "Cancelar", }, dangerMode: true, }).then((willDelete) => { if (willDelete) { var formData = new FormData(); formData.append("id_curso", id); $.ajax({ type: "post", url: "https://juliojodi.com/CEGSystem/Eliminar/Curso", data: formData, cache: false, contentType: false, processData: false, }).done(function (response) { var mensaje = JSON.parse(response); console.log(mensaje); swal({ icon: "success", title: "Atención", text: "Se ha eliminado el dato", }).then(function () { window.location.href = "https://juliojodi.com/CEGSystem/Page/cursos"; }); }); } else { swal("No se eliminó el dato"); } }); } function cargar(id) { var conteo = 0; $("#cargar" + id) .parents("tr") .find("td") .each(function () { if (conteo == 0) { document.form_cursoA.id_curso.value = $(this).html(); } if (conteo == 1) { document.form_cursoA.curso.value = $(this).html(); } if (conteo == 2) { if ($(this).html() == "Si") { document.form_cursoA.extracurricular.value = 1; } else { document.form_cursoA.extracurricular.value = 0; } } conteo++; }); } function actualizar_curso() { var formData = new FormData(document.getElementById("form_cursoA")); $.ajax({ type: "POST", url: "https://juliojodi.com/CEGSystem/Modificar/curso", data: formData, cache: false, contentType: false, processData: false, }).done(function (response) { swal({ icon: "success", title: "Atención", text: "Se ha actualizado correctamente", }).then(function () { window.location.href = "https://juliojodi.com/CEGSystem/Page/cursos"; }); }); } function generar_inputs(id) { var input = document.getElementById("input" + id); for (var i = 0; i < input.value; i++) { $("#titulo_guardar" + id).css("display", "block"); $("#btn_guardar" + id).css("display", "inline-block"); $("#btn_cancelar" + id).css("display", "inline-block"); $("#div_agregar" + id).css("display", "none"); $("#campos_input" + id).append( '' ); } $("#cantidad_input" + id).val(input.value); } function cancelar() { window.location.href = "https://juliojodi.com/CEGSystem/Page/cursos"; } function asignar_profesor(id) { var id_docente = document.getElementById("select" + id).value; var formData = new FormData(); formData.append("id_curso", id); formData.append("id_docente", id_docente); $.ajax({ type: "POST", url: "https://juliojodi.com/CEGSystem/Modificar/curso2", data: formData, cache: false, contentType: false, processData: false, }).done(function (response) { $("#alert_docente").css("display", "block"); setTimeout(function () { $("#alert_docente").css("display", "none"); }, 3000); }); } function cargarCurso(){ swal({ title: "¿Está seguro cargar los cursos", text: "Se crearan todos los cursos del archivo csv", icon: "info", buttons: { confirm: { text: "Si deseo cargarlos", className: "sweet-warning" }, cancel: "Cancelar", }, dangerMode: true, }).then((willDelete) => { if (willDelete) { let id_grado = document.getElementById('SelectGrado').value; $("#loading-screen").css("display", "block"); $.ajax({ type: "post", url: "https://juliojodi.com/CEGSystem/Curso/cargar/"+id_grado, }).done(function (response) { $("#loading-screen").css("display", "none"); var mensaje = JSON.parse(response); console.log(mensaje); swal({ icon: "success", title: "Atención", text: "Se han cargado los cursos", }).then(function () { window.location.href = "https://juliojodi.com/CEGSystem/Page/cursos"; }); }); } else { swal("No se cargaron los cursos"); } }); }