|
@@ -1,265 +1,61 @@
|
|
|
-<?php
|
|
|
-require_once 'class/c_login.php';
|
|
|
-require_once 'include/bd_pdo.php';
|
|
|
-include 'include/constantes.php';
|
|
|
-
|
|
|
-if(!isset($_SESSION['user'])){
|
|
|
- header('Location: index.php');
|
|
|
- exit;
|
|
|
-}
|
|
|
-else
|
|
|
- $user = unserialize($_SESSION['user']);
|
|
|
-$user->access();
|
|
|
-if($user->acceso == null){
|
|
|
- header('Location: main.php?error=1');
|
|
|
-}else{
|
|
|
- $user->print_to_log('Avisos');
|
|
|
-}
|
|
|
-$fac = $user->facultad['facultad_id'];
|
|
|
-if($user->admin){
|
|
|
- $fac = null;
|
|
|
-}
|
|
|
-$limit = 20;
|
|
|
-if(isset($_POST['filter_fecha']) && $_POST['filter_fecha'] != ""){
|
|
|
- $filter_fecha = $_POST['filter_fecha'];
|
|
|
-}
|
|
|
-else{
|
|
|
- $filter_fecha = null;
|
|
|
-}
|
|
|
-if(isset($_GET['pag'])){
|
|
|
- $pag = $_GET['pag'] - 1;
|
|
|
-}else{
|
|
|
- $pag = 0;
|
|
|
-}
|
|
|
-if($user->admin){
|
|
|
- $count = query("SELECT count(1) FROM fs_aviso(null, :fecha, :facultad_id, null, 0, null)", [':fecha' => $filter_fecha, ':facultad_id' => $fac], true);
|
|
|
- $fs_avisos = query("SELECT * FROM fs_aviso(null, :fecha, :facultad_id, :limite, :offset, null)", [':fecha' => $filter_fecha, ':facultad_id' => $fac, ':limite' => $limit, ':offset' => $pag * $limit], false);
|
|
|
-}else{
|
|
|
- $count = query("SELECT count(1) FROM fs_aviso(null, :fecha, :facultad_id, null, 0, true)", [':fecha' => $filter_fecha, ':facultad_id' => $fac], true);
|
|
|
- $fs_avisos = query("SELECT * FROM fs_aviso(null, :fecha, :facultad_id, :limite, :offset, true)", [':fecha' => $filter_fecha, ':facultad_id' => $fac, ':limite' => $limit, ':offset' => $pag * $limit], false);
|
|
|
-}
|
|
|
-$paginas = ceil($count['count'] / $limit);
|
|
|
-?>
|
|
|
<!DOCTYPE html>
|
|
|
<html lang="en">
|
|
|
|
|
|
<head>
|
|
|
<meta charset="UTF-8">
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
- <title>Avisos</title>
|
|
|
- <link rel="stylesheet" href="css/jquery-ui.css">
|
|
|
- <link rel="stylesheet" href="css/calendar.css">
|
|
|
+ <title>Auditoría asistencial</title>
|
|
|
<?php
|
|
|
include 'import/html_css_files.php';
|
|
|
?>
|
|
|
+ <style>
|
|
|
+ [v-cloak] {
|
|
|
+ display: none;
|
|
|
+ }
|
|
|
+ </style>
|
|
|
+ <script src="js/jquery.min.js"></script>
|
|
|
+ <script src="js/jquery-ui.js"></script>
|
|
|
+ <script src="js/bootstrap/bootstrap.min.js"></script>
|
|
|
</head>
|
|
|
|
|
|
<body>
|
|
|
- <?php
|
|
|
+ <?
|
|
|
+ $redirect = $_SERVER['PHP_SELF'];
|
|
|
include "import/html_header.php";
|
|
|
+ global $user;
|
|
|
+
|
|
|
html_header(
|
|
|
- "Avisos",
|
|
|
- "Gestión de Checador "
|
|
|
+ "Avisos del checador",
|
|
|
+ "Sistema de gestión de checador",
|
|
|
);
|
|
|
- $user->access();
|
|
|
?>
|
|
|
- <main class="content marco">
|
|
|
- <?php if($user->acceso == 'w') {?>
|
|
|
- <div class="row">
|
|
|
- <div class="col-12 text-right">
|
|
|
- <a href="avisos_crear.php">
|
|
|
- <button type="button" class="btn btn-outline-secondary"><span class="ing-mas ing-fw"></span>Crear Aviso</button>
|
|
|
- </a>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <?php } ?>
|
|
|
- <!-- Filtro -->
|
|
|
- <div class="row">
|
|
|
- <div class="col-12">
|
|
|
- <form action="avisos.php" method="post">
|
|
|
- <div class="form-box">
|
|
|
- <div class="form-group row">
|
|
|
- <label for="filter_fecha" class="col-4 con-form-label">Fecha</label>
|
|
|
- <div class="col-8 col-sm-4">
|
|
|
- <input id="filter_fecha" name="filter_fecha" type="text" class="form-control date-picker" placeholder="dd/mm/aaaa" maxlength="10" required="required" readonly="" value="<?php if(isset($filter_fecha)){ echo $filter_fecha; } ?>">
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <p class="offset-4">Se muestran los avisos posteriores a la fecha</p>
|
|
|
- </div>
|
|
|
- <div class="form-group">
|
|
|
- <div class="col-12 text-center">
|
|
|
- <button type="submit" class="btn btn-outline-primary">
|
|
|
- <span class="ing-buscar ing-fw"></span>
|
|
|
- Filtrar
|
|
|
- </button>
|
|
|
- <button type="button" class="btn btn-outline-danger btn-reset">
|
|
|
- <span class="ing-borrar ing-fw"></span>
|
|
|
- Limpiar
|
|
|
- </button>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </form>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div id="message"></div>
|
|
|
- <!-- Tabla -->
|
|
|
- <div class="row">
|
|
|
- <div class="col-12 table-responsive">
|
|
|
- <table class="table table-sm table-striped table-white">
|
|
|
- <thead class="thead-dark">
|
|
|
- <tr>
|
|
|
- <th>Estado</th>
|
|
|
- <?php if($user->acceso == 'w') {?>
|
|
|
- <th>Facultad</th>
|
|
|
- <?php }?>
|
|
|
- <th>Fechas</th>
|
|
|
- <th>Mensaje</th>
|
|
|
- <?php if($user->acceso == 'w') {?>
|
|
|
- <th>Acciones</th>
|
|
|
- <?php }?>
|
|
|
- </tr>
|
|
|
- </thead>
|
|
|
- <tbody>
|
|
|
- <?php $today = date('Y-m-j');
|
|
|
- foreach($fs_avisos as $aviso){
|
|
|
- $color2 = 'danger';
|
|
|
- $title2 = 'Inactivo';
|
|
|
- $color = 'danger';
|
|
|
- $title = 'Fuera de tiempo';
|
|
|
- $icono = 'retardo';
|
|
|
- if($today >= $aviso['aviso_fecha_inicial'] && $today <= $aviso['aviso_fecha_final']){
|
|
|
- $color = 'success';
|
|
|
- $title = 'En tiempo';
|
|
|
- $icono = 'reloj';
|
|
|
- }else if($today < $aviso['aviso_fecha_inicial']){
|
|
|
- $color = 'warning';
|
|
|
- $title = 'Antes de tiempo';
|
|
|
- }
|
|
|
- if($aviso['aviso_estado'] == true){
|
|
|
- $color2 = 'success';
|
|
|
- $title2 = 'Activo';
|
|
|
- }
|
|
|
- $day = explode("-", $aviso['aviso_fecha_inicial']);
|
|
|
- $dia_inicial = $day['2'].'/'.$day['1'].'/'.$day[0];
|
|
|
- $day = explode("-", $aviso['aviso_fecha_final']);
|
|
|
- $dia_final = $day['2'].'/'.$day['1'].'/'.$day[0];
|
|
|
- ?>
|
|
|
- <tr data-id="<?= $aviso['aviso_id'] ?>" id="<?= $aviso['aviso_id'] ?>">
|
|
|
- <td class="text-center"><?php if($user->admin){ ?> <span class="ing-bullet text-<?= $color2 ?>" title="<?= $title2 ?>"></span> <?php } ?> <span class="ing-<?= $icono ?> text-<?= $color ?>" title="<?= $title ?>"></span></td>
|
|
|
- <?php if($user->acceso == 'w') {?>
|
|
|
- <td><?= $aviso['facultad_nombre'] ?></td>
|
|
|
- <?php }?>
|
|
|
- <td><?= $dia_inicial ?> - <?= $dia_final ?></td>
|
|
|
- <td><?= $aviso['aviso_texto'] ?></td>
|
|
|
- <?php if($user->acceso == 'w') {?>
|
|
|
- <td class="text-center">
|
|
|
- <a href="avisos_editar.php?id=<?= $aviso['aviso_id'] ?>" title="Editar"><span class="ing-editar"></span></a>
|
|
|
- <?php if($aviso['aviso_estado'] == true){ ?>
|
|
|
- <a href="#" data-toggle="modal" data-target="#modal_confirm" title="Borrar"><span class="ing-basura"></span></a>
|
|
|
- <?php } ?>
|
|
|
- </td>
|
|
|
- <?php }?>
|
|
|
- </tr>
|
|
|
- <?php } ?>
|
|
|
- </tbody>
|
|
|
- </table>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <nav aria-label="paginas">
|
|
|
- <ul class="pagination justify-content-end">
|
|
|
- <?php if($pag != 0){ ?>
|
|
|
- <li class="page-item">
|
|
|
- <a class="page-link" href="avisos.php?pag=<?= $pag ?>" aria-label="Previous">
|
|
|
- <span aria-hidden="true">«</span>
|
|
|
- </a>
|
|
|
- </li>
|
|
|
- <?php } ?>
|
|
|
- <?php for($i = 0; $i < $paginas; $i++){ ?>
|
|
|
- <li class="page-item <?php if($i == $pag){ echo"active"; } ?>" <?php if($i == $pag){ echo 'aria-current="page"'; } ?>><a class="page-link" href="avisos.php?pag=<?= $i+1 ?>"><?= $i+1 ?></a></li>
|
|
|
|
|
|
- <?php }
|
|
|
- if(($pag + 1) < $paginas){ ?>
|
|
|
- <li class="page-item">
|
|
|
- <a class="page-link" href="avisos.php?pag=<?= $pag + 2 ?>" aria-label="Next">
|
|
|
- <span aria-hidden="true">»</span>
|
|
|
- </a>
|
|
|
- </li>
|
|
|
- <?php } ?>
|
|
|
- </ul>
|
|
|
- </nav>
|
|
|
+ <main class="container-fluid px-4 mt-4" id="app" v-cloak @vue:mounted="mounted" style="min-height: 70vh;">
|
|
|
+ <div class="table-responsive">
|
|
|
+ <table class="table table-hover table-striped table-bordered table-sm">
|
|
|
+ <thead class="thead-dark">
|
|
|
+ <tr>
|
|
|
+ <th class="text-center">Fecha</th>
|
|
|
+ <th class="text-center">Aviso</th>
|
|
|
+ <th class="text-center">Estado</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+
|
|
|
+ <tbody>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
</main>
|
|
|
- <?php
|
|
|
- include "import/html_footer.php";
|
|
|
- ?>
|
|
|
|
|
|
- <?php if($user->acceso == 'w') {?>
|
|
|
- <div class="modal fade" id="modal_confirm" tabindex="-1" role="dialog" aria-labelledby="modal" aria-hidden="true">
|
|
|
- <div class="modal-dialog modal-dialog-centered" role="document">
|
|
|
- <div class="modal-content">
|
|
|
- <div class="modal-body">
|
|
|
- <div class="row">
|
|
|
- <div class="col">
|
|
|
- <p class="font-weight-bold">¿Estás seguro de que quieres borrar el aviso?</p>
|
|
|
- <p>Esta acción no se puede deshacer.</p>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="modal-footer">
|
|
|
- <input type="hidden" id="id_borrar" value="">
|
|
|
- <button type="button" class="btn btn-outline-primary btn-borrar"><?php echo $ICO["aceptar"];?> Borrar</button>
|
|
|
- <button type="button" class="btn btn-outline-danger" data-dismiss="modal" aria-label="Close"><?php echo $ICO["cancelar"];?> Cancelar</button>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <?php } ?>
|
|
|
+ <? include "import/html_footer.php"; ?>
|
|
|
|
|
|
<script src="js/jquery.min.js"></script>
|
|
|
<script src="js/jquery-ui.js"></script>
|
|
|
<script src="js/bootstrap/bootstrap.min.js"></script>
|
|
|
<script src="js/datalist.js"></script>
|
|
|
<script src="js/datepicker-es.js"></script>
|
|
|
- <?php
|
|
|
- require_once 'js/messages.php';
|
|
|
- ?>
|
|
|
- <script>
|
|
|
- var today = new Date();
|
|
|
- $(".date-picker").datepicker($.datepicker.regional["es"]);
|
|
|
- $(".date-picker").datepicker({
|
|
|
- dateFormat: "dd/mm/yyyy",
|
|
|
- changeMonth: true,
|
|
|
- });
|
|
|
-
|
|
|
- $(document).on( "click", ".btn-reset", function(event){
|
|
|
- var forma = $(this).parents("form");
|
|
|
- forma.find("input[type=text]").val("");
|
|
|
- forma.find("select").prop("selectedIndex",0);
|
|
|
- forma.submit();
|
|
|
- });
|
|
|
-
|
|
|
- $('#modal_confirm').on('show.bs.modal', function (event) {
|
|
|
- var button = $(event.relatedTarget); // Button that triggered the modal
|
|
|
- var id = button.parents("tr").data("id");
|
|
|
- $("#id_borrar").val(id);
|
|
|
- });
|
|
|
-
|
|
|
- $('.btn-borrar').click(function(){
|
|
|
- var cid = $('#id_borrar').val();
|
|
|
- $.ajax({
|
|
|
- url: './action/action_avisos_delete.php',
|
|
|
- type: 'POST',
|
|
|
- dataType: 'json',
|
|
|
- data: {id: cid},
|
|
|
- success: function(result){
|
|
|
- console.log("bien");
|
|
|
- },
|
|
|
- error: function(){
|
|
|
- console.log(cid);
|
|
|
- }
|
|
|
- });
|
|
|
- $('#modal_confirm').modal("hide");
|
|
|
- location.reload();
|
|
|
- });
|
|
|
- </script>
|
|
|
+ <script src="js/avisos.js?<?= rand(0, 2) ?>" type="module"></script>
|
|
|
+ <script src="js/scrollables.js"></script>
|
|
|
</body>
|
|
|
+
|
|
|
</html>
|