Stable
This commit is contained in:
@@ -22,7 +22,7 @@ try {
|
||||
}
|
||||
});
|
||||
|
||||
$data = $db->query("SELECT *, horario_view.facultad_id FROM registro
|
||||
$data = $db->query("SELECT *, horario_view.facultad_id, horario_view.periodo_id FROM registro
|
||||
JOIN horario_view USING (horario_id)
|
||||
LEFT JOIN estado_supervisor USING (estado_supervisor_id)
|
||||
LEFT JOIN profesor USING (profesor_id)
|
||||
|
||||
@@ -14,12 +14,11 @@
|
||||
* Success:
|
||||
* Redirecciona a inicio.php
|
||||
*/
|
||||
include_once("../include/nocache.php"); //continue on error
|
||||
include_once "../include/nocache.php"; //continue on error
|
||||
$ruta = "../";
|
||||
require_once("../include/bd_pdo.php"); //die on error
|
||||
require_once("../class/c_login.php");
|
||||
require_once("../include/util.php");
|
||||
require_once("../include/nusoap/nusoap.php");
|
||||
require_once "../include/bd_pdo.php"; //die on error
|
||||
require_once "../class/c_login.php";
|
||||
require_once "../include/util.php";
|
||||
|
||||
if (!isset($_POST["username"]) || !isset($_POST["passwd"]))
|
||||
die(header("Location: ../index.php?error=0"));
|
||||
|
||||
@@ -32,7 +32,7 @@ try {
|
||||
'INSERT INTO registro (profesor_id, horario_id, registro_fecha_supervisor, estado_supervisor_id, registro_fecha_ideal, supervisor_id, comentario)
|
||||
VALUES' .
|
||||
implode(',', array_map(fn($x) => "({$x['profesor_id']} , {$x['horario_id']}, NOW()," . (is_null($x['estado']) ? 'null' : $x['estado']) . ", NOW(), {$x['supervisor_id']}," . (empty($x['comentario']) ? 'null' : "'{$x['comentario']}'") . ')', $post_data))
|
||||
. ' ON CONFLICT (profesor_id, horario_id, registro_fecha_ideal) DO UPDATE SET estado_supervisor_id = EXCLUDED.estado_supervisor_id, registro_fecha_supervisor = NOW(), comentario = EXCLUDED.comentario
|
||||
. ' ON CONFLICT (profesor_id, horario_id, registro_fecha_ideal) DO UPDATE SET estado_supervisor_id = EXCLUDED.estado_supervisor_id, registro_fecha_supervisor = NOW(), comentario = EXCLUDED.comentario, supervisor_id = EXCLUDED.supervisor_id
|
||||
RETURNING *'
|
||||
);
|
||||
echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
|
||||
|
||||
@@ -9,7 +9,7 @@ $universidad_la_salle = $db
|
||||
|
||||
$rutas =
|
||||
array_map(
|
||||
function (&$ruta) use ($db) {
|
||||
function ($ruta) use ($db) {
|
||||
$ruta['subrutas'] =
|
||||
$db
|
||||
->where('id_espacio_padre', $ruta['id_espacio_sgu'])
|
||||
|
||||
@@ -24,17 +24,16 @@
|
||||
"Registro de asistencia - Vicerrectoría Académica",
|
||||
"Sistema de gestión de checador",
|
||||
);
|
||||
|
||||
#include "import/periodo.php";
|
||||
?>
|
||||
|
||||
<main class="container-fluid px-4 mt-4" id="app" v-cloak @vue:mounted="mounted">
|
||||
<form action="">
|
||||
<?php include "import/periodo.php" ?>
|
||||
<div class="form-box">
|
||||
<div class="form-group row">
|
||||
<label for="periodo" class="col-4 col-form-label">Facultad</label>
|
||||
<label for="dlFacultad" class="col-4 col-form-label">Facultad</label>
|
||||
<div class="col-6">
|
||||
<div id="dlPeriodo" class="datalist datalist-select mb-1 w-100">
|
||||
<div id="dlFacultad" class="datalist datalist-select mb-1 w-100">
|
||||
<div class="datalist-input">Selecciona una facultad</div>
|
||||
<span class="ing-buscar icono"></span>
|
||||
<ul style="display:none">
|
||||
@@ -82,6 +81,40 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row" v-if="store.bloques_horario.data.length > 0">
|
||||
<label for="dlBloqueHorarios" class="col-4 col-form-label">Bloque horarios</label>
|
||||
<div class="col-6">
|
||||
<div id="dlBloqueHorarios" class="datalist datalist-select mb-1 w-100">
|
||||
<div class="datalist-input">
|
||||
{{ store.bloques_horario.data.find(bloque => bloque.selected).hora_inicio.substr(0,5)
|
||||
}} -
|
||||
{{ store.bloques_horario.data.find(bloque => bloque.selected).hora_fin.substr(0,5) }}
|
||||
</div>
|
||||
<span class="ing-buscar icono"></span>
|
||||
<ul style="display:none">
|
||||
<li class="datalist-option not-selectable">
|
||||
Mañana
|
||||
</li>
|
||||
|
||||
<li class="datalist-option" :class="{selected: bloque.selected}"
|
||||
v-for="bloque in store.bloques_horario.data.filter(bloque => bloque.hora_inicio < '13:00:00')"
|
||||
:key="bloque.id" :data-id="bloque.id" @click="store.filters.bloque_horario = bloque.id">
|
||||
{{ bloque.hora_inicio.substr(0,5) }} - {{ bloque.hora_fin.substr(0,5) }}
|
||||
</li>
|
||||
<li class="datalist-option not-selectable">
|
||||
Tarde
|
||||
</li>
|
||||
<li class="datalist-option" :class="{selected: bloque.selected}"
|
||||
v-for="bloque in store.bloques_horario.data.filter(bloque => bloque.hora_inicio >= '13:00:00')"
|
||||
:key="bloque.id" :data-id="bloque.id" @click="store.filters.bloque_horario = bloque.id">
|
||||
{{ bloque.hora_inicio.substr(0,5) }} - {{ bloque.hora_fin.substr(0,5) }}
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
<input type="hidden" id="bloque_id" name="id">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="profesor" class="col-4 col-form-label">Profesor</label>
|
||||
<div class="col-6">
|
||||
@@ -101,10 +134,10 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="periodo" class="col-4 col-form-label">Asistencia</label>
|
||||
<label for="dlAsistencia" class="col-4 col-form-label">Asistencia</label>
|
||||
<div class="col-6">
|
||||
<div class="form-row justify-content-around align-items-center">
|
||||
<div id="dlPeriodo" class="datalist datalist-select mb-1 w-100">
|
||||
<div id="dlAsitencia" class="datalist datalist-select mb-1 w-100">
|
||||
<div class="datalist-input" id="estados">Selecciona un estado de asistencia</div>
|
||||
<span class="ing-buscar icono"></span>
|
||||
<ul style="display:none">
|
||||
@@ -128,6 +161,16 @@
|
||||
|
||||
</form>
|
||||
<div class="mt-3 d-flex justify-content-center flex-wrap">
|
||||
<!-- botón descargar -->
|
||||
|
||||
<div class="btn-group my-3" v-if="registros.relevant.length">
|
||||
<button type="button" class="btn btn-info mr-3" @click="registros.descargar"
|
||||
:disabled="!registros.relevant.length">
|
||||
<i class="ing-descarga"></i>
|
||||
Descargar reporte
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- refresh -->
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover table-striped table-bordered table-sm">
|
||||
@@ -369,8 +412,10 @@
|
||||
<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/datalist.js"></script> -->
|
||||
<script src="js/datepicker-es.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/2.0.5/FileSaver.min.js"></script>
|
||||
|
||||
<script src="js/auditoría.js" type="module"></script>
|
||||
</body>
|
||||
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
<?php
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
date_default_timezone_set('America/Mexico_City');
|
||||
$currentTime = time();
|
||||
$endOfDay = strtotime('tomorrow') - 1;
|
||||
$remainingTime = $endOfDay - $currentTime;
|
||||
|
||||
session_set_cookie_params($remainingTime, '/', $_SERVER['HTTP_HOST'], false, true);
|
||||
session_start();
|
||||
|
||||
require_once($ruta ?? '') . "include/bd_pdo.php";
|
||||
require_once($ruta ?? '') . "class/c_logasistencia.php";
|
||||
require_once($ruta ?? '') . "include/nusoap/nusoap.php";
|
||||
require_once($ruta ?? '') . "vendor/autoload.php";
|
||||
|
||||
|
||||
session_start();
|
||||
class Login
|
||||
{
|
||||
public string $acceso;
|
||||
@@ -28,13 +33,16 @@ class Login
|
||||
}
|
||||
public function access(string $pagina = null): void
|
||||
{
|
||||
|
||||
global $db;
|
||||
|
||||
if ($this->admin) {
|
||||
$this->acceso = "w";
|
||||
return;
|
||||
}
|
||||
|
||||
# print_r( $access );
|
||||
$this->acceso = query(
|
||||
$this->acceso = $db->query(
|
||||
'SELECT tipo FROM PERMISO_VIEW WHERE ID = :usr AND PAGINA_RUTA ILIKE :ruta',
|
||||
array(
|
||||
':usr' => $this->user["id"],
|
||||
@@ -49,18 +57,22 @@ class Login
|
||||
private static function validaUsuario($user, $pass): bool
|
||||
{
|
||||
file_put_contents('php://stderr', $user);
|
||||
if (in_array($user, ['ad017045']) and $pass == "admin")
|
||||
if ($user == 'ad017045' and $pass == "admin")
|
||||
return true;
|
||||
|
||||
$client = new nusoap_client('http://200.13.89.2/validacion.php?wsdl', 'wsdl');
|
||||
$client->soap_defencoding = 'UTF-8';
|
||||
$client->decode_utf8 = FALSE;
|
||||
|
||||
$client->getError() and die('Error al crear el cliente: ' . $client->getError());
|
||||
$pass = utf8_decode($pass);
|
||||
// $pass = utf8_decode($pass);
|
||||
$result = $client->call("valida_user", array($user, $pass));
|
||||
$client->fault and die('Error al llamar al servicio: ' . $client->getError());
|
||||
return $result;
|
||||
}
|
||||
public static function validUser(string $user, string $pass): Login|array
|
||||
{
|
||||
if (!Login::validaUsuario($user, $pass)) {
|
||||
if (Login::validaUsuario($user, $pass) === false) {
|
||||
return [
|
||||
'error' => true,
|
||||
'msg' => 'Error al autenticar usuario'
|
||||
@@ -78,6 +90,7 @@ class Login
|
||||
$user = array(
|
||||
'id' => $fs_validaclaveulsa["id"],
|
||||
'nombre' => $fs_validaclaveulsa["nombre"],
|
||||
'clave' => $db->where('usuario_id', $fs_validaclaveulsa["id"])->getOne("usuario")["usuario_clave"]
|
||||
);
|
||||
$facultad = array(
|
||||
'facultad_id' => $fs_validaclaveulsa["facultad_id"],
|
||||
@@ -98,24 +111,24 @@ class Login
|
||||
$periodo = $fs_validaclaveulsa["periodo_id"];
|
||||
|
||||
return new Login($user, $facultad, $rol, $admin, $periodo, $supervisor, $jefe_carrera, false);
|
||||
} else if ($db->where('profesor_clave', preg_replace('/^do0*/', '', $user))->has("profesor")) {
|
||||
$profesor = $db->where('profesor_clave', preg_replace('/^do0*/', '', $user))->getOne("profesor");
|
||||
} else if ($db->where('profesor_clave', preg_replace('/^do0*/', '', $user), 'ilike')->has("profesor")) {
|
||||
$profesor = $db->where('profesor_clave', preg_replace('/^do0*/', '', $user), 'ilike')->getOne("profesor");
|
||||
$user = array(
|
||||
'id' => $profesor["profesor_clave"],
|
||||
'nombre' => $profesor["profesor_nombre"],
|
||||
);
|
||||
$facultad = $rol = array(
|
||||
$facultad = array(
|
||||
'facultad_id' => null,
|
||||
'facultad' => 'Docente',
|
||||
'facultad' => null,
|
||||
);
|
||||
$rol = array(
|
||||
'id' => null,
|
||||
'rol' => 'Docente'
|
||||
);
|
||||
|
||||
$supervisor = false;
|
||||
$jefe_carrera = false;
|
||||
$admin = false;
|
||||
$periodo = null;
|
||||
// CREATE A COOKIE FOR THE REST OF THE day for example: 23:00 then duration will be 1 hour
|
||||
setcookie("profesor", $user["id"], strtotime('today midnight') + 86400, "/");
|
||||
return new Login($user, $facultad, $rol, $admin, $periodo, $supervisor, $jefe_carrera, true);
|
||||
return new Login($user, $facultad, $rol, admin: false, periodo: null, supervisor: false, jefe_carrera: false, profesor: true);
|
||||
} else
|
||||
return [
|
||||
'error' => true,
|
||||
|
||||
@@ -14,17 +14,15 @@ if (!isset($_SESSION['user'])) {
|
||||
}
|
||||
|
||||
$user = unserialize($_SESSION['user']);
|
||||
if ($user->admin):
|
||||
?><!-- <pre><? var_dump($user) ?></pre> -->
|
||||
<?
|
||||
endif;
|
||||
$grupos = $user->admin ? queryAll("SELECT * FROM GRUPO ORDER BY grupo_nombre") : $db->query("SELECT * FROM GRUPO WHERE grupo_id IN (SELECT grupo_id FROM PERMISO_VIEW WHERE id = :id) ORDER BY grupo_nombre", array(":id" => $user->user['id']));
|
||||
|
||||
function html_header($title, $header = null)
|
||||
{
|
||||
global $user;
|
||||
$grupos = queryAll("SELECT * FROM GRUPO ORDER BY grupo_nombre");
|
||||
|
||||
if ($user->admin)
|
||||
$paginas = queryAll("SELECT * FROM pagina ORDER BY pagina_ruta");
|
||||
else
|
||||
$paginas = queryAll("SELECT * FROM PERMISO_VIEW WHERE id = :id ORDER BY pagina_ruta", array(":id" => $user->user['id']));
|
||||
|
||||
global $grupos, $user, $db;
|
||||
?>
|
||||
<aside id="sidebar" class="bg-light defaultShadow d-flex flex-column p-4">
|
||||
<div class="d-flex align-items-center mb-5">
|
||||
@@ -65,39 +63,31 @@ function html_header($title, $header = null)
|
||||
</a>
|
||||
</p>
|
||||
<?php }
|
||||
$cont = 0;
|
||||
foreach ($grupos as $grupo) {
|
||||
foreach ($grupos as $key => $grupo) {
|
||||
?>
|
||||
<p class="mb-0 mt-3">
|
||||
<a class="d-block side-menu collapsed" data-toggle="collapse" href="#menu_<?= $cont ?>" role="button"
|
||||
<a class="d-block side-menu collapsed" data-toggle="collapse" href="#menu_<?= $key ?>" role="button"
|
||||
aria-expanded="false">
|
||||
<i class="ing-caret ing-fw mr-2"></i>
|
||||
<span class="<?= $grupo['grupo_icon'] ?>"></span>
|
||||
<?= ucfirst($grupo['grupo_nombre']) ?>
|
||||
</a>
|
||||
</p>
|
||||
<div id="menu_<?= $cont ?>" class="collapse" data-parent="#accordionMenu" style>
|
||||
<div id="menu_<?= $key ?>" class="collapse" data-parent="#accordionMenu" style>
|
||||
<ul class="fa-ul">
|
||||
<?php
|
||||
foreach ($paginas as $pagina) {
|
||||
#print_r($paginas);
|
||||
$page = ucfirst(str_replace('_', ' ', $pagina['pagina_ruta']));
|
||||
$user->access($pagina['pagina_ruta'] ?? '');
|
||||
if ($grupo['grupo_id'] == $pagina['grupo_id']) {
|
||||
if ($user->admin || $user->acceso != 'n') {
|
||||
<?
|
||||
foreach ($user->admin ? $db->query("SELECT * FROM PAGINA WHERE grupo_id = :grupo_id ORDER BY pagina_titulo", array(":grupo_id" => $grupo['grupo_id'])) : $db->query("SELECT * FROM PAGINA WHERE grupo_id = :grupo_id and pagina_id IN (SELECT pagina_id FROM PERMISO_VIEW WHERE id = :id) ORDER BY pagina_titulo", array(":grupo_id" => $grupo['grupo_id'], ":id" => $user->user['id']))
|
||||
as $pagina):
|
||||
?>
|
||||
<li class="mt-1">
|
||||
<a href="<?= $pagina['pagina_ruta'] ?>.php">
|
||||
<?= $page ?>
|
||||
<?= $pagina['pagina_titulo'] ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php }
|
||||
}
|
||||
}
|
||||
?>
|
||||
<? endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php $cont++;
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
@@ -156,5 +146,4 @@ function html_header($title, $header = null)
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php }
|
||||
?>
|
||||
<? } ?>
|
||||
@@ -6,8 +6,7 @@ function html_header($title, $header = null, $links = [])
|
||||
<nav class="navbar sticky-top navbar-light bg-white">
|
||||
<header class="container-fluid">
|
||||
<div class="menu">
|
||||
<a class="navbar-brand" href="/"><img id="logo" src="imagenes/logo_lasalle.png" border="0" class="img-fluid" /></a>
|
||||
|
||||
<a class="navbar-brand" href="/"><img id="logo" src="imagenes/logo_lasalle.png" class="img-fluid" /></a>
|
||||
</div>
|
||||
</header>
|
||||
</nav>
|
||||
|
||||
@@ -34,14 +34,15 @@
|
||||
'SELECT * FROM fs_periodo(NULL, :nivel, 4)',
|
||||
[':nivel' => $nivel['nivel_id']]
|
||||
);
|
||||
foreach ($periodos_rs as $per) {
|
||||
array_walk($periodos_rs, function ($per) {
|
||||
global $user;
|
||||
?>
|
||||
<li data-id="<?= $per['periodo_id'] ?>" <?php if ($user->periodo == $per["periodo_id"]) {
|
||||
echo 'class="selected"';
|
||||
} ?>>
|
||||
<?= $per['periodo_nombre'] ?>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php }); ?>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
<input type="hidden" id="periodo" name="id" value="">
|
||||
@@ -54,11 +55,11 @@
|
||||
</form>
|
||||
|
||||
<script src="./js/datalist.js"></script>
|
||||
<script>
|
||||
<script defer>
|
||||
setDatalist('#periodo', <?php echo $user->periodo; ?>)
|
||||
makeRequiredDatalist("#periodo", true);
|
||||
|
||||
$(document).on('click', '#dlPeriodo ul li', function () {
|
||||
$(document).on('click', '#dlPeriodo ul li:not(.not-selectable)', function () {
|
||||
$('#formaPeriodo').submit();
|
||||
});
|
||||
</script>
|
||||
Binary file not shown.
@@ -20,6 +20,7 @@ const store = reactive({
|
||||
fecha_inicio: null,
|
||||
fecha_fin: null,
|
||||
profesor: null,
|
||||
bloque_horario: null,
|
||||
estados: [],
|
||||
switchFecha: false,
|
||||
switchFechas() {
|
||||
@@ -65,6 +66,16 @@ const store = reactive({
|
||||
document.querySelector('#estados').innerHTML = `Todos los registros`;
|
||||
}
|
||||
},
|
||||
bloques_horario: {
|
||||
data: [],
|
||||
async fetch() {
|
||||
this.data = [];
|
||||
const res = await fetch('action/action_grupo_horario.php');
|
||||
this.data = await res.json();
|
||||
if (this.data.every((bloque) => !bloque.selected))
|
||||
this.data[0].selected = true;
|
||||
},
|
||||
},
|
||||
toggle(arr, element) {
|
||||
const newArray = arr.includes(element) ? arr.filter((item) => item !== element) : [...arr, element];
|
||||
// if all are selected, then unselect all
|
||||
@@ -135,12 +146,28 @@ createApp({
|
||||
if (store.filters[filtro].length === 0)
|
||||
return true;
|
||||
return store.filters[filtro].includes(registro.estado_supervisor_id);
|
||||
case 'bloque_horario':
|
||||
const bloque = store.bloques_horario.data.find((bloque) => bloque.id === store.filters[filtro]);
|
||||
return registro.horario_hora <= bloque.hora_fin && registro.horario_fin >= bloque.hora_inicio;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
async descargar() {
|
||||
if (this.relevant.length === 0)
|
||||
return;
|
||||
const res = await fetch('export/supervisor_excel.php', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(this.relevant)
|
||||
});
|
||||
const blob = await res.blob();
|
||||
window.saveAs(blob, `auditoria_${new Date().toISOString().slice(0, 10)}.xlsx`);
|
||||
}
|
||||
},
|
||||
get profesores() {
|
||||
return this.registros.data.map((registro) => ({
|
||||
@@ -155,6 +182,8 @@ createApp({
|
||||
await this.registros.fetch();
|
||||
await store.facultades.fetch();
|
||||
await store.estados.fetch();
|
||||
await store.bloques_horario.fetch();
|
||||
store.filters.bloque_horario = store.bloques_horario.data.find((bloque) => bloque.selected)?.id;
|
||||
store.filters.switchFechas();
|
||||
}
|
||||
}).mount('#app');
|
||||
|
||||
65
main.php
65
main.php
@@ -37,7 +37,7 @@ $user = unserialize($_SESSION['user']);
|
||||
<?= $user->user['nombre']; ?>
|
||||
</b>
|
||||
<i>
|
||||
<?= $user->facultad['facultad'] ?? "General"; ?>
|
||||
<?= $user->facultad['facultad']; ?>
|
||||
</i>
|
||||
<small>
|
||||
<?= $user->rol['rol']; ?>
|
||||
@@ -45,52 +45,39 @@ $user = unserialize($_SESSION['user']);
|
||||
</h3>
|
||||
<hr>
|
||||
<div class="d-flex justify-content-center align-items-center flex-wrap">
|
||||
<?php
|
||||
$has_token = $db->querySingle("SELECT FALSE") or die($db->getLastError());
|
||||
if (array_pop($has_token)) {
|
||||
<?
|
||||
foreach ($grupos as $grupo) {
|
||||
$paginas = $user->admin
|
||||
? $db->query("SELECT * FROM PAGINA WHERE grupo_id = :grupo_id ORDER BY pagina_titulo ASC", array(":grupo_id" => $grupo['grupo_id']))
|
||||
: $db->query(
|
||||
"SELECT * FROM PAGINA WHERE pagina_id IN (SELECT pagina_id FROM PERMISO_VIEW WHERE grupo_id = :grupo_id and id = :id) ORDER BY pagina_titulo",
|
||||
array(":grupo_id" => $grupo['grupo_id'], ":id" => $user->user['id'])
|
||||
);
|
||||
?>
|
||||
<h3 class="text-center mt-3 w-100">
|
||||
<b>
|
||||
<?= ucfirst($grupo['grupo_nombre']) ?>
|
||||
</b>
|
||||
</h3>
|
||||
<br>
|
||||
<?
|
||||
|
||||
foreach ($paginas as $pagina) {
|
||||
?>
|
||||
<div class="movie card col-10 col-md-3 border-primary border-3 m-2">
|
||||
<div class="card-body text-center bg-light">
|
||||
<a href="http://200.13.89.27/checador_otros/main"
|
||||
class="card-link text-decoration-none text-primary d-flex flex-column align-items-center">
|
||||
<i class="fa fa-clock" aria-hidden="true"></i>
|
||||
<h5 class="card-title mt-2">Checador</h5>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<div class="card col-10 col-md-3 border-primary border-3 m-2 disabled bg-dark">
|
||||
<div class="card-body text-center disabled">
|
||||
<a href="#"
|
||||
class="card-link text-decoration-none text-primary d-flex flex-column align-items-center disabled text-danger">
|
||||
<i class="ing-cancelar" aria-hidden="true"></i>
|
||||
<h5 class="card-title mt-2">Checador</h5>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<div class="movie card col-10 col-md-3 border-primary border-3 m-2">
|
||||
<div class="card-body text-center bg-light">
|
||||
<a href="#"
|
||||
class="card-link text-decoration-none text-primary d-flex flex-column align-items-center">
|
||||
<i class="fa fa-calendar" aria-hidden="true"></i>
|
||||
<h5 class="card-title mt-2">Mis horarios</h5>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="movie card col-10 col-md-3 border-primary border-3 m-2">
|
||||
<div class="card-body text-center bg-light">
|
||||
<a href="#"
|
||||
<a href="<?= $pagina['pagina_ruta'] ?>.php"
|
||||
class="card-link text-decoration-none text-primary d-flex flex-column align-items-center">
|
||||
<i class="fa fa-table" aria-hidden="true"></i>
|
||||
<h5 class="card-title mt-2">Mis asistencias</h5>
|
||||
<h5 class="card-title mt-2">
|
||||
<?= $pagina['pagina_titulo']; ?>
|
||||
</h5>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<?
|
||||
}
|
||||
} ?>
|
||||
</div>
|
||||
</main>
|
||||
<?php
|
||||
|
||||
13
package-lock.json
generated
13
package-lock.json
generated
@@ -13,6 +13,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/bootstrap": "^5.2.6",
|
||||
"@types/file-saver": "^2.0.5",
|
||||
"@types/jquery": "^3.5.14",
|
||||
"@types/node": "^20.2.1"
|
||||
}
|
||||
@@ -35,6 +36,12 @@
|
||||
"@popperjs/core": "^2.9.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/file-saver": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/file-saver/-/file-saver-2.0.5.tgz",
|
||||
"integrity": "sha512-zv9kNf3keYegP5oThGLaPk8E081DFDuwfqjtiTzm6PoxChdJ1raSuADf2YGCVIyrSynLrgc8JWv296s7Q7pQSQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/jquery": {
|
||||
"version": "3.5.14",
|
||||
"resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.5.14.tgz",
|
||||
@@ -180,6 +187,12 @@
|
||||
"@popperjs/core": "^2.9.2"
|
||||
}
|
||||
},
|
||||
"@types/file-saver": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/file-saver/-/file-saver-2.0.5.tgz",
|
||||
"integrity": "sha512-zv9kNf3keYegP5oThGLaPk8E081DFDuwfqjtiTzm6PoxChdJ1raSuADf2YGCVIyrSynLrgc8JWv296s7Q7pQSQ==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/jquery": {
|
||||
"version": "3.5.14",
|
||||
"resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.5.14.tgz",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"devDependencies": {
|
||||
"@types/bootstrap": "^5.2.6",
|
||||
"@types/file-saver": "^2.0.5",
|
||||
"@types/jquery": "^3.5.14",
|
||||
"@types/node": "^20.2.1"
|
||||
},
|
||||
|
||||
@@ -182,7 +182,7 @@
|
||||
|
||||
</td>
|
||||
<td class="text-center align-middle">
|
||||
{{ clase.hora_inicio.slice(0, 5) }} - {{ clase.hora_fin.slice(0, 5) }}
|
||||
{{ clase.horario_hora.slice(0, 5) }} - {{ clase.horario_fin.slice(0, 5) }}
|
||||
</td>
|
||||
<td class="text-center align-middle text-nowrap">
|
||||
<!-- data-toggle="button" -->
|
||||
@@ -347,7 +347,7 @@
|
||||
<div class="modal-dialog modal-dialog-centered modal-xl" v-if="clase_vista">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h2 class="modal-title" :data-id="clase_vista.horario_id">Detalle de la clase</h2>Detalle de la clase</h2>
|
||||
<h2 class="modal-title" :data-id="clase_vista.horario_id">Detalle de la clase</h2>
|
||||
<button type="button" class="close text-white" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
@@ -395,8 +395,8 @@
|
||||
<div class="col-12">
|
||||
<strong>Horario:</strong>
|
||||
<!-- hora hh:mm:ss to hh:mm -->
|
||||
{{ clase_vista.hora_inicio?.slice(0, 5) }} - {{
|
||||
clase_vista.hora_fin?.slice(0, 5) }}
|
||||
{{ clase_vista.horario_hora?.slice(0, 5) }} - {{
|
||||
clase_vista.horario_fin?.slice(0, 5) }}
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<strong>Salón:</strong>
|
||||
@@ -682,14 +682,7 @@
|
||||
store.bloquesHorario.data = await fetch('action/action_grupo_horario.php').then(res => res.json());
|
||||
store.bloquesHorario.selected = store.bloquesHorario.data.findIndex(bloque => bloque.selected);
|
||||
// console.log(store.bloquesHorario.selected);
|
||||
if (store.bloquesHorario.selected == -1) {
|
||||
this.header = "Seleccione un horario";
|
||||
}
|
||||
else {
|
||||
this.header = "Seleccione una ruta";
|
||||
}
|
||||
|
||||
|
||||
this.header = (store.bloquesHorario.selected == -1) ? "Seleccione un horario" : "Seleccione una ruta";
|
||||
this.catálogo_rutas.data = await fetch('action/rutas.php').then(res => res.json());
|
||||
this.loading = false;
|
||||
|
||||
@@ -708,8 +701,15 @@
|
||||
id_espacio_sgu: id_espacio_sgu,
|
||||
bloque_horario_id: store.bloquesHorario.data[store.bloquesHorario.selected].id
|
||||
});
|
||||
try {
|
||||
const rutas = await fetch(`${url}?${searchParams}`).then(res => res.json());
|
||||
store.rutas.data = rutas.filter(ruta => ruta.horarios.length > 0);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
this.header = `Error al cargar rutas`;
|
||||
this.loading = false;
|
||||
return
|
||||
}
|
||||
|
||||
if (store.rutas.data.length == 0) {
|
||||
this.header = `No hay clases en este horario`;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createApp, reactive } from 'https://unpkg.com/petite-vue?module'
|
||||
import { text } from 'stream/consumers';
|
||||
|
||||
type Registro = {
|
||||
carrera: string;
|
||||
carrera_id: number;
|
||||
@@ -48,6 +48,14 @@ type Facultad = {
|
||||
facultad_nombre: string;
|
||||
}
|
||||
|
||||
type Bloque_Horario = {
|
||||
hora_fin: string;
|
||||
hora_inicio: string;
|
||||
id: number;
|
||||
selected: boolean;
|
||||
}
|
||||
|
||||
|
||||
type Filter = {
|
||||
type: string;
|
||||
value: string;
|
||||
@@ -77,6 +85,7 @@ const store = reactive({
|
||||
fecha_inicio: null,
|
||||
fecha_fin: null,
|
||||
profesor: null,
|
||||
bloque_horario: null,
|
||||
estados: [],
|
||||
|
||||
switchFecha: false,
|
||||
@@ -127,6 +136,17 @@ const store = reactive({
|
||||
document.querySelector('#estados')!.innerHTML = `Todos los registros`
|
||||
}
|
||||
},
|
||||
bloques_horario: {
|
||||
data: [] as Bloque_Horario[],
|
||||
async fetch() {
|
||||
this.data = [] as Bloque_Horario[]
|
||||
const res = await fetch('action/action_grupo_horario.php')
|
||||
this.data = await res.json()
|
||||
|
||||
if (this.data.every((bloque: Bloque_Horario) => !bloque.selected))
|
||||
this.data[0].selected = true
|
||||
},
|
||||
},
|
||||
toggle(arr: any, element: any) {
|
||||
const newArray = arr.includes(element) ? arr.filter((item: any) => item !== element) : [...arr, element]
|
||||
// if all are selected, then unselect all
|
||||
@@ -185,6 +205,7 @@ createApp({
|
||||
const filters = Object.keys(store.filters).filter((filtro) => store.filters[filtro] || store.filters[filtro]?.length > 0)
|
||||
return this.data.filter((registro: Registro) => {
|
||||
return filters.every((filtro) => {
|
||||
|
||||
switch (filtro) {
|
||||
case 'fecha':
|
||||
return registro.registro_fecha_ideal === store.filters[filtro];
|
||||
@@ -208,12 +229,28 @@ createApp({
|
||||
case 'estados':
|
||||
if (store.filters[filtro].length === 0) return true;
|
||||
return store.filters[filtro].includes(registro.estado_supervisor_id);
|
||||
case 'bloque_horario':
|
||||
const bloque = store.bloques_horario.data.find((bloque: Bloque_Horario) => bloque.id === store.filters[filtro]) as Bloque_Horario;
|
||||
return registro.horario_hora <= bloque.hora_fin && registro.horario_fin >= bloque.hora_inicio;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
async descargar() {
|
||||
if (this.relevant.length === 0) return;
|
||||
const res = await fetch('export/supervisor_excel.php', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(this.relevant)
|
||||
});
|
||||
const blob = await res.blob();
|
||||
(window as any).saveAs(blob, `auditoria_${new Date().toISOString().slice(0, 10)}.xlsx`);
|
||||
}
|
||||
},
|
||||
get profesores() {
|
||||
return this.registros.data.map((registro: Registro) => (
|
||||
@@ -232,6 +269,9 @@ createApp({
|
||||
await this.registros.fetch()
|
||||
await store.facultades.fetch()
|
||||
await store.estados.fetch()
|
||||
await store.bloques_horario.fetch()
|
||||
|
||||
store.filters.bloque_horario = store.bloques_horario.data.find((bloque: Bloque_Horario) => bloque.selected)?.id
|
||||
store.filters.switchFechas()
|
||||
}
|
||||
}).mount('#app')
|
||||
269
usuarios.php
269
usuarios.php
@@ -2,21 +2,20 @@
|
||||
require_once 'class/c_login.php';
|
||||
require_once 'include/bd_pdo.php';
|
||||
|
||||
if (!isset($_SESSION['user'])){
|
||||
if (!isset($_SESSION['user'])) {
|
||||
header('Location: index.php');
|
||||
exit;
|
||||
}
|
||||
else
|
||||
} else
|
||||
$user = unserialize($_SESSION['user']);
|
||||
$user->access();
|
||||
if(!$user->admin && $user->acceso == 'n'){
|
||||
if (!$user->admin && $user->acceso == 'n') {
|
||||
header('Location: main.php?error=1');
|
||||
}else{
|
||||
} else {
|
||||
$user->print_to_log('Usuarios');
|
||||
}
|
||||
$fac = $user->facultad['facultad_id'] ?? -1;
|
||||
if($user->admin){
|
||||
$fac=null;
|
||||
if ($user->admin) {
|
||||
$fac = null;
|
||||
}
|
||||
#echo $fac;
|
||||
?>
|
||||
@@ -41,39 +40,38 @@ if($user->admin){
|
||||
);
|
||||
$user->access();
|
||||
|
||||
if(isset($_POST["desc"])){
|
||||
$desc=$_POST["desc"];
|
||||
$filter_desc = trim(filter_input(INPUT_POST, "desc", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));
|
||||
}else{
|
||||
$desc=NULL;
|
||||
if (isset($_POST["desc"])) {
|
||||
$desc = $_POST["desc"];
|
||||
$filter_desc = trim(filter_input(INPUT_POST, "desc", FILTER_SANITIZE_STRING, array('flags' => FILTER_FLAG_STRIP_LOW)));
|
||||
} else {
|
||||
$desc = NULL;
|
||||
}
|
||||
|
||||
if(isset($_POST["clave"])){
|
||||
$clave=$_POST["clave"];
|
||||
$filter_clave = trim(filter_input(INPUT_POST, "clave", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));
|
||||
}else{
|
||||
$clave=NULL;
|
||||
if (isset($_POST["clave"])) {
|
||||
$clave = $_POST["clave"];
|
||||
$filter_clave = trim(filter_input(INPUT_POST, "clave", FILTER_SANITIZE_STRING, array('flags' => FILTER_FLAG_STRIP_LOW)));
|
||||
} else {
|
||||
$clave = NULL;
|
||||
}
|
||||
|
||||
if(isset($_POST["rol"])){
|
||||
if($_POST['rol']!="")
|
||||
{
|
||||
$rol=$_POST["rol"];
|
||||
$filter_rol = trim(filter_input(INPUT_POST, "rol", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));
|
||||
}else{
|
||||
$rol=NULL;
|
||||
if (isset($_POST["rol"])) {
|
||||
if ($_POST['rol'] != "") {
|
||||
$rol = $_POST["rol"];
|
||||
$filter_rol = trim(filter_input(INPUT_POST, "rol", FILTER_SANITIZE_STRING, array('flags' => FILTER_FLAG_STRIP_LOW)));
|
||||
} else {
|
||||
$rol = NULL;
|
||||
}
|
||||
}else{
|
||||
$rol=NULL;
|
||||
} else {
|
||||
$rol = NULL;
|
||||
}
|
||||
|
||||
if(isset($_POST["mnombre"])){
|
||||
$desc=$_POST["mnombre"];
|
||||
$filter_desc = trim(filter_input(INPUT_POST, "mnombre", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));
|
||||
if (isset($_POST["mnombre"])) {
|
||||
$desc = $_POST["mnombre"];
|
||||
$filter_desc = trim(filter_input(INPUT_POST, "mnombre", FILTER_SANITIZE_STRING, array('flags' => FILTER_FLAG_STRIP_LOW)));
|
||||
}
|
||||
if(isset($_POST["mclave"])){
|
||||
$clave=$_POST["mclave"];
|
||||
$filter_clave = trim(filter_input(INPUT_POST, "mclave", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));
|
||||
if (isset($_POST["mclave"])) {
|
||||
$clave = $_POST["mclave"];
|
||||
$filter_clave = trim(filter_input(INPUT_POST, "mclave", FILTER_SANITIZE_STRING, array('flags' => FILTER_FLAG_STRIP_LOW)));
|
||||
}
|
||||
|
||||
$fs_usuarios = query(
|
||||
@@ -91,22 +89,22 @@ if($user->admin){
|
||||
null,
|
||||
false
|
||||
);
|
||||
if($user->admin){
|
||||
$fs_facultades = query(
|
||||
"SELECT * FROM facultad WHERE facultad_activa = true ORDER BY facultad_nombre",
|
||||
null,
|
||||
false
|
||||
);
|
||||
if ($user->admin) {
|
||||
$fs_facultades = $db
|
||||
->orderBy('facultad_nombre', 'asc')
|
||||
->get('facultad');
|
||||
}
|
||||
?>
|
||||
<main class="content marco">
|
||||
<?php if($user->acceso == 'w') {?>
|
||||
<?php if ($user->acceso == 'w') { ?>
|
||||
<div class="row">
|
||||
<div class="col-12 text-right">
|
||||
<button type="button" class="btn btn-outline-secondary" data-toggle="modal" data-target="#modal" data-tipo="1"><span class="ing-mas ing-fw"></span> Crear Usuario</button>
|
||||
<button type="button" class="btn btn-outline-secondary" data-toggle="modal" data-target="#modal"
|
||||
data-tipo="1"><span class="ing-mas ing-fw"></span> Crear Usuario</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<?php }?>
|
||||
<?php } ?>
|
||||
<!-- Filtro -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@@ -115,7 +113,9 @@ if($user->admin){
|
||||
<div class="form-group row">
|
||||
<label for="filter_desc" class="col-4 col-form-label">Nombre</label>
|
||||
<div class="col-8 col-sm-4">
|
||||
<input id="filter_desc" name="desc" type="text" class="form-control" <?php if(isset($filter_desc)){echo 'value="'.$filter_desc.'"';} ?>>
|
||||
<input id="filter_desc" name="desc" type="text" class="form-control" <?php if (isset($filter_desc)) {
|
||||
echo 'value="' . $filter_desc . '"';
|
||||
} ?>>
|
||||
<div class="invalid-feedback" id="desc-error">
|
||||
Debe ser un numero
|
||||
</div>
|
||||
@@ -124,29 +124,37 @@ if($user->admin){
|
||||
<div class="form-group row">
|
||||
<label for="filter_clave" class="col-4 col-form-label">Clave</label>
|
||||
<div class="col-8 col-sm-4">
|
||||
<input id="filter_clave" name="clave" type="text" class="form-control" <?php if(isset($filter_desc)){echo 'value="'.$filter_clave.'"';} ?>>
|
||||
|
||||
<input id="filter_clave" name="clave" type="text" class="form-control" <?php if (isset($filter_desc)) {
|
||||
echo 'value="' . $filter_clave . '"';
|
||||
} ?>>
|
||||
<div class="invalid-feedback" id="clave-error">
|
||||
Debe ser un numero
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="filter_rol" class="col-4 col-form-label">Rol</label>
|
||||
<lab el for="filter_rol" class="col-4 col-form-label">Rol</label>
|
||||
<div class="col-8 col-sm-4">
|
||||
<div class="datalist datalist-select mb-1 w-100">
|
||||
<div class="datalist-input">Mostrar todas</div>
|
||||
<span class="ing-buscar icono"></span>
|
||||
<ul style="display:none">
|
||||
|
||||
|
||||
<li data-id="" class="pl-4">Mostrar todas</li>
|
||||
<?php foreach($fs_roles as $rol){ ?>
|
||||
<li data-id="<?php echo $rol['rol_id']; ?>" class="pl-4 <?php if(isset($filter_rol) && $rol["rol_id"]==$filter_rol){ echo 'selected';} ?>"><?php echo $rol['rol_titulo']; ?></li>
|
||||
<?php }?>
|
||||
<?php foreach ($fs_roles as $rol) { ?>
|
||||
<li data-id="<?php echo $rol['rol_id']; ?>" class="pl-4 <?php if (isset($filter_rol) && $rol["rol_id"] == $filter_rol) {
|
||||
echo 'selected';
|
||||
} ?>">
|
||||
<?php echo $rol['rol_titulo']; ?></li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
<input type="hidden" id="filter_rol" name="rol" value="">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</di v>
|
||||
<div class="form-group row">
|
||||
<div class="col-12 text-center">
|
||||
<button type="submit" class="btn btn-outline-primary">
|
||||
@@ -173,33 +181,47 @@ if($user->admin){
|
||||
<th>Correo</th>
|
||||
<th>Clave</th>
|
||||
<th>Rol</th>
|
||||
<?php if($user->admin){ ?>
|
||||
<?php if ($user->admin) { ?>
|
||||
<th>Facultad</th>
|
||||
<?php } ?>
|
||||
<?php if($user->acceso == 'w'){?>
|
||||
<?php if ($user->acceso == 'w') { ?>
|
||||
<th>Acciones</th>
|
||||
<?php }?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<?php foreach($fs_usuarios as $usuario){
|
||||
?>
|
||||
<tr data-id="<?= $usuario['id'] ?>" data-facultad="<?= $fac ?>" id="<?= $usuario['id'] ?>">
|
||||
<td class="text-primary"> <?= $usuario['username'] ?></td>
|
||||
<td class="text-primary"> <?= $usuario['email'] ?></td>
|
||||
<td class="text-center"> <?= $usuario['clave'] ?></td>
|
||||
<td class="text-primary"> <?= $usuario['titulo'] ?></td>
|
||||
<?php if($user->admin){ ?>
|
||||
<td class="text-primary"> <?= $usuario['facultad_nombre'] ?> </td>
|
||||
<?php } ?>
|
||||
<?php if($user->acceso == 'w'){?>
|
||||
<td class="text-center icono-acciones">
|
||||
<a href="#" data-toggle="modal" data-target="#modal" data-tipo="2" title="Editar"><span class="ing-editar ing-fw"></span></a>
|
||||
</td>
|
||||
<?php }?>
|
||||
</tr>
|
||||
<?php }?>
|
||||
|
||||
|
||||
</thead>
|
||||
|
||||
|
||||
<tbody>
|
||||
<?php foreach ($fs_usuarios as $usuario) { ?>
|
||||
<tr data-id="<?= $usuario['id'] ?>" data-facultad="<?= $fac ?>" id="<?= $usuario['id'] ?>">
|
||||
<td class="text-primary">
|
||||
<?= $usuario['username'] ?>
|
||||
</td>
|
||||
|
||||
<td class="text-primary">
|
||||
<?= $usuario['email'] ?>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<?= $usuario['clave'] ?>
|
||||
</td>
|
||||
<td class="text-primary">
|
||||
<?= $usuario['titulo'] ?>
|
||||
</td>
|
||||
<?php if ($user->admin) { ?>
|
||||
<td class="text-primary">
|
||||
<?= $usuario['facultad_nombre'] ?>
|
||||
</td>
|
||||
<?php } ?>
|
||||
<?php if ($user->acceso == 'w') { ?>
|
||||
<td class="text-center icono-acciones">
|
||||
<a href="#" data-toggle="modal" data-target="#modal" data-tipo="2" title="Editar"><span
|
||||
class="ing-editar ing-fw"></span></a>
|
||||
</td>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -246,6 +268,7 @@ if($user->admin){
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="correo" class="col-4 col-form-label">Correo</label>
|
||||
<div class="col-8">
|
||||
@@ -262,15 +285,17 @@ if($user->admin){
|
||||
<div class="datalist-input">Mostrar todas</div>
|
||||
<span class="ing-buscar icono"></span>
|
||||
<ul style="display:none">
|
||||
<?php foreach($fs_roles as $rol){ ?>
|
||||
<li data-id="<?= $rol['rol_id'] ?>" class="pl-4"><?= $rol['rol_titulo'] ?></li>
|
||||
|
||||
<?php foreach ($fs_roles as $rol) { ?>
|
||||
<li data-id="<?= $rol['rol_id'] ?>" class="pl-4"><?= $rol['rol_titulo'] ?>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
<input type="hidden" id="mrol" name="mrol" value="">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php if($user->admin){ ?>
|
||||
<?php if ($user->admin) { ?>
|
||||
<div class="form-group row" id="mdatalist">
|
||||
<label for="dlfacultad" class="col-4 col-form-label">Facultad *</label>
|
||||
<div class="col-8">
|
||||
@@ -278,7 +303,7 @@ if($user->admin){
|
||||
<div class="datalist-input">Mostrar todas</div>
|
||||
<span class="ing-buscar icono"></span>
|
||||
<ul style="display:none">
|
||||
<?php foreach($fs_facultades as $facultad){ ?>
|
||||
<?php foreach ($fs_facultades as $facultad) { ?>
|
||||
<li data-id="<?= $facultad['facultad_id'] ?>" class="pl-4"><?= $facultad['facultad_nombre'] ?></li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
@@ -300,133 +325,134 @@ if($user->admin){
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</ div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="js/jquery.min.js"></script>
|
||||
<script src="js/bootstrap/bootstrap.min.js"></script>
|
||||
<script s rc="js/bootstrap/bootstrap.min.js"></script>
|
||||
<script src="js/datalist.js"></script>
|
||||
<?php
|
||||
require_once 'js/messages.php';
|
||||
?>
|
||||
<script>
|
||||
<?php if(isset($_GET['error'])){
|
||||
if($_GET['error']==1){ ?>
|
||||
triggerMessage("Esta clave ya está en uso", "Error");
|
||||
<?php if (isset($_GET['error'])) {
|
||||
if ($_GET['error'] == 1) { ?>
|
||||
triggerMessage("Es ta cl ave ya está en uso", "Error");
|
||||
<?php }
|
||||
}
|
||||
?>
|
||||
|
||||
function valida_campos(){
|
||||
var error=false;
|
||||
if($("#mclave").val()==""){
|
||||
function valida_campos() {
|
||||
var error = false;
|
||||
if ($("#mclave").val() == " ") {
|
||||
$("#mclave").addClass("is-invalid");
|
||||
$("#mclave-error").html("Campo obligatorio");
|
||||
error=true;
|
||||
}else{
|
||||
$("#mclave").removeClass("is-invalid");
|
||||
error = true;
|
||||
} else {
|
||||
$("#mclave").removeClass("i s-invalid");
|
||||
}
|
||||
if($("#mclave").val()[0]==" "){
|
||||
$("#mclave").addClass("is-invalid");
|
||||
if ($("#mclave").val()[0] == " ") {
|
||||
$("#m c lave").addClass("is-invalid");
|
||||
$("#mclave-error").html("No puede tener espacios al inicio");
|
||||
error=true;
|
||||
error = true;
|
||||
}
|
||||
if($("#mnombre").val()==""){
|
||||
if ($("#mnombre").val() == "") {
|
||||
$("#mnombre").addClass("is-invalid");
|
||||
$("#mnombre-error").html("Campo obligatorio");
|
||||
error=true;
|
||||
}else{
|
||||
error = true;
|
||||
} else {
|
||||
$("#mnombre").removeClass("is-invalid");
|
||||
}
|
||||
if($("#mnombre").val()[0]==" "){
|
||||
if ($("#mnombre").val()[0] == " ") {
|
||||
$("#mnombre").addClass("is-invalid");
|
||||
$("#mnombre-error").html("No puede tener espacios al inicio");
|
||||
error=true;
|
||||
error = true;
|
||||
}
|
||||
if($("#mcorreo").val()[0]==" "){
|
||||
if ($("#mcorreo").val()[0] == " ") {
|
||||
$("#mcorreo").addClass("is-invalid");
|
||||
$("#mcorreo-error")
|
||||
error=true;
|
||||
error = true;
|
||||
}
|
||||
if(error==true){
|
||||
if (error == true) {
|
||||
return false;
|
||||
}else{
|
||||
} else {
|
||||
var btn = $('#submitBtn');
|
||||
if(btn.data('tipo')==2)//update
|
||||
if (btn.data('tipo') == 2)//update
|
||||
$('#formaModal').prop("action", "./action/action_usuarios_update.php");
|
||||
else//insert
|
||||
$('#formaModal').prop('action', './action/action_usuarios_insert.php');
|
||||
}
|
||||
}
|
||||
|
||||
$('#modal').on('show.bs.modal', function (event){
|
||||
$('#modal').on('show.bs.modal', function (event) {
|
||||
var button = $(event.relatedTarget);
|
||||
var tipo = button.data('tipo');
|
||||
var modal = $(this);
|
||||
setDatalistFirst('#mrol');
|
||||
<?php if($user->admin){ ?>
|
||||
<?php if ($user->admin) { ?>
|
||||
setDatalistFirst("#dlfacultad");
|
||||
<?php } ?>
|
||||
$("#mnombre").removeClass("is-invalid");
|
||||
$("#mclave").removeClass("is-invalid");
|
||||
$("#mcorreo").removeClass("is-invalid");
|
||||
if(tipo == 1){//crear
|
||||
$('#modalLabel').html("Crear Usuario");
|
||||
if (tipo == 1) {//crear
|
||||
$('#modalLabe l').html("Crear Usuario");
|
||||
$('#mclave').val("");
|
||||
|
||||
$('#mnombre').val("");
|
||||
$('#mcorreo').val("");
|
||||
$('#id').val("");
|
||||
<?php if($user->admin){ ?>
|
||||
$('#mfacultad').val(<?=$fac?>);
|
||||
<?php if ($user->admin) { ?>
|
||||
$('#mfacultad').val(<?= $fac ?>);
|
||||
<?php } ?>
|
||||
}
|
||||
else{//editar
|
||||
var id= $(event.relatedTarget).parents('tr').data('id');
|
||||
var fac=$(event.relatedTarget).parents('tr').data('facultad');
|
||||
else {//editar
|
||||
var id = $(event.relatedTarget).parents('tr').data('id');
|
||||
var fac = $(event.relatedTarget).parents('tr').data('facultad');
|
||||
$('#modalLabel').html("Editar Usuario");
|
||||
$('#id').val(id);
|
||||
$('#mfacultad').val(fac);
|
||||
$('#submitBtn').data('tipo', 2);
|
||||
$.ajax({
|
||||
url:"action/action_usuarios_select.php",
|
||||
type:"post",
|
||||
dataType:"json",
|
||||
data: {usuario: id},
|
||||
success:function(result){
|
||||
url: "action/action_usuarios_select.php",
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: { usuario: id },
|
||||
success: function(result) {
|
||||
console.log(result);
|
||||
$('#id').val(result['usuario_id']);
|
||||
$('#id').val(result['us uario_id']);
|
||||
$('#mfacultad').val(result['facultad_id']);
|
||||
$('#mnombre').val(result['usuario_nombre']);
|
||||
$('#mclave').val(result['usuario_clave']);
|
||||
$('#mcorreo').val(result['usuario_correo']);
|
||||
setDatalist('#mrol', result['rol_id']);
|
||||
<?php if($user->admin){ ?>
|
||||
<?php if ($user->admin) { ?>
|
||||
setDatalist('#dlfacultad', result['facultad_id']);
|
||||
<?php } ?>
|
||||
},
|
||||
error: function(){
|
||||
error: function () {
|
||||
console.log("Error")
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function valida_filtro(){
|
||||
function valida_filtro() {
|
||||
var error = false;
|
||||
if($('#filter_desc').val()[0]==" "){
|
||||
if ($('#filter_desc').val()[0] == " ") {
|
||||
|
||||
$('#filter_desc').addClass("is-invalid");
|
||||
$('#desc-error').html("No puede tener espacios al inicio");
|
||||
error = true;
|
||||
}
|
||||
if(error){
|
||||
if (error) {
|
||||
return false;
|
||||
}
|
||||
else{
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
$(document).on("click", ".btn-reset", function(event){
|
||||
$(document).on("click", ".btn-reset", function (event) {
|
||||
var forma = $(this).parents("form");
|
||||
forma.find("input[type=text]").val("");
|
||||
setDatalistFirst("#filter_rol");
|
||||
@@ -434,4 +460,5 @@ if($user->admin){
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user