From d6abec0f9127e88e560c81e182feb048c0042e04 Mon Sep 17 00:00:00 2001 From: Alexisvip739 <39203602@uaz.edu.mx> Date: Wed, 29 Nov 2023 10:36:03 -0600 Subject: [PATCH] modal para eliminar inscritos desde super admin y desincribirse desde el estudiante --- clase/templates/clase/clases_estudiante.html | 134 ++++++++++++++++- mydatabase | Bin 311296 -> 311296 bytes static/js/comentarios.js | 142 ------------------- 3 files changed, 133 insertions(+), 143 deletions(-) delete mode 100644 static/js/comentarios.js diff --git a/clase/templates/clase/clases_estudiante.html b/clase/templates/clase/clases_estudiante.html index 1b7234c..ef73885 100644 --- a/clase/templates/clase/clases_estudiante.html +++ b/clase/templates/clase/clases_estudiante.html @@ -241,5 +241,137 @@ {% block js_externo %} - + {% endblock js_externo %} diff --git a/mydatabase b/mydatabase index 97fd53d8f87894bc391a238a1fb07eb3febbf176..bf744a86a17dc3e855a56cb4489f125d19c16b51 100644 GIT binary patch delta 186 zcmZo@5N>D?o*>OAKT*b+QGR2>L3ze6o0SyS@v-oGGpI}s6i^To;b+!mOwLIxPK{5_ z&rQuMNi53DXKLosZ|Bly+|H%X^lJkLBmXxB{%`yzHw$h!z(4)WdnPR|4kk7Renw7) zME-3bm{<}x82NuO@c-ifx><0;8-5XP23BT9Mt&wP1_lO3{@)DzzY#JFEXD?o*>OAH&Mo!QEp?xL3zeUo0SyS@mcYGXAojQ0mA&ux}3>5iN&e$$@#gd zc_oQOnfd(Q48ka?7#Nzl^xL`g8MkxkGyU4Y!63lE!2g;5 { - try { - - const class_view = await fetchData('/api/clases_vistas/', csrfToken); - const view_exists = class_view.find(item => item.estudiante == id_user && item.clase == id_video); - - if (view_exists === undefined) { - const fechaActual = new Date(); - const data = { - estudiante: id_user, - clase: id_video, - curso: id_curso, - fecha_ultima_visualizacion: fechaActual.toISOString() - }; - await sendViewedClassData(data, csrfToken); - } - } catch (error) { - console.error("Error fetching data:", error); - } - }); - } catch (error) { - console.error("Error:", error); - } - } - - function borrarComentario(id) { - form = document.getElementById(id); - form.elements["contenido"].value = ""; - } - - function enviarComentario(url, id) { - var formData = new FormData(document.getElementById(id)); - console.log(formData); - - fetch(url, { - method: "POST", - body: formData, - }) - .then(function (response) { - return response.json(); - }) - .then(function (data) { - if (data.success) { - borrarComentario(id); - location.reload(); - } else { - for (var field in data.errors) { - var error = data.errors[field]; - var input = document.getElementById("id_" + field); - input.classList.add("error"); - input.nextSibling.textContent = error; - } - } - }); - } - function displayContainer(id) { - let container = document.getElementById(id); - if (container.style.display === "none") { - container.style.display = "block"; - } else { - container.style.display = "none"; - } - } - - const clase = document.getElementById("class-message"); - - if( parseInt(clase.dataset.class) === 1 ){ - DataApi() - - let comentario = document.getElementById("contenedor-comentarios"); - - comentario.addEventListener("click", function (event) { - event.preventDefault(); - let id = event.target.dataset.id; - let type = event.target.dataset.type; - if (type == "send") { - enviarComentario("{% url 'clase:agregar_comentario' %}", id); - } else if (type == "cancel") { - borrarComentario(id); - } else if (type == "display-block") { - displayContainer(id); - } - }); - } - - - - - - - - -- GitLab