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