eaiovnaovbqoebvqoeavibavo $(document).ready(function () { $(".selectAsignar").select2(); var tabla = $('#myTable').DataTable({ "language": { "paginate": { "previous": "Anterior", "next": "Siguiente" }, "lengthMenu": "Mostrar _MENU_ entradas", "zeroRecords": "No hay ningun registro", "info": "Mostrando _PAGE_ de _PAGES_", "infoEmpty": "No hay ningun registro", "search": "Buscar" }, "order": [[0, "asc"]] , "aLengthMenu": [40] , dom: 'Bfrtip', buttons: [ 'copy', 'csv', 'excel', 'pdf' ] }); }) function enviar_taller() { var formData = new FormData(document.getElementById('form-taller')); $('#loading-screen').css('display', 'block'); $.ajax({ type: "POST", url: "https://juliojodi.com/CEGSystem/Insertar/taller", data: formData, cache: false, contentType: false, processData: false }).done(function (response) { var mensaje = JSON.parse(response); //console.log(mensaje); $('#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/talleres'; }); }); } 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_taller', id) $.ajax({ type: "post", url: "https://juliojodi.com/CEGSystem/Eliminar/taller", 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/talleres'; }); }); } 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.for_tallerA.id_taller.value = $(this).html(); } if (conteo == 1) { document.for_tallerA.taller.value = $(this).html(); }if (conteo == 2) { document.for_tallerA.bimestre.value = $(this).html(); } conteo++; }); } function actualizar_taller() { var formData = new FormData(document.getElementById('for_tallerA')); $.ajax({ type: "POST", url: "https://juliojodi.com/CEGSystem/Modificar/taller", data: formData, cache: false, contentType: false, processData: false }).done(function (response) { console.log(response); swal({ icon: 'success', title: 'Atención', text: 'Se ha actualizado correctamente', }).then(function () { window.location.href = 'https://juliojodi.com/CEGSystem/Page/talleres'; }); }); } function asignar_profesorEA(id) { var id_docente = document.getElementById("select" + id).value; var formData = new FormData(); formData.append('id_taller', id); formData.append('id_docente', id_docente); $.ajax({ type: "POST", url: "https://juliojodi.com/CEGSystem/Modificar/cursoEA", data: formData, cache: false, contentType: false, processData: false }).done(function (response) { console.log(response) $("#alert_docente").css("display", "block"); setTimeout(function () { $("#alert_docente").css("display", "none"); }, 3000); }); } function asignarTaller(carnet, bimestre) { var id_taller = document.getElementById('selectTaller' + carnet).value; var formData = new FormData(); formData.append('carnet', carnet); formData.append('id_taller', id_taller); formData.append('bimestre', bimestre); $.ajax({ type: "POST", url: "https://juliojodi.com/CEGSystem/Modificar/tallerAlumno", data: formData, cache: false, contentType: false, processData: false }).done(function (response) { console.log(response); $("#alert_nivel").css("display", "block"); setTimeout(function () { $("#alert_nivel").css("display", "none"); }, 3000); }); } /* PARA REGISTRO DE NOTAS */ function validarPunteo(event, punteo, id_actividad, cantidad) { var cantidadF = parseInt(cantidad) + 8; if (event.ctrlKey && event.keyCode === 86) { } else if (event.keyCode === 39 || event.keyCode === 37 || event.keyCode === 38 || event.keyCode === 40) { } else if (event.keyCode === 18 && event.keyCode === 9) { } else if (event.keyCode === 8 || event.keyCode === 46) { var contador = 1; $("table tr").each(function () { if (contador > 1) { var contador2 = 0; var total = 0; $(this).find("td").each(function () { if (contador2 > 2 && contador2 < 8) { if ($("#" + $(this).attr("class")).val()) { total += parseInt($("#" + $(this).attr("class")).val()); } //console.log(total); } else if (contador2 >= 8) { if (total >= 70) { $("#NS" + $(this).attr("class")).val(total); $("#NS" + $(this).attr("class")).css("background", "#9df78b"); } else { $("#NS" + $(this).attr("class")).val(total); $("#NS" + $(this).attr("class")).css("background", "#f78b8b"); } } contador2++; }); } contador++; }); } else { nota = document.getElementById(id_actividad).value; if (parseFloat(nota) >= 0 && parseFloat(nota) <= parseInt(punteo)) { var contador = 1; $("table tr").each(function () { if (contador > 1) { var contador2 = 0; var total = 0; $(this).find("td").each(function () { if (contador2 > 2 && contador2 < 8) { if ($("#" + $(this).attr("class")).val()) { total += parseInt($("#" + $(this).attr("class")).val()); } //console.log(total); } else if (contador2 >= 8) { if (total >= 70) { $("#NS" + $(this).attr("class")).val(total); $("#NS" + $(this).attr("class")).css("background", "#9df78b"); } else { $("#NS" + $(this).attr("class")).val(total); $("#NS" + $(this).attr("class")).css("background", "#f78b8b"); } } contador2++; }); } contador++; }); } else if (nota == "" || nota == null) { var contador = 1; $("table tr").each(function () { if (contador > 1) { var contador2 = 0; var total = 0; $(this).find("td").each(function () { if (contador2 > 2 && contador2 < 8) { if ($("#" + $(this).attr("class")).val()) { total += parseInt($("#" + $(this).attr("class")).val()); } //console.log(total); } else if (contador2 >= 8) { if (total >= 70) { $("#NS" + $(this).attr("class")).val(total); $("#NS" + $(this).attr("class")).css("background", "#9df78b"); } else { $("#NS" + $(this).attr("class")).val(total); $("#NS" + $(this).attr("class")).css("background", "#f78b8b"); } } contador2++; }); } contador++; }); } else { alert('El valor máximo de esta actividad es de ' + punteo); $('#' + id_actividad).val(""); calcular(cantidad); } } } function guardarNotasEA() { var totalFilas = $("table tr").length; var filasGuardadas = 0; $("table tr").each(function () { $('#loading-screen').css('display', 'block'); var nota = 0; var id_nota_taller = ""; $(this).find("td").each(function () { nota = 0; id_nota_taller = ""; var formData = new FormData(); if ($("#" + $(this).attr("class")).val()) { nota = parseInt($("#" + $(this).attr("class")).val()); //console.log("pasa con valor" + nota); id_nota_taller = $("#" + $(this).attr("class")).attr("id"); formData.append("nota", nota); formData.append("id", id_nota_taller); $.ajax({ type: "POST", url: "https://juliojodi.com/CEGSystem/Modificar/NotaEA", data: formData, cache: false, contentType: false, processData: false }); } else if ($("#NS" + $(this).attr("class")).val()) { nota = parseInt($("#NS" + $(this).attr("class")).val()); id_nota_taller = $("#NS" + $(this).attr("class")).attr("id"); aux = id_nota_taller.toString(); aux = aux.substring(2, aux.length); id_nota_taller = parseInt(aux); //console.log("pasa NS con valor" + nota + " " + aux); formData.append("nota", nota); formData.append("id", id_nota_taller); $.ajax({ type: "POST", url: "https://juliojodi.com/CEGSystem/Modificar/NotaEA", data: formData, cache: false, contentType: false, processData: false }); } else if ($("#" + $(this).attr("class")).attr("id")) { nota = 0; id_nota_taller = $("#" + $(this).attr("class")).attr("id"); //console.log("pasa vacio" + id_nota_taller); formData.append("nota", nota); formData.append("id", id_nota_taller); $.ajax({ type: "POST", url: "https://juliojodi.com/CEGSystem/Modificar/NotaEA", data: formData, cache: false, contentType: false, processData: false }).done(function (response) { filasGuardadas++; if (filasGuardadas === totalFilas) { $('#loading-screen').css('display', 'none'); swal({ icon: 'success', title: 'Atención', text: '¡Se ha registrado correctamente!', }).then(function () { location.reload(true); }); } }); } }); }); } function limpiarColumna(posicion) { $("table tr").each(function () { var contadorB = 0; $(this).find("td").each(function () { if (contadorB == posicion) { $("#" + $(this).attr("class")).val(""); } contadorB++; }); }); var contador = 1; $("table tr").each(function () { if (contador > 1) { var contador2 = 0; var total = 0; $(this).find("td").each(function () { if (contador2 > 2 && contador2 < 8) { if ($("#" + $(this).attr("class")).val()) { total += parseInt($("#" + $(this).attr("class")).val()); } console.log(total); } else if (contador2 >= 8) { if (total >= 70) { $("#NS" + $(this).attr("class")).val(total); $("#NS" + $(this).attr("class")).css("background", "#9df78b"); } else { $("#NS" + $(this).attr("class")).val(total); $("#NS" + $(this).attr("class")).css("background", "#f78b8b"); } } contador2++; }); } contador++; }); }