Files
paad/consultar_horario.php
2023-08-28 15:26:15 +00:00

137 lines
6.9 KiB
PHP

<?php
require_once 'class/c_login.php';
if (!isset($_SESSION['user']))
die(header('Location: index.php'));
$user = unserialize($_SESSION['user']);
$user->access();
if (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, ['r']);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Consultar horario |
<?= $user->facultad['facultad'] ?>
</title>
<meta charset="utf-8">
<meta http-equiv="content-type" content="text/plain; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<?php include_once "import/html_css_files.php"; ?>
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap/bootstrap.min.js"></script>
<style>
[v-cloak] {
display: none;
}
</style>
</head>
<!-- -->
<body style="display: block;">
<?php
include('include/constantes.php');
include("import/html_header.php");
html_header("Consultar horario", "Sistema de gestión de checador");
?>
<main class="container px-4 mt-4 h-100" id="app" v-cloak @vue:mounted="mounted" style="min-height: 60vh;">
<section id="message"></section>
<? // require('import/periodo.php') ?>
<div class="form-box">
<div class="form-group row">
<label for="profesor" class="col-4 col-form-label">Seleccionar profesor</label>
<div class="col-6">
<div class="form-row justify-content-around align-items-center">
<input id="profesor" name="profesor" class="form-control col-11 mr-1 px-2"
placeholder="Seleccione un profesor" list="dlProfesor" v-model="profesores.search"
@input="horarios.fetch">
<button type="button" class="btn btn-outline-danger btn-sm form-control col ml-auto"
@click="profesores.search = null; horarios.data = []">
<i class="ing-borrar"></i>
</button>
</div>
<datalist id="dlProfesor">
<option v-for="profesor in profesores.data" :key="profesor.profesor_id"
:value="`(${profesor.profesor_clave}) ${profesor.profesor_nombre}`">
</datalist>
</div>
</div>
</div>
<hr>
<div id="btn-excel-horario" class="mb-2 float-right hidden">
<button class="btn btn-outline-secondary " title="Exportar a Excel" v-if="false">
<span class="ing-descarga ing-fw"></span> Exportar a Excel
</button>
</div>
<div class="table-responsive" v-if="horarios.data.length > 0">
<table class="table table-bordered table-sm table-responsive-sm" id="table-horario">
<thead class="thead-dark">
<tr id="headers">
<th scope="col" class="text-center">Hora</th>
<th scope="col" class="text-center">Lunes</th>
<th scope="col" class="text-center">Martes</th>
<th scope="col" class="text-center">Miércoles</th>
<th scope="col" class="text-center">Jueves</th>
<th scope="col" class="text-center">Viernes</th>
<th scope="col" class="text-center" v-if="horarios.structure?.sábado">Sábado</th>
</tr>
</thead>
<tbody id="horario">
<tr v-for="{ hour, block } in horarios.blocks" style="height: 2em;">
<th v-if="block === 0" rowspan="4" scope="row" class="text-center align-middle"
style="width: 6%;">
{{ hour.toString().padStart(2, '0') }}:{{ block === 0 ? '00' :
block.toString().padStart(2,'0') }}
</th>
<td :rowspan="horarios.getHorarioData(hour, block, día)?.bloques ?? 1"
v-for="día in [...Array(horarios.structure?.sábado ? 6 : 5).keys()].map(i => i + 1).filter(día => !horarios.isOccupied(hour, block, día))"
:key="`${hour}-${block}-${día}`"
:class="horarios.getHorarioData(hour, block, día) ? 'bg-light' : ''"
class="align-middle h-100"
:style="`width: ${(100 - 6) / (horarios.structure?.sábado ? 6 : 5)}%;`">
<!-- Content Container -->
<div class="overflow-auto"
:style="`max-height: ${horarios.getHorarioData(hour, block, día)?.bloques * 2}em;
min-height: 2em;
`">
<div v-if="horarios.getHorarioData(hour, block, día)" class="text-center">
<small class="font-weight-bolder font-weight-lighter text-muted">
{{horarios.getHorarioData(hour, block, día)?.facultad}}
</small>
<br>
<div class="my-2">
<small class="text-muted">
{{horarios.getHorarioData(hour, block, día)?.horario_hora.slice(0, 5)}}
</small>
<b style="line-height: 80%;">
{{horarios.getHorarioData(hour, block, día)?.materia}}
</b>
</div>
<small
class="text-muted">{{horarios.getHorarioData(hour,
block, día)?.carrera}}</small>
<br><span>Salón: </span><small
class="font-weight-lighter text-muted">{{horarios.getHorarioData(hour,
block, día)?.salon}}</small>
</div>
<div v-else> &nbsp; </div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</main>
</body>
<? require_once "import/html_footer.php" ?>
<script src="js/scrollables.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/2.0.5/FileSaver.min.js"></script>
<script src="js/horario.js" type="module" defer></script>
</html>