All
This commit is contained in:
@@ -29,6 +29,7 @@ try {
|
||||
"WITH horarios AS (
|
||||
SELECT
|
||||
horario_id,
|
||||
facultad.facultad_id,
|
||||
horario_fecha_inicio,
|
||||
horario_fecha_fin,
|
||||
horario_grupo,
|
||||
@@ -55,31 +56,35 @@ try {
|
||||
fechas AS (
|
||||
SELECT fechas_clase(h.horario_id, true) as registro_fecha_ideal, h.horario_id
|
||||
FROM horarios h
|
||||
),
|
||||
sin_registro AS (
|
||||
SELECT * FROM ESTADO_SUPERVISOR WHERE (estado_color, estado_icon) = ('dark', 'ing-cancelar')
|
||||
)
|
||||
SELECT
|
||||
usuario.usuario_nombre,
|
||||
registro.registro_id, registro.registro_fecha, registro.registro_retardo, registro.registro_justificada, comentario, registro_fecha_supervisor justificacion, registro_fecha_justificacion,
|
||||
registro.registro_id,
|
||||
registro.registro_fecha,
|
||||
registro.registro_retardo,
|
||||
registro.registro_justificada,
|
||||
registro_fecha_supervisor,
|
||||
justificacion,
|
||||
comentario,
|
||||
registro_fecha_justificacion,
|
||||
profesor.profesor_id, profesor_nombre, profesor_clave, profesor_correo,
|
||||
horarios.*,
|
||||
registro_fecha_ideal,
|
||||
COALESCE(estado_supervisor.estado_supervisor_id, sin_registro.estado_supervisor_id) as estado_supervisor_id,
|
||||
COALESCE(estado_supervisor.nombre, sin_registro.nombre) as nombre,
|
||||
COALESCE(estado_supervisor.estado_color, sin_registro.estado_color) as estado_color,
|
||||
COALESCE(estado_supervisor.estado_icon, sin_registro.estado_icon) as estado_icon,
|
||||
materia, carrera, horarios.facultad_id, facultad, nivel, horario_hora, horario_fin, horario_grupo, salon,
|
||||
fechas.registro_fecha_ideal,
|
||||
estado_supervisor.estado_supervisor_id as estado_supervisor_id,
|
||||
estado_supervisor.nombre as nombre,
|
||||
estado_supervisor.estado_color as estado_color,
|
||||
estado_supervisor.estado_icon as estado_icon,
|
||||
justificador.usuario_nombre as justificador_nombre,
|
||||
justificador.usuario_clave as justificador_clave,
|
||||
facultad.facultad_nombre as justificador_facultad,
|
||||
rol.rol_titulo as justificador_rol
|
||||
rol.rol_titulo as justificador_rol,
|
||||
CASE WHEN registro_retardo THEN 'warning' ELSE 'primary' END as color
|
||||
FROM horarios
|
||||
JOIN fechas using (horario_id)
|
||||
JOIN horario_profesor using (horario_id)
|
||||
JOIN profesor using (profesor_id)
|
||||
LEFT JOIN registro USING (horario_id, registro_fecha_ideal, profesor_id)
|
||||
LEFT join estado_supervisor using (estado_supervisor_id)
|
||||
CROSS JOIN sin_registro
|
||||
join estado_supervisor ON estado_supervisor.estado_supervisor_id = COALESCE(registro.estado_supervisor_id, 0)
|
||||
LEFT JOIN USUARIO ON USUARIO.usuario_id = REGISTRO.supervisor_id
|
||||
LEFT JOIN USUARIO JUSTIFICADOR ON JUSTIFICADOR.usuario_id = REGISTRO.justificador_id
|
||||
LEFT JOIN ROL on ROL.rol_id = justificador.rol_id
|
||||
|
||||
44
action/reposicion_profesor_materias.php
Normal file
44
action/reposicion_profesor_materias.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Obtiene datos de reposición
|
||||
*/
|
||||
$ruta = "../";
|
||||
require_once "../class/c_login.php";
|
||||
|
||||
// check if the session is started
|
||||
if (!isset($_SESSION['user']))
|
||||
die('No se ha iniciado sesión');
|
||||
|
||||
$user = unserialize($_SESSION['user']);
|
||||
|
||||
|
||||
//--- Objeto para validar usuario. El id de usuario lo lee desde sesión
|
||||
/*if(!$objSesion->tieneAcceso()){
|
||||
$return["error"] = "Error! No tienes permisos para realizar esta acción.";
|
||||
}else*/ if(!isset($_POST["id"])){
|
||||
$return["error"] = "Error! No se recibió la información del profesor.";
|
||||
}else{
|
||||
$id = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto
|
||||
|
||||
try{
|
||||
$rs = $db->query('SELECT * FROM fs_materiasprofesor(:id)', [':id' => $id] );
|
||||
|
||||
}catch(Exception $e){
|
||||
$return["error"] = "Ocurrió un error al leer los datos de las materias.";
|
||||
echo json_encode($return);
|
||||
}
|
||||
|
||||
$mat_arr = array();
|
||||
foreach($rs as $m){
|
||||
$mat_arr[] = array("horario_id"=>$m["horario_id"], "horario_dia"=>$m["horario_dia"],
|
||||
"horario_hora"=>substr($m["horario_hora"], 0, 2), "horario_min"=>substr($m["horario_hora"], 3, 2),
|
||||
"materia_nombre"=>$m["materia_nombre"].' - '.$m["horario_dia_nombre"]." ".substr($m["horario_hora"], 0, -3)
|
||||
);
|
||||
}
|
||||
|
||||
$return["materias"] = $mat_arr;
|
||||
|
||||
}
|
||||
echo json_encode($return);
|
||||
?>
|
||||
@@ -12,6 +12,7 @@ $ruta = "../";
|
||||
require_once "../class/c_login.php";
|
||||
// check method
|
||||
try {
|
||||
global $db;
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
// check parameters
|
||||
array_walk($information['GET'], function ($value) {
|
||||
@@ -25,32 +26,69 @@ try {
|
||||
$data = $db
|
||||
->where('tiene_salones')
|
||||
->where("{$_GET['id_espacio_sgu']} = ANY(id_espacio_sgu_array)")
|
||||
->get('salon_view');
|
||||
->get('salon_view', columns: 'id_espacio_sgu, salon, salon_id, salon_array');
|
||||
|
||||
// step 3: get horarios
|
||||
// step 3: get horario
|
||||
$columns = [
|
||||
// horario
|
||||
'horario_view.horario_id',
|
||||
'horario_hora',
|
||||
'horario_grupo',
|
||||
'horario_fin',
|
||||
'materia',
|
||||
'carrera',
|
||||
'nivel',
|
||||
'horario_view.salon',
|
||||
'facultad',
|
||||
// profesor
|
||||
'profesor.profesor_id',
|
||||
'profesor_clave',
|
||||
'profesor_nombre',
|
||||
'profesor_correo',
|
||||
// registro
|
||||
'registro_fecha',
|
||||
'registro_retardo',
|
||||
'registro.reposicion_id',
|
||||
'estado_supervisor_id',
|
||||
'comentario',
|
||||
// reposicion
|
||||
'reposicion_fecha',
|
||||
'reposicion_hora',
|
||||
'salon_reposicion.salon as reposicion_salon',
|
||||
];
|
||||
$fecha = "'2023-09-01'::DATE";
|
||||
$data = array_map(
|
||||
fn($ruta) => array_merge(
|
||||
[
|
||||
'horarios' => array_merge(
|
||||
$db
|
||||
'horarios' => $db
|
||||
->join('periodo', 'periodo.periodo_id = horario_view.periodo_id')
|
||||
->join('bloque_horario', '(bloque_horario.hora_inicio, bloque_horario.hora_fin) OVERLAPS (horario_view.horario_hora, horario_view.horario_hora + horario_view.duracion)')
|
||||
->join('salon_view', 'salon_view.salon_id = horario_view.salon_id')
|
||||
->join('horario_profesor', 'horario_profesor.horario_id = horario_view.horario_id')
|
||||
->join('profesor', 'profesor.profesor_id = horario_profesor.profesor_id')
|
||||
->join('registro', '(registro.profesor_id, registro.horario_id, registro.registro_fecha_ideal) = (profesor.profesor_id, horario_view.horario_id, CURRENT_DATE)', 'LEFT')
|
||||
->where('CURRENT_DATE BETWEEN periodo.periodo_fecha_inicio AND periodo.periodo_fecha_fin')
|
||||
->where('horario_dia = EXTRACT(DOW FROM CURRENT_DATE)')
|
||||
->join('registro', "(registro.profesor_id, registro.horario_id, registro.registro_fecha_ideal) = (profesor.profesor_id, horario_view.horario_id, $fecha)", 'LEFT')
|
||||
->join('reposicion', 'reposicion.reposicion_id = registro.reposicion_id', 'LEFT')
|
||||
->join('salon as salon_reposicion', 'salon_reposicion.salon_id = reposicion.salon_id', 'LEFT')
|
||||
->where("$fecha BETWEEN periodo.periodo_fecha_inicio AND periodo.periodo_fecha_fin")
|
||||
->where("horario_dia = EXTRACT(DOW FROM $fecha)")
|
||||
->where('bloque_horario.id', $_GET['bloque_horario_id'])
|
||||
->where('id_espacio_padre', $ruta['id_espacio_sgu'])
|
||||
->get('horario_view', null, '*, horario_view.horario_id, profesor.profesor_id'),
|
||||
),
|
||||
->where('salon_view.id_espacio_padre', $ruta['id_espacio_sgu'])
|
||||
->get('horario_view', columns: $columns),
|
||||
'reposiciones' => $db
|
||||
->join('periodo', 'periodo.periodo_id = horario_view.periodo_id')
|
||||
->join('registro', 'registro.horario_id = horario_view.horario_id')
|
||||
->join('reposicion', 'registro.reposicion_id = reposicion.reposicion_id')
|
||||
->join('bloque_horario', '(bloque_horario.hora_inicio, bloque_horario.hora_fin) OVERLAPS (reposicion_hora, reposicion_hora + horario_view.duracion)')
|
||||
->join('profesor', 'profesor.profesor_id = registro.profesor_id')
|
||||
->join('salon as salon_reposicion', 'salon_reposicion.salon_id = reposicion.salon_id', 'LEFT')
|
||||
->where("$fecha BETWEEN periodo.periodo_fecha_inicio AND periodo.periodo_fecha_fin")
|
||||
->where("reposicion_fecha = $fecha")
|
||||
->get('horario_view', columns: $columns),
|
||||
],
|
||||
$ruta,
|
||||
),
|
||||
$data
|
||||
);
|
||||
|
||||
echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
http_response_code(405);
|
||||
|
||||
@@ -292,7 +292,7 @@
|
||||
<!-- -->
|
||||
<td class="text-center align-middle px-2">
|
||||
<div v-if="registro.registro_fecha">
|
||||
<div class="col-12">
|
||||
<div class="col-12" :class="registro.color">
|
||||
Registro <small>{{ registro.registro_fecha?.slice(11,19) }}</small>
|
||||
</div>
|
||||
</div>
|
||||
@@ -313,8 +313,7 @@
|
||||
<span class="mr-2" :class="`text-${registro.estado_color}`">
|
||||
<i :class="`${registro.estado_icon} ing-2x`"></i>
|
||||
</span>
|
||||
<strong v-if="registro.usuario_nombre">{{ registro.usuario_nombre
|
||||
}}</strong>
|
||||
<strong v-if="registro.usuario_nombre">{{ registro.usuario_nombre }}</strong>
|
||||
</div>
|
||||
<div class="col-12" v-if="registro.registro_fecha_supervisor">
|
||||
Hora
|
||||
@@ -581,15 +580,10 @@
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-12 text-center">
|
||||
Justificar <strong v-if="store.current.justificada.estado_supervisor_id"
|
||||
:class="`text-${store.current.justificada.estado_color}`"
|
||||
class="text-uppercase">
|
||||
{{store.current.justificada.nombre.toUpperCase()}}</strong> del día <span
|
||||
class="text-muted">{{store.current.justificada.registro_fecha_ideal}}</span> a
|
||||
las <span
|
||||
class="text-muted">{{store.current.justificada.horario_hora?.slice(0,5)}}</span>
|
||||
para el profesor <span
|
||||
class="text-muted">{{store.current.justificada.profesor_nombre}}</span>
|
||||
Justificar <strong :class="`text-${store.current.justificada.estado_color}`" class="text-uppercase">
|
||||
{{store.current.justificada.nombre}}</strong> del día <span class="text-muted">{{store.current.justificada.registro_fecha_ideal}}</span> a
|
||||
las <span class="text-muted">{{store.current.justificada.horario_hora?.slice(0,5)}}</span>
|
||||
para el profesor <span class="text-muted">{{store.current.justificada.profesor_nombre}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-3">
|
||||
|
||||
@@ -18,8 +18,38 @@ require_once($ruta ?? '') . "vendor/autoload.php";
|
||||
|
||||
class Login
|
||||
{
|
||||
public ?string $acceso;
|
||||
public function __construct(public array $user, public array $facultad, public array $rol, public bool $admin, public ?int $periodo_id, public bool $supervisor, public bool $jefe_carrera, public bool $profesor)
|
||||
private function es_usuario(): bool
|
||||
{
|
||||
global $db;
|
||||
return $db->where('usuario_clave', $this->user['clave'])->has("usuario");
|
||||
}
|
||||
public function __get($property)
|
||||
{
|
||||
global $db;
|
||||
return match ($property) {
|
||||
'acceso' => $this->access(),
|
||||
'profesor' => $db->where('profesor_clave', preg_replace('/\D/', '', $this->user['clave']))->getOne("profesor")['profesor_id'] ?? null,
|
||||
'jefe_de_carrera' => $db->where('usuario_id', $this->user["id"])->has('usuario_carrera'),
|
||||
'periodo_id' => $db->where('usuario_id', $this->user["id"])->getOne('usuario')["periodo_id"],
|
||||
'admin' => $this->es_usuario() and $db->where('usuario_id', $this->user["id"])->getOne('usuario')["usuario_admin"],
|
||||
'facultad' => $this->es_usuario()
|
||||
? $db
|
||||
->where('usuario_id', $this->user["id"])
|
||||
->join('facultad', 'facultad.facultad_id = usuario.facultad_id', 'LEFT')
|
||||
->getOne('usuario', 'facultad.facultad_nombre as facultad, facultad.facultad_id')
|
||||
: array ('facultad' => null, 'facultad_id' => null),
|
||||
'rol' => $this->es_usuario()
|
||||
? $db
|
||||
->join('rol', 'rol.rol_id = usuario.rol_id')
|
||||
->where('usuario_id', $this->user["id"])
|
||||
->getOne('usuario', 'rol.rol_titulo as rol, rol.rol_id')
|
||||
: $db
|
||||
->where('rol_titulo', 'docente', 'ILIKE')
|
||||
->getOne('rol', 'rol.rol_titulo as rol, rol.rol_id'),
|
||||
default => throw new Exception("Propiedad no definida"),
|
||||
};
|
||||
}
|
||||
public function __construct(public array $user)
|
||||
{
|
||||
}
|
||||
public function print_to_log(string $desc, array $old = null, array $new = null): void
|
||||
@@ -31,40 +61,17 @@ class Login
|
||||
$desc .= " |#| NEW:" . json_encode($new);
|
||||
$log->appendLog($this->user["id"], $this->user["nombre"], $desc);
|
||||
}
|
||||
public function access(string $pagina = null): void
|
||||
public function access(string $pagina = null): string|null
|
||||
{
|
||||
global $db;
|
||||
$user = $db
|
||||
->join('rol', 'rol.rol_id = usuario.rol_id')
|
||||
->join('facultad', 'facultad.facultad_id = usuario.facultad_id', 'LEFT')
|
||||
->where('usuario_id', $this->user["id"])
|
||||
->getOne('usuario');
|
||||
|
||||
$this->admin = $user["usuario_admin"];
|
||||
|
||||
$this->rol = array(
|
||||
'id' => $user["rol_id"],
|
||||
'rol' => $user["rol_titulo"]
|
||||
);
|
||||
|
||||
$this->facultad = array(
|
||||
'facultad_id' => $user["facultad_id"],
|
||||
'facultad' => $user["facultad_nombre"],
|
||||
);
|
||||
|
||||
if ($this->admin) {
|
||||
$this->acceso = "w";
|
||||
return;
|
||||
}
|
||||
|
||||
# print_r( $access );
|
||||
if ($this->admin)
|
||||
return "w";
|
||||
$acceso = $db
|
||||
->where('id', $this->user["id"])
|
||||
->where('pagina_ruta', $pagina ?? substr(basename($_SERVER['PHP_SELF']), 0, -4))
|
||||
->getOne('permiso_view');
|
||||
|
||||
$this->acceso = isset($acceso["tipo"]) ? $acceso["tipo"] : null;
|
||||
|
||||
return isset($acceso["tipo"]) ? $acceso["tipo"] : null;
|
||||
}
|
||||
private static function validaUsuario($user, $pass): bool
|
||||
{
|
||||
@@ -84,82 +91,32 @@ class Login
|
||||
}
|
||||
public static function validUser(string $user, string $pass): Login|array
|
||||
{
|
||||
if (Login::validaUsuario($user, $pass) === false) {
|
||||
return [
|
||||
'error' => true,
|
||||
'msg' => 'Error al autenticar usuario'
|
||||
];
|
||||
}
|
||||
global $db;
|
||||
|
||||
if (!Login::validaUsuario($user, $pass))
|
||||
return ['error' => true, 'msg' => 'Error al autenticar usuario'];
|
||||
|
||||
if ($db->has("FS_VALIDACLAVEULSA('$user')")) {
|
||||
#die (Login::validaUsuario($user, $pass));
|
||||
$fs_validaclaveulsa = $db->querySingle(
|
||||
'SELECT * FROM FS_VALIDACLAVEULSA(?)',
|
||||
[$user]
|
||||
);
|
||||
|
||||
$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"],
|
||||
'facultad' => $fs_validaclaveulsa["facultad"],
|
||||
);
|
||||
$rol = array(
|
||||
'id' => $fs_validaclaveulsa["rol_id"],
|
||||
'rol' => $fs_validaclaveulsa["rol"]
|
||||
);
|
||||
$supervisor = $db
|
||||
->join('rol', 'rol.rol_id = usuario.rol_id')
|
||||
->where('usuario_id', $user["id"])
|
||||
->where('rol.rol_titulo', 'Supervisor')
|
||||
->has('usuario');
|
||||
$jefe_carrera = $db->where('usuario_id', $user["id"])->has('usuario_carrera');
|
||||
|
||||
$admin = $fs_validaclaveulsa["is_admin"];
|
||||
$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), '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 = array(
|
||||
'facultad_id' => null,
|
||||
'facultad' => null,
|
||||
);
|
||||
$rol = array(
|
||||
'id' => null,
|
||||
'rol' => 'Docente'
|
||||
);
|
||||
|
||||
// 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: false, periodo_id: null, supervisor: false, jefe_carrera: false, profesor: true);
|
||||
} else
|
||||
return [
|
||||
'error' => true,
|
||||
'msg' => 'Usuario no encontrado'
|
||||
];
|
||||
$fs = $db->querySingle('SELECT * FROM FS_VALIDACLAVEULSA(?)', [$user]);
|
||||
return new Login(user: ['id' => $fs["id"], 'nombre' => $fs["nombre"], 'clave' => $fs["clave"]]);
|
||||
}
|
||||
|
||||
$profesorClave = preg_replace('/\D/', '', $user);
|
||||
if ($db->where('profesor_clave', $profesorClave)->has("profesor")) {
|
||||
$profesor = $db->where('profesor_clave', $profesorClave)->getOne("profesor");
|
||||
return new Login(user: ['id' => $profesor["profesor_id"], 'nombre' => $profesor["profesor_nombre"], 'clave' => $profesor["profesor_clave"]]);
|
||||
}
|
||||
|
||||
return ['error' => true, 'msg' => 'Usuario no encontrado'];
|
||||
}
|
||||
|
||||
|
||||
public static function log_out(): void
|
||||
{
|
||||
session_start();
|
||||
session_destroy();
|
||||
}
|
||||
|
||||
private static function is_logged(): bool
|
||||
{
|
||||
return isset($_SESSION["user"]);
|
||||
}
|
||||
|
||||
// get the user from the session (if not )
|
||||
|
||||
public static function get_user(): Login
|
||||
{
|
||||
if (Login::is_logged()) {
|
||||
@@ -169,4 +126,8 @@ class Login
|
||||
header("Location: /");
|
||||
exit();
|
||||
}
|
||||
private static function is_logged(): bool
|
||||
{
|
||||
return isset($_SESSION["user"]);
|
||||
}
|
||||
}
|
||||
@@ -171,10 +171,15 @@ const store = reactive({
|
||||
if (fecha_fin)
|
||||
params['fecha_fin'] = fecha_fin;
|
||||
const paramsUrl = new URLSearchParams(params).toString();
|
||||
try {
|
||||
const res = await fetch(`action/action_auditoria.php?${paramsUrl}`, {
|
||||
method: 'GET',
|
||||
});
|
||||
this.data = await res.json();
|
||||
}
|
||||
catch (error) {
|
||||
alert('Error al cargar los datos');
|
||||
}
|
||||
this.loading = false;
|
||||
store.current.page = 1;
|
||||
},
|
||||
|
||||
@@ -1,16 +1,27 @@
|
||||
<?php
|
||||
|
||||
require_once 'class/c_login.php';
|
||||
$user = Login::get_user();
|
||||
|
||||
print_r($user);
|
||||
print_r($user->profesor);
|
||||
print_r($user->acceso);//null sin permisos, w o r
|
||||
//profesor, admin, rol, facultad
|
||||
if (!$user->profesor && !$user->admin){
|
||||
if (!isset($_SESSION['user'])){
|
||||
die(header('Location: index.php'));
|
||||
}
|
||||
|
||||
//$user = unserialize($_SESSION['user']);
|
||||
$user = Login::get_user();
|
||||
print_r($user);
|
||||
print_r($user->user["id"]);
|
||||
echo "****|";
|
||||
$user->access();
|
||||
print_r($user->acceso);//null sin permisos, w o r
|
||||
echo "|****|";
|
||||
print_r($user->profesor);
|
||||
echo "|****|";
|
||||
print_r($user->facultad["facultad_id"]);
|
||||
//profesor, admin, rol, facultad
|
||||
/*if ($user->acceso === null || !$user->admin){
|
||||
die(header('Location: index.php'));
|
||||
exit();
|
||||
}*/
|
||||
|
||||
|
||||
//if (!$user->admin && in_array($user->acceso, ['n']))
|
||||
//die(header('Location: main.php?error=1'));
|
||||
@@ -21,10 +32,10 @@ $write = true; //
|
||||
|
||||
$en_fecha = $db->querySingle("SELECT ESTA_EN_PERIODO(NOW()::DATE, :periodo_id)", [':periodo_id' => $user->periodo_id])['esta_en_periodo'];
|
||||
|
||||
$prof_rs = $db->query('SELECT * FROM profesor A WHERE EXISTS (
|
||||
SELECT * FROM horario_view hv join HORARIO_PROFESOR ON hv.HORARIO_ID = HORARIO_PROFESOR.horario_id WHERE HORARIO_PROFESOR.profesor_id = A.profesor_id AND hv.periodo_id = :periodo_id
|
||||
) ORDER BY profesor_nombre', [':periodo_id' => $user->periodo_id]);
|
||||
if($user->jefe_carrera){
|
||||
|
||||
$prof_rs = $db->query('SELECT DISTINCT * FROM fs_profesores(null, null, :fac) ORDER BY PROFESOR_NOMBRE', [':fac' => $user->facultad["facultad_id"]]);
|
||||
}
|
||||
|
||||
//Periodo
|
||||
$periodo_rs = $db->querySingle('SELECT periodo_fecha_inicio, periodo_fecha_fin FROM periodo WHERE periodo_id = :periodo_id', [':periodo_id' => $user->periodo_id]);
|
||||
@@ -42,12 +53,12 @@ else{
|
||||
|
||||
$fecha_man = date("d/m/Y", strtotime("+".$dias." day"));
|
||||
}
|
||||
|
||||
/*
|
||||
// Materias
|
||||
$id_prof = $user->user["id"];
|
||||
$id_prof = $user->profesor;
|
||||
//$facultad_id = 28;
|
||||
$materias_rs = $db->query('SELECT * FROM fs_materiasprofesor(:id)', [':id' => $id_prof]);
|
||||
|
||||
*/
|
||||
if(isset($_POST["fecha_inicial"]))
|
||||
$fecha_ini = $_POST["fecha_inicial"];
|
||||
else
|
||||
@@ -65,36 +76,28 @@ $fecha_fin_db= date("Y-m-d", strtotime($fecha_fin));
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>Reposiciones crear | <?= $user->facultad['facultad'] ?? 'General' ?></title>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="content-type" content="text/plain; charset=UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<?php include_once "import/html_css_files.php"; ?>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Reposiciones crear |
|
||||
<?= $user->facultad['facultad'] ?? "Administrador"; ?>
|
||||
</title>
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"
|
||||
integrity="sha512-iecdLmaskl7CVkqkXNQ/ZH/XLlvWZOJyj7Yy7tcenmpD1ypASozpmT/E0iPtmFIB46ZmdtAc9eNBvH0H/ZpiBw=="
|
||||
crossorigin="anonymous" referrerpolicy="no-referrer" />
|
||||
<?php
|
||||
include 'import/html_css_files.php';
|
||||
?>
|
||||
<link rel="stylesheet" href="css/jquery-ui.css">
|
||||
<link rel="stylesheet" href="css/richtext.css" type="text/css">
|
||||
<link rel="stylesheet" href="css/clockpicker.css">
|
||||
<link rel="stylesheet" href="css/calendar.css">
|
||||
<link rel="stylesheet" href="css/fa_all.css" type="text/css">
|
||||
|
||||
<script src="js/scrollables.js" defer></script>
|
||||
<script>
|
||||
const write = <?= $write ? 'true' : 'false' ?>;
|
||||
</script>
|
||||
<script src="js/moment.js" defer></script>
|
||||
<style>
|
||||
.wizard { height: 20px; width: 80%; background: #D0D0D0; }
|
||||
.wizard.full { background: #D0D0D0; }
|
||||
.wizard.active > div:first-child { background: #00A6CE; }
|
||||
.wizard.active > div:last-child { width: 0px; height: 0px; border-style: solid; border-width: 10px 0 10px 6px; border-color: transparent transparent transparent #00a6ce; transform: rotate(0deg); }
|
||||
</style>
|
||||
<script src="js/jquery.min.js"></script>
|
||||
<script src="js/bootstrap/popper.min.js"></script>
|
||||
<script src="js/bootstrap/bootstrap.min.js"></script>
|
||||
<script src="js/jquery-ui.js"></script>
|
||||
<script src="js/datepicker-es.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
|
||||
<!-- -->
|
||||
|
||||
<body style="display: block;">
|
||||
@@ -105,11 +108,11 @@ $fecha_fin_db= date("Y-m-d", strtotime($fecha_fin));
|
||||
?>
|
||||
|
||||
<main class="container content marco content-margin" id="local-app">
|
||||
<?php if($write==true ) {?>
|
||||
<?php if($write==true && isset($prof_rs) && count($prof_rs)>0) {?>
|
||||
<!-- Botón para abrir el modal -->
|
||||
<div class="row mb-4">
|
||||
<div class="col-12 text-right">
|
||||
<button type="button" class="btn btn-outline-secondary" data-tipo="1" data-toggle="modal" data-target="#modal" <?php if (!$en_fecha || (empty($materias_rs) || count($materias_rs)==0 ) ){ echo "disabled"; } ?>><span class="ing-mas ing-fw"></span>Crear reposición</button>
|
||||
<button type="button" class="btn btn-outline-secondary" data-tipo="1" data-toggle="modal" data-target="#modal" <?php if (!$en_fecha ) { echo "disabled"; } ?>><span class="ing-mas ing-fw"></span>Crear reposición</button>
|
||||
</div>
|
||||
</div>
|
||||
<?php }?>
|
||||
@@ -243,23 +246,23 @@ $fecha_fin_db= date("Y-m-d", strtotime($fecha_fin));
|
||||
<input type="hidden" name="estado" value="1">
|
||||
<div class="form-box">
|
||||
|
||||
<div class="form-group row <?php if(true){ echo "d-none"; }?>" id="profBlock">
|
||||
<div class="form-group row" id="profBlock">
|
||||
<label for="prof" class="col-4 col-form-label">Profesor *</label>
|
||||
<div class="col-8">
|
||||
<div class="datalist datalist-select mb-1 w-100" id="dlProfesor">
|
||||
<div class="datalist-input">Profesores del área</div>
|
||||
<div class="datalist-input">Selecciona un profesor</div>
|
||||
<span class="ing-buscar icono"></span>
|
||||
<ul style="display:none">
|
||||
<?php foreach($prof_rs as $prof){?>
|
||||
<li data-id="<?php echo $prof["id"];?>" <?php if($prof["id"]==$_SESSION["usuario_id"]){ echo "class='selected'";} ?> ><?php echo $prof["profesor"];?></li>
|
||||
<li data-id="<?php echo $prof["profesor_id"];?>" <?php if($prof["profesor_id"]==$user->profesor){ echo "class='selected'";} ?> ><?php echo $prof["profesor_nombre"];?></li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
<input type="hidden" id="prof" name="prof" value="<?php echo $id_prof;?>">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="form-box prof-selected">
|
||||
<div class="form-group row" id="materiaBlock">
|
||||
<label for="horario" class="col-4 col-form-label">Materia *</label>
|
||||
<div class="col-8">
|
||||
@@ -267,11 +270,7 @@ $fecha_fin_db= date("Y-m-d", strtotime($fecha_fin));
|
||||
<div class="datalist-input">Selecciona una materia</div>
|
||||
<span class="ing-buscar icono"></span>
|
||||
<ul style="display:none">
|
||||
<?php foreach($materias_rs as $mat){ ?>
|
||||
<li data-id="<?php echo $mat["horario_id"];?>" data-dia="<?php echo $mat["horario_dia"];?>" data-hr="<?php echo substr($mat["horario_hora"], 0, 2);?>" data-min="<?php echo substr($mat["horario_hora"], 3, 2);?>">
|
||||
<?php echo $mat["materia_nombre"].' - '.$mat["horario_dia_nombre"]." ".substr($mat["horario_hora"], 0, -3);?>
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
</ul>
|
||||
<input type="hidden" id="horario" name="horario" value="">
|
||||
</div>
|
||||
@@ -363,8 +362,8 @@ $fecha_fin_db= date("Y-m-d", strtotime($fecha_fin));
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-box form-box-info materia-block">
|
||||
<div class="form-group row">
|
||||
<div class="form-box form-box-info prof-selected">
|
||||
<div class="form-group row materia-block">
|
||||
<label for="comentario" class="col-4 col-form-label">Comentarios</label>
|
||||
<div class="col-8">
|
||||
<p><i>Requerimientos específicos del salón, software especializado, etc.</i></p>
|
||||
@@ -513,31 +512,10 @@ $fecha_fin_db= date("Y-m-d", strtotime($fecha_fin));
|
||||
<button class="btn btn-secondary" type="button" id="prev-button">Anterior</button>
|
||||
<button class="btn btn-secondary" type="button" id="next-button" disabled data-toggle="modal" data-target="#confirmationModal">Proponer reposición</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal confirmación -->
|
||||
<div class="modal fade" id="confirmationModal" tabindex="-1" role="dialog" aria-labelledby="confirmationModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-sm" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="confirmationModalLabel">Confirmación</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>¿Estás seguro de que deseas proponer la reposición?</p>
|
||||
<small>Recuerda que la aprobará tu jefe de carrera.</small>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-info" onclick="$('#confirmationModal').modal('hide');">Cancelar</button>
|
||||
<button type="button" class="btn btn-primary" data-dismiss="modal">Aceptar</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="modal_confirm" tabindex="-1" role="dialog" aria-labelledby="modal" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
@@ -714,6 +692,7 @@ $fecha_fin_db= date("Y-m-d", strtotime($fecha_fin));
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
$(".prof-selected").hide();
|
||||
//fecha de clase
|
||||
$(".date-picker" ).datepicker(datepickerOptions);
|
||||
$(".date-picker" ).datepicker( $.datepicker.regional[ "es" ] );
|
||||
@@ -726,20 +705,22 @@ $fecha_fin_db= date("Y-m-d", strtotime($fecha_fin));
|
||||
$(".date-picker-future" ).datepicker(datepickerOptions_future);
|
||||
$(".date-picker-future" ).datepicker( $.datepicker.regional[ "es" ] );
|
||||
|
||||
<?php if(/*$_SESSION["jefe_carrera"] ||*/ $user->admin){ ?>
|
||||
function creaOpcion(id_lista, nombre, gpo, dia, hora){
|
||||
return '<li data-id="'+id_lista+'" >'+nombre+' ('+gpo+') - '+dia+' '+hora.substr(0, 5)+'</li>';
|
||||
|
||||
function creaOpcion(id_horario, dia, hora, min, nombre){
|
||||
return '<li data-id="'+id_horario+'" data-dia="'+dia+'" data-hr="'+hora+'" data-min="'+min+'">'+nombre+'</li>';
|
||||
}
|
||||
|
||||
$('#filtro_final').focus(function(){
|
||||
$("#filtro_final").removeClass("is-invalid");
|
||||
});
|
||||
|
||||
//****TODO NO SE ACTIVA AL HACER CLICK */
|
||||
$("#dlProfesor ul li").click(function(){//cambia datalist
|
||||
console.log("CLICK");
|
||||
var pid = $(this).data('id');
|
||||
//busca materias del profesor
|
||||
$.ajax({
|
||||
url: './action/materiasdiaprofesor_select.php',
|
||||
url: './action/reposicion_profesor_materias.php',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: { id: pid, },
|
||||
@@ -747,14 +728,16 @@ $fecha_fin_db= date("Y-m-d", strtotime($fecha_fin));
|
||||
if(result["error"]!= "" && result["error"] !== undefined){
|
||||
triggerMessage(result["error"], "Error");
|
||||
$("#modal").modal('hide');
|
||||
$(".prof-selected").hide();
|
||||
}else{
|
||||
$(".prof-selected").show();
|
||||
$("#dlMateria ul").html("");
|
||||
for(i=0; i<result["materias"].length; i++){
|
||||
var html = creaOpcion(result["materias"][i]["Horario_id"],
|
||||
result["materias"][i]["Materia_desc"],
|
||||
result["materias"][i]["Grupo_desc"]+" "+result["materias"][i]["Carrera_prefijo"],
|
||||
result["materias"][i]["Dia_desc"],
|
||||
result["materias"][i]["Hora_inicio"]
|
||||
var html = creaOpcion(result["materias"][i]["horario_id"],
|
||||
result["materias"][i]["horario_dia"],
|
||||
result["materias"][i]["horario_hora"],
|
||||
result["materias"][i]["horario_min"],
|
||||
result["materias"][i]["materia_nombre"]
|
||||
);
|
||||
$("#dlMateria ul").append(html);
|
||||
}
|
||||
@@ -767,7 +750,7 @@ $fecha_fin_db= date("Y-m-d", strtotime($fecha_fin));
|
||||
});//ajax
|
||||
|
||||
});
|
||||
<?php } ?>
|
||||
|
||||
|
||||
//Actualiza días elegibles de calendario
|
||||
$("#dlMateria ul li").click(function(){//cambia datalist
|
||||
@@ -841,6 +824,9 @@ $fecha_fin_db= date("Y-m-d", strtotime($fecha_fin));
|
||||
$("#modal .is-invalid").removeClass("is-invalid");
|
||||
//$(this).find(".form-control:first-child").focus();
|
||||
|
||||
|
||||
|
||||
|
||||
$("#errorBox").collapse('hide');
|
||||
$("#errorBox_text").html("");
|
||||
if(tipo == 1){//alta
|
||||
|
||||
@@ -185,13 +185,55 @@
|
||||
</td>
|
||||
<td class="text-center align-middle text-nowrap">
|
||||
<!-- data-toggle="button" -->
|
||||
<div v-if="!clase.reposicion_id">
|
||||
<button class="btn text-center mx-2" v-for="estado in estados" :key="estado.id"
|
||||
@click="store.cambiarEstado(clase.horario_id, clase.profesor_id, estado.id === clase.estado_supervisor_id ? null : estado.id)"
|
||||
:class="[{'active': estado.id === clase.estado_supervisor_id}, `btn-outline-${estado.color}`]"
|
||||
:aria-pressed="estado.id === clase.estado_supervisor_id">
|
||||
<i :class="estado.icon"></i>
|
||||
</button>
|
||||
<button class="btn btn-outline-primary text-center mx-2" data-toggle="modal"
|
||||
data-target="#editar-comentario" :class="{ 'active': clase.comentario }"
|
||||
@click="store.selectEditor(clase.horario_id)">
|
||||
<i class="ing-editar"></i>
|
||||
<span class="badge badge-pill badge-primary"
|
||||
v-if="clase.comentario">...</span>
|
||||
<span class="sr-only">Editar comentario</span>
|
||||
</button>
|
||||
</div>
|
||||
<!-- italic -->
|
||||
<div v-else class="text-muted font-italic">
|
||||
Reposición el {{ clase.reposicion_fecha }} a las
|
||||
{{ clase.reposicion_hora.slice(0, 5) }} h en el salón {{ clase.reposicion_salon
|
||||
}}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr v-for="clase in reposiciones" :key="`${clase.horario_id}-${clase.profesor_id}`">
|
||||
<td class="text-center align-middle">{{ clase.salon }}</td>
|
||||
<td class="text-center align-middle">
|
||||
<div class="col-12">
|
||||
{{ clase.profesor_nombre }}
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<button type="button" class="btn btn-outline-dark btn-sm"
|
||||
@click="store.profesor_selected.horario_id = clase.horario_id; store.profesor_selected.profesor_id = clase.profesor_id"
|
||||
data-toggle="modal" data-target="#ver-detalle">
|
||||
Ver detalle <i class="ing-ojo"></i>
|
||||
</button>
|
||||
</div>
|
||||
<td class="text-center align-middle">
|
||||
{{ clase.horario_hora?.slice(0, 5) }} - {{ clase.horario_fin?.slice(0, 5) }}
|
||||
</td>
|
||||
<td class="text-center align-middle text-nowrap">
|
||||
<!-- data-toggle="button" -->
|
||||
<button class="btn text-center mx-2" v-for="estado in estados" :key="estado.id"
|
||||
@click="store.cambiarEstado(clase.horario_id, clase.profesor_id, estado.id === clase.estado_supervisor_id ? null : estado.id)"
|
||||
:class="[{'active': estado.id === clase.estado_supervisor_id}, `btn-outline-${estado.color}`]"
|
||||
:aria-pressed="estado.id === clase.estado_supervisor_id">
|
||||
<i :class="estado.icon"></i>
|
||||
</button>
|
||||
<button class="btn btn-outline-primary text-center mx-2" data-toggle="modal"
|
||||
data-target="#editar-comentario" :class="{ 'active': clase.comentario }"
|
||||
@click="store.selectEditor(clase.horario_id)">
|
||||
@@ -349,7 +391,8 @@
|
||||
<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>
|
||||
<h2 class="modal-title" :data-id="`h${clase_vista.horario_id} - p${clase_vista.profesor_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>
|
||||
@@ -648,6 +691,10 @@
|
||||
const clases = store.rutas.data.find(ruta => ruta.salon_id == store.rutas.selected)?.horarios ?? [];
|
||||
return clases;
|
||||
},
|
||||
get reposiciones() {
|
||||
const reposiciones = store.rutas.data.find(ruta => ruta.salon_id == store.rutas.selected)?.reposiciones ?? [];
|
||||
return reposiciones;
|
||||
},
|
||||
async guardarCambios() {
|
||||
|
||||
try {
|
||||
|
||||
@@ -253,10 +253,14 @@ const store = reactive({
|
||||
if (fecha_fin) params['fecha_fin'] = fecha_fin
|
||||
|
||||
const paramsUrl = new URLSearchParams(params as any).toString()
|
||||
try {
|
||||
const res = await fetch(`action/action_auditoria.php?${paramsUrl}`, {
|
||||
method: 'GET',
|
||||
})
|
||||
this.data = await res.json()
|
||||
} catch (error) {
|
||||
alert('Error al cargar los datos')
|
||||
}
|
||||
this.loading = false
|
||||
store.current.page = 1
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user