diff --git a/consultar_horario.php b/consultar_horario.php index f3b613a..e4e30ec 100644 --- a/consultar_horario.php +++ b/consultar_horario.php @@ -1,1608 +1,1608 @@ +access(); +if (!$user->admin && in_array($user->acceso, ['n'])) + die(header('Location: main.php?error=1')); + +$user->print_to_log('Consultar horario'); + +$write = $user->admin || in_array($user->acceso, ['w']); +// var_dump($user); +?> + + + + + Consultar horario | <?= $user->facultad['facultad'] ?? 'General' ?> + + + + + + + + access(); - if (!$user->admin && in_array($user->acceso, ['n'])) - die(header('Location: main.php?error=1')); - - $user->print_to_log('Consultar horario'); - - $write = $user->admin || in_array($user->acceso, ['w']); - // var_dump($user); + include('include/constantes.php'); + include("import/html_header.php"); + html_header("Consultar horario", "Sistema de gestión de checador"); ?> - - + " ?> +
+
+ - - Consultar horario | <?= $user->facultad['facultad'] ?? 'General' ?> - - - - - - + +
+
+
+ $user->facultad['facultad_id'], ":per" => $user->periodo], single: false); + // repliaction of the query in the database with database class + $nivel = $db->where('id', $user->periodo)->getOne('fs_periodo'); + $carreras = $db + ->orderBy('carrera') + ->where('facultad', $nivel['facultad_id']) + ->where('nivel', $nivel['nivel_id']) + ->get('fs_carrera', 100, 'id, carrera'); - - - " ?> -
-
- - - - -
-
- $user->facultad['facultad_id'], ":per" => $user->periodo], single: false); - // repliaction of the query in the database with database class - $nivel = $db->where('id', $user->periodo)->getOne('fs_periodo'); - $carreras = $db - ->orderBy('carrera') - ->where('facultad', $nivel['facultad_id']) - ->where('nivel', $nivel['nivel_id']) - ->get('fs_carrera', 100, 'id, carrera'); - - ?> -
- -
-
-
Seleccionar carrera
- -
    - -
  • - -
  • - -
- -
+ ?> +
+ +
+
+
Seleccionar carrera
+ +
    + +
  • + +
  • + +
+
- - - -
- -
-
-
Seleccionar grupo
- -
    -
- -
-
-
- -
- - - -
-
- - - - -
- - - - - - - - - - - - - -
HoraLunesMartesMiércolesJuevesViernesSábado
-
+ -
- - - +
+
+ + + - - - - - + + + + - \ No newline at end of file + btnGuardar.onclick = async () => { + const formData = extractFromModal(); + if (formData == null) + return; + // check if a field is empty + for (const value of formData.values()) + if (value == "") + return triggerMessage("Todos los campos son obligatorios", "Error", "danger", "message_editar", true); + formData.append("facultad", facultad['facultad_id'] ?>); + formData.append("periodo", periodo ?>); + formData.append("grupo", document.querySelector("input#grupo").value); + + await insertHorario(formData); + resetFormModal(); + $("#modal-editar").modal("hide"); + }; + + return; + } + const { + id, + dia, + hora, + materia, + salon, + profesores, + duracion + } = gHorarios?.find(horario => horario.id == parentId); + + // search the data-id of the day and click it + const númeroDía = ['domingo', 'lunes', 'martes', 'miércoles', 'jueves', 'viernes', 'sábado'].reduce((acc, curr, key) => (curr == dia) ? key : acc); + document.querySelector(`#dldia li[data-id="${númeroDía}"]`)?.click(); + document.querySelector(`#dlduración li[data-id="${duracion}"]`)?.click(); + const horas = hora.split(":")[0]; + const minutos = hora.split(":")[1]; + setDatalist("#selector_horas", horas); + setDatalist("#selector_minutos", minutos); + document.getElementById('editor_salón').value = salon; + const input_materia = document.getElementById('dlMateria'); + input_materia.value = materia; + // disable the input + input_materia.setAttribute("disabled", true); + input_materia.classList.add("bg-info"); + + disableDatalist("#dli-grupo") + + // get the option with data-id profesor + document.getElementById("profesores").innerHTML = ""; + profesores.forEach(listProfesor); + + const btnGuardar = document.getElementById('btn-guardar'); + btnGuardar.onclick = () => guardar(id); + }) + $("#modal-borrar").modal({ + show: false, + backdrop: "static", + keyboard: false, + }) + $("#modal-borrar").on("show.bs.modal", async function(event) { + const button = event.relatedTarget; + const id = button.parentElement.parentElement.getAttribute("data-ids"); + + const btnBorrar = document.getElementById('btn-borrar'); + btnBorrar.onclick = () => borrarHorario(id); + }) + + + \ No newline at end of file