Commit 561d3a62 authored by Elliot Axel Noriega's avatar Elliot Axel Noriega
Browse files

Se grego la funcionalidad y template de ver los horarios de un determinado...

Se grego la funcionalidad y template de ver los horarios de un determinado docente y grupo, ademas de correccion de funcion borrarErrores
parent c2bbc0b7
Loading
Loading
Loading
Loading
+62 −4
Original line number Diff line number Diff line
@@ -84,7 +84,7 @@
<div class="card" style="margin-bottom: 10px;">
    <div class="card-body px-0 pt-0 pb-2" >
        <br>
        <div class="row justify-content-center" style="margin-bottom: 10px;">
        <div class="row justify-content-center" >
            <div class="col-3">
                <form method="get" action="{% url 'AsignarCarga' carga.id %}" id="filterSelectSearchForm">
                  <div class="input-group">
@@ -94,10 +94,11 @@
                </form>
            </div>
        </div>
        
        <form method="post" id="FormCarga">
        {% csrf_token %}
        <br>
        <div class="row justify-content-center" style="margin-bottom: 10px;">
        <div class="row justify-content-center">
            <div class="col-2" style="width: 9%; display: flex; align-items: center;">
                <div class="text-center">
                    <h5>Docente:</h5>
@@ -116,6 +117,11 @@
                </select>
            </div>
        </div>
        <div class="row justify-content-center text-center" style="margin-top: 20px;">
            <div>
                <a href="#" class="btn btn-secondary btn-lg" role="button" aria-pressed="true" onclick="abrirVentana()">Ver horario actual del docente y Grupo</a>
            </div>
        </div>
    </div>
</div>

@@ -204,7 +210,7 @@
        </div>
    </div>
    <div class="card-body px-0 pt-0 pb-2">
        <div class="row justify-content-center" style="margin-bottom: 10px;">
        <div class="row justify-content-center">
            <div class="col-3 text-center">
                <h6>Tipo de carga:</h6>
                <select class="form-control" name="SelectTipoCarga">
@@ -362,12 +368,24 @@
            // Mostrar la alerta en el DOM
            const customAlert = document.getElementById("customAlert");
            const alertText = customAlert.querySelector(".alert-text");
            alertText.innerHTML = `<strong>Atención ${mensaje}</strong>`;
            alertText.innerHTML = `<strong>Atención: ${mensaje}</strong>`;
            customAlert.classList.remove("d-none"); // Mostrar el customAlert

            // Ocultar el mensaje de error después de 5 segundos
            setTimeout(function() {
                ocultarMensajeError();
            }, 5000);
        
            return true;
        }

        // Función para ocultar el mensaje de error
        function ocultarMensajeError() {
            // Ocultar el mensaje de error después de 5 segundos
            const customAlert = document.getElementById("customAlert");
            customAlert.classList.add("d-none"); // Ocultar el customAlert
        }

        // Obtener el botón de guardar
        const guardarBtn = document.getElementById("guardarBtn");

@@ -381,4 +399,44 @@
    });
</script>

<script>
    function abrirVentana() {
        // Verificar si se ha seleccionado un docente
        var docenteSeleccionado = document.querySelector('select[name="docente"]').value.trim();
        
        if (docenteSeleccionado === "") {
            // Mostrar mensaje de error si no se ha seleccionado un docente
            mostrarMensajeError("Debe seleccionar un docente antes de ver el horario.");

            // Ocultar el mensaje de error después de 5 segundos
            setTimeout(function() {
                ocultarMensajeError();
            }, 5000);
        } else {
            // URL a la que deseas que apunte el enlace
            var url = "{% url 'VerHorarios' %}?docente_id=" + docenteSeleccionado + "&carga_id={{carga.id}}";

            // Tamaño y otras opciones de la nueva ventana
            var opcionesVentana = 'width=1100,height=600,resizable=yes,scrollbars=yes';

            // Abrir la nueva ventana
            window.open(url, '_blank', opcionesVentana);
        }
    }

    function mostrarMensajeError(mensaje) {
        // Mostrar el mensaje de error en el customAlert
        const customAlert = document.getElementById("customAlert");
        const alertText = customAlert.querySelector(".alert-text");
        alertText.innerHTML = `<strong>Atencion: ${mensaje}</strong>`;
        customAlert.classList.remove("d-none"); // Mostrar el customAlert
    }

    function ocultarMensajeError() {
        // Ocultar el mensaje de error en el customAlert después de 5 segundos
        const customAlert = document.getElementById("customAlert");
        customAlert.classList.add("d-none"); // Ocultar el customAlert
    }
</script>
    
{% endblock %}
 No newline at end of file
+254 −0
Original line number Diff line number Diff line
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="apple-touch-icon" sizes="76x76" href="{% static 'img/uaie.png' %}">
    <link rel="icon" type="image/png" href="{% static 'img/uaie.png' %}">
    <title>
      Cargas UAIE
    </title>
    <!--     Fonts and icons     -->
    <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700" rel="stylesheet" />
    <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
    <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20,400,1,0" />
    <!-- Nucleo Icons -->
    <link href="{% static 'css/nucleo-icons.css' %}" rel="stylesheet" />
    <link href="{% static 'css/nucleo-svg.css' %}" rel="stylesheet" />
    <!-- Font Awesome Icons -->
    <script src="https://kit.fontawesome.com/42d5adcbca.js" crossorigin="anonymous"></script>
    <link href="{% static 'css/nucleo-svg.css' %}" rel="stylesheet" />
    <!-- CSS Files -->
    <link id="pagestyle" href="{% static 'css/soft-ui-dashboard.css' %}" rel="stylesheet" />
</head>
<body>
    <div class="col" style="margin-top: 10px;">
        <div class="text-center alert alert-dark alert-dismissible fade show text-white" role="alert">
            <span class="alert-text" style="font-size: large;">Horarios del Docente <strong>{{docente.nombre}} {{docente.apellidos}}</strong></span>
          </div>
    </div>   
    <div class="container-fluid" style="margin-bottom: 35px;">
        
        <div class="row justify-content-center">
            <div class="col">
                {% if docenteSinCargas %}
                <div class="text-center">
                    <h5>El docente no cuenta con cargas.</h5>
                </div>
                {% else %}

        
        <table class="table align-items-center mb-0">
            <thead>
                <tr>
                    <th colspan="2"></th>
                    <th style="background-color: #588CB7; color: whitesmoke;" class="text-center text-uppercase text-xxs font-weight-bolder">Lunes</th>
                    <th style="background-color: #588CB7; color: whitesmoke;" class="text-center text-uppercase text-xxs font-weight-bolder">Martes</th>
                    <th style="background-color: #588CB7; color: whitesmoke;" class="text-center text-uppercase text-xxs font-weight-bolder">Miércoles</th>
                    <th style="background-color: #588CB7; color: whitesmoke;" class="text-center text-uppercase text-xxs font-weight-bolder">Jueves</th>
                    <th style="background-color: #588CB7; color: whitesmoke;" class="text-center text-uppercase text-xxs font-weight-bolder">Viernes</th>
                    <th style="background-color: #588CB7; color: whitesmoke;" class="text-center text-uppercase text-xxs font-weight-bolder">Sábado</th>
                </tr>
            </thead>
            <tbody>
                {% for carga, horarios in datos_cargas_docente.items %}
                <tr>
                    <td class="text-center text-uppercase text-xxs font-weight-bolder" rowspan="4" style="background-color: #365873; color: whitesmoke;">
                        {{carga.materia}}<br>{{carga.materia.programa}}
                    </td>
                    <td class="text-center text-uppercase text-xxs font-weight-bolder" rowspan="2" style="background-color: #588CB7; color: whitesmoke;">
                        Hora Inicio
                    </td>
                    <td class="text-center" style=" border: 1px solid black;">
                        <div class="px-2 py-1">
                            <h6 class="mb-0 text-xs">{{ horarios.Lunes.hora_inicio|default:'-' }}</h6>
                        </div>
                    </td>
                    <td class="text-center" style=" border: 1px solid black;">
                        <div class="px-2 py-1">
                            <h6 class="mb-0 text-xs">{{ horarios.Martes.hora_inicio|default:'-' }}</h6>
                        </div>
                    </td>
                    <td class="text-center" style=" border: 1px solid black;">
                        <div class="px-2 py-1">
                            <h6 class="mb-0 text-xs">{{ horarios.Miercoles.hora_inicio|default:'-' }}</h6>
                        </div>
                    </td>
                    <td class="text-center" style=" border: 1px solid black;">
                        <div class="px-2 py-1">
                            <h6 class="mb-0 text-xs">{{ horarios.Jueves.hora_inicio|default:'-' }}</h6>
                        </div>
                    </td>
                    <td class="text-center" style=" border: 1px solid black;">
                        <div class="px-2 py-1">
                            <h6 class="mb-0 text-xs">{{ horarios.Viernes.hora_inicio|default:'-' }}</h6>
                        </div>
                    </td>
                    <td class="text-center" style=" border: 1px solid black;">
                        <div class="px-2 py-1">
                            <h6 class="mb-0 text-xs">{{ horarios.Sabado.hora_inicio|default:'-' }}</h6>
                        </div>
                    </td>
                </tr>
                <tr></tr>
                <tr>
                    <td class="text-center text-uppercase text-xxs font-weight-bolder" rowspan="2" style="background-color: #588CB7; color: whitesmoke;">
                        Hora Fin
                    </td>
                    <td class="text-center" style=" border: 1px solid black;">
                        <div class="px-2 py-1">
                            <h6 class="mb-0 text-xs">{{ horarios.Lunes.hora_fin|default:'-' }}</h6>
                        </div>
                    </td>
                    <td class="text-center" style=" border: 1px solid black;">
                        <div class="px-2 py-1">
                            <h6 class="mb-0 text-xs">{{ horarios.Martes.hora_fin|default:'-' }}</h6>
                        </div>
                    </td>
                    <td class="text-center" style=" border: 1px solid black;">
                        <div class="px-2 py-1">
                            <h6 class="mb-0 text-xs">{{ horarios.Miercoles.hora_fin|default:'-' }}</h6>
                        </div>
                    </td>
                    <td class="text-center" style=" border: 1px solid black;">
                        <div class="px-2 py-1">
                            <h6 class="mb-0 text-xs">{{ horarios.Jueves.hora_fin|default:'-' }}</h6>
                        </div>
                    </td>
                    <td class="text-center" style=" border: 1px solid black;">
                        <div class="px-2 py-1">
                            <h6 class="mb-0 text-xs">{{ horarios.Viernes.hora_fin|default:'-' }}</h6>
                        </div>
                    </td>
                    <td class="text-center" style=" border: 1px solid black;">
                        <div class="px-2 py-1">
                            <h6 class="mb-0 text-xs">{{ horarios.Sabado.hora_fin|default:'-' }}</h6>
                        </div>
                    </td>
                </tr>
                <tr></tr>
                {% endfor %}
            </tbody>
        </table>
        {% endif %}
            </div>
        </div>
        
    </div>
    <div class="col">
        <div class="text-center alert alert-dark alert-dismissible fade show text-white" role="alert">
            <span class="alert-text" style="font-size: large;">Horarios del Grupo <strong>{{carga.materia.semestre}} - {{carga.materia.grupo}}</strong></span>
          </div>
    </div>    
    <div class="container-fluid">
        <div class="row align-items-center">
            <div class="col">
                {% if grupoSinCargas %}
                <div class="text-center">
                    <h5>El grupo no cuenta con cargas.</h5>
                </div>
                {% else %}
        <table class="table align-items-center mb-0">
            <thead>
                <tr>
                    <th colspan="2"></th>
                    <th style="background-color: #588CB7; color: whitesmoke;" class="text-center text-uppercase text-xxs font-weight-bolder">Lunes</th>
                    <th style="background-color: #588CB7; color: whitesmoke;" class="text-center text-uppercase text-xxs font-weight-bolder">Martes</th>
                    <th style="background-color: #588CB7; color: whitesmoke;" class="text-center text-uppercase text-xxs font-weight-bolder">Miércoles</th>
                    <th style="background-color: #588CB7; color: whitesmoke;" class="text-center text-uppercase text-xxs font-weight-bolder">Jueves</th>
                    <th style="background-color: #588CB7; color: whitesmoke;" class="text-center text-uppercase text-xxs font-weight-bolder">Viernes</th>
                    <th style="background-color: #588CB7; color: whitesmoke;" class="text-center text-uppercase text-xxs font-weight-bolder">Sábado</th>
                </tr>
            </thead>
            <tbody>
                {% for carga, horarios in datos_cargas_grupo.items %}
                <tr>
                    <td class="text-center text-uppercase text-xxs font-weight-bolder" rowspan="4" style="background-color: #365873; color: whitesmoke;">
                        {{carga.docente}}<br>{{carga.materia.nombre}}<br>{{carga.materia.programa}}
                    </td>
                    <td class="text-center text-uppercase text-xxs font-weight-bolder" rowspan="2" style="background-color: #588CB7; color: whitesmoke;">
                        Hora Inicio
                    </td>
                    <td class="text-center" style=" border: 1px solid black;">
                        <div class="px-2 py-1">
                            <h6 class="mb-0 text-xs">{{ horarios.Lunes.hora_inicio|default:'-' }}</h6>
                        </div>
                    </td>
                    <td class="text-center" style=" border: 1px solid black;">
                        <div class="px-2 py-1">
                            <h6 class="mb-0 text-xs">{{ horarios.Martes.hora_inicio|default:'-' }}</h6>
                        </div>
                    </td>
                    <td class="text-center" style=" border: 1px solid black;">
                        <div class="px-2 py-1">
                            <h6 class="mb-0 text-xs">{{ horarios.Miercoles.hora_inicio|default:'-' }}</h6>
                        </div>
                    </td>
                    <td class="text-center" style=" border: 1px solid black;">
                        <div class="px-2 py-1">
                            <h6 class="mb-0 text-xs">{{ horarios.Jueves.hora_inicio|default:'-' }}</h6>
                        </div>
                    </td>
                    <td class="text-center" style=" border: 1px solid black;">
                        <div class="px-2 py-1">
                            <h6 class="mb-0 text-xs">{{ horarios.Viernes.hora_inicio|default:'-' }}</h6>
                        </div>
                    </td>
                    <td class="text-center" style=" border: 1px solid black;">
                        <div class="px-2 py-1">
                            <h6 class="mb-0 text-xs">{{ horarios.Sabado.hora_inicio|default:'-' }}</h6>
                        </div>
                    </td>
                </tr>
                <tr></tr>
                <tr>
                    <td class="text-center text-uppercase text-xxs font-weight-bolder" rowspan="2" style="background-color: #588CB7; color: whitesmoke;">
                        Hora Fin
                    </td>
                    <td class="text-center" style=" border: 1px solid black;">
                        <div class="px-2 py-1">
                            <h6 class="mb-0 text-xs">{{ horarios.Lunes.hora_fin|default:'-' }}</h6>
                        </div>
                    </td>
                    <td class="text-center" style=" border: 1px solid black;">
                        <div class="px-2 py-1">
                            <h6 class="mb-0 text-xs">{{ horarios.Martes.hora_fin|default:'-' }}</h6>
                        </div>
                    </td>
                    <td class="text-center" style=" border: 1px solid black;">
                        <div class="px-2 py-1">
                            <h6 class="mb-0 text-xs">{{ horarios.Miercoles.hora_fin|default:'-' }}</h6>
                        </div>
                    </td>
                    <td class="text-center" style=" border: 1px solid black;">
                        <div class="px-2 py-1">
                            <h6 class="mb-0 text-xs">{{ horarios.Jueves.hora_fin|default:'-' }}</h6>
                        </div>
                    </td>
                    <td class="text-center" style=" border: 1px solid black;">
                        <div class="px-2 py-1">
                            <h6 class="mb-0 text-xs">{{ horarios.Viernes.hora_fin|default:'-' }}</h6>
                        </div>
                    </td>
                    <td class="text-center" style=" border: 1px solid black;">
                        <div class="px-2 py-1">
                            <h6 class="mb-0 text-xs">{{ horarios.Sabado.hora_fin|default:'-' }}</h6>
                        </div>
                    </td>
                </tr>
                <tr></tr>
                {% endfor %}
            </tbody>
        </table>
        {% endif %}
            </div>
        </div>
        
    </div>
</body>
<!-- Github buttons -->
<script async defer src="https://buttons.github.io/buttons.js"></script>
<!-- Control Center for Soft Dashboard: parallax effects, scripts for the example pages etc -->
<script src="{% static 'js/soft-ui-dashboard.min.js' %}"></script>
</html>
 No newline at end of file
+1 −0
Original line number Diff line number Diff line
@@ -15,5 +15,6 @@ urlpatterns = [
    path('ExportarCarga/<int:id>', views.ExportarCarga, name='ExportarCarga'),
    path('ConfirmacionFinalizarCiclo/<int:id>', views.ConfirmacionFinalizarCiclo, name='ConfirmacionFinalizarCiclo'),
    path('FinalizarCiclo/<int:id>', views.FinalizarCiclo, name='FinalizarCiclo'),
    path('VerHorarios/', views.VerHorarios, name='VerHorarios'),

]
 No newline at end of file
Loading