All
This commit is contained in:
@@ -14,7 +14,8 @@ $ruta = "../";
|
|||||||
require_once "../include/bd_pdo.php";
|
require_once "../include/bd_pdo.php";
|
||||||
$facultad_id = $user->facultad['facultad_id'];
|
$facultad_id = $user->facultad['facultad_id'];
|
||||||
$carreras = $db->query(
|
$carreras = $db->query(
|
||||||
"SELECT * FROM carrera
|
"SELECT carrera_id, carrera_nombre, clave_carrera
|
||||||
|
FROM carrera
|
||||||
WHERE
|
WHERE
|
||||||
(facultad_id = :facultad_id OR :facultad_id IS NULL)
|
(facultad_id = :facultad_id OR :facultad_id IS NULL)
|
||||||
ORDER BY carrera_nombre DESC",
|
ORDER BY carrera_nombre DESC",
|
||||||
@@ -23,4 +24,4 @@ $carreras = $db->query(
|
|||||||
|
|
||||||
// $user->print_to_log("Crea carrera", old: $_POST);
|
// $user->print_to_log("Crea carrera", old: $_POST);
|
||||||
|
|
||||||
die(json_encode($carreras));
|
die(json_encode($carreras));
|
||||||
@@ -26,9 +26,14 @@ try {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// step 1: get subrutas
|
$data = $db->query(<<<SQL
|
||||||
$data = $db->get('facultad');
|
SELECT facultad_nombre, facultad_id, clave_dependencia
|
||||||
|
FROM facultad
|
||||||
|
WHERE facultad_id = :facultad_id OR :facultad_id IS NULL
|
||||||
|
SQL
|
||||||
|
,
|
||||||
|
[':facultad_id' => $user->facultad['facultad_id']]
|
||||||
|
);
|
||||||
echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
|
echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
|
||||||
} else {
|
} else {
|
||||||
http_response_code(405);
|
http_response_code(405);
|
||||||
|
|||||||
@@ -1,21 +1,41 @@
|
|||||||
<?php
|
<?php
|
||||||
|
header('Content-Type: application/json');
|
||||||
$ruta = "../";
|
$ruta = "../";
|
||||||
require_once "../class/c_login.php";
|
require_once "../class/c_login.php";
|
||||||
|
|
||||||
// check if the session is started
|
// check if the session is started
|
||||||
$user = Login::get_user();
|
if (Login::is_logged())
|
||||||
|
$user = Login::get_user();
|
||||||
|
else {
|
||||||
|
header('HTTP/1.1 401 Unauthorized');
|
||||||
|
echo json_encode(['error' => 'No se ha iniciado sesión']);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
$ruta = "../";
|
$ruta = "../";
|
||||||
require_once("../include/bd_pdo.php");
|
require_once("../include/bd_pdo.php");
|
||||||
extract($_POST);
|
|
||||||
$params = ['per' => $_POST['periodo'], 'fac' => $_POST['facultad'], 'car' => $_POST['carrera']];
|
|
||||||
|
|
||||||
$user->print_to_log("Acceso a grupos", old: $params);
|
if (!isset($_GET['carrera_id'])) {
|
||||||
$grupos = queryAll("SELECT DISTINCT LENGTH(GRUPO), GRUPO FROM fs_horario_basic WHERE PERIODO_ID = COALESCE(:per, PERIODO_ID) AND FACULTAD_ID = COALESCE(:fac, FACULTAD_ID) AND CARRERA_ID = COALESCE(:car, CARRERA_ID) ORDER BY LENGTH(GRUPO), GRUPO", $params);
|
echo json_encode([
|
||||||
|
'status' => 'error',
|
||||||
|
'error' => 'No se ha especificado una carrera'
|
||||||
|
]);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
$grupos = array_map(fn ($grupo) => $grupo['grupo'], $grupos);
|
$grupos = $db->query(<<<SQL
|
||||||
|
SELECT distinct substring(horario_grupo, 7, 3)::int - 1 as horario_grupo FROM horario_view WHERE
|
||||||
|
PERIODO_ID = :periodo_id AND
|
||||||
|
(FACULTAD_ID = :facultad_id OR :facultad_id IS NULL) AND
|
||||||
|
CARRERA_ID = :carrera_id
|
||||||
|
GROUP BY horario_grupo
|
||||||
|
ORDER BY horario_grupo ASC
|
||||||
|
SQL,
|
||||||
|
[
|
||||||
|
':periodo_id' => $user->periodo_id,
|
||||||
|
':facultad_id' => $user->facultad['facultad_id'],
|
||||||
|
':carrera_id' => $_GET['carrera_id']
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
echo json_encode([
|
echo json_encode(array_map(fn($grupo) => $grupo['horario_grupo'], $grupos));
|
||||||
'status' => 'success',
|
|
||||||
'grupos' => $grupos
|
|
||||||
]);
|
|
||||||
@@ -17,20 +17,34 @@ $user = unserialize($_SESSION['user']);
|
|||||||
// check method
|
// check method
|
||||||
try {
|
try {
|
||||||
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||||
if (!isset($_GET['profesor_id'])) {
|
if (!(isset($_GET['profesor_id']) || isset($_GET['grupo']))) {
|
||||||
throw new Exception('missing parameters');
|
throw new Exception('missing parameters');
|
||||||
}
|
}
|
||||||
$data = $db->query(
|
if (isset($_GET['profesor_id'])) {
|
||||||
"SELECT *, (EXTRACT(EPOCH FROM (horario_fin - horario_hora) ) / EXTRACT(EPOCH FROM interval '15 minute'))::INT AS bloques
|
$data = $db->query(
|
||||||
|
"SELECT *, (EXTRACT(EPOCH FROM (horario_fin - horario_hora) ) / EXTRACT(EPOCH FROM interval '15 minute'))::INT AS bloques
|
||||||
FROM horario_view
|
FROM horario_view
|
||||||
JOIN horario_profesor ON horario_profesor.horario_id = horario_view.horario_id
|
JOIN horario_profesor ON horario_profesor.horario_id = horario_view.horario_id
|
||||||
WHERE horario_profesor.profesor_id = :profesor_id
|
WHERE horario_profesor.profesor_id = :profesor_id
|
||||||
AND (facultad_id = :facultad_id OR :facultad_id IS NULL)",
|
AND (facultad_id = :facultad_id OR :facultad_id IS NULL)",
|
||||||
[
|
[
|
||||||
'profesor_id' => $_GET['profesor_id'],
|
'profesor_id' => $_GET['profesor_id'],
|
||||||
'facultad_id' => $user->facultad['facultad_id'],
|
'facultad_id' => $user->facultad['facultad_id'],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
} else if (isset($_GET['grupo'])) {
|
||||||
|
$data = $db->query(
|
||||||
|
"SELECT *, (EXTRACT(EPOCH FROM (horario_fin - horario_hora) ) / EXTRACT(EPOCH FROM interval '15 minute'))::INT AS bloques
|
||||||
|
FROM horario_view
|
||||||
|
WHERE substring(horario_grupo, 7, 3) = (CAST(:grupo AS INT) + 1)::varchar
|
||||||
|
AND (facultad_id = :facultad_id OR :facultad_id IS NULL) AND carrera_id = :carrera_id",
|
||||||
|
[
|
||||||
|
'grupo' => $_GET['grupo'],
|
||||||
|
'facultad_id' => $user->facultad['facultad_id'],
|
||||||
|
'carrera_id' => $_GET['carrera_id'],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$last_query = [
|
$last_query = [
|
||||||
'query' => $db->getLastQuery(),
|
'query' => $db->getLastQuery(),
|
||||||
|
|||||||
@@ -1,26 +1,30 @@
|
|||||||
<?php
|
<?php
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
$ruta = "../";
|
$ruta = "../";
|
||||||
require_once "../class/c_login.php";
|
require_once "../class/c_login.php";
|
||||||
|
|
||||||
extract($_POST);
|
// check if the session is started
|
||||||
# print_r($_POST); exit;
|
|
||||||
|
|
||||||
if (!isset($_SESSION['user']))
|
if (!isset($_SESSION['user']))
|
||||||
die(header('Location: index.php'));
|
die(json_encode(['error' => 'No se ha iniciado sesión']));
|
||||||
|
|
||||||
$user = unserialize($_SESSION['user']);
|
$user = unserialize($_SESSION['user']);
|
||||||
|
|
||||||
if (($access = $user->access('asistencia')) == 'n')
|
$ruta = "../";
|
||||||
die(json_encode(['error' => true]));
|
require_once "../include/bd_pdo.php";
|
||||||
|
$facultad_id = $user->facultad['facultad_id'];
|
||||||
$user->print_to_log('Consultar materias');
|
$materias = $db->query(<<<SQL
|
||||||
$materias = queryAll(
|
SELECT materia_id, materia_nombre, clave_materia, materia.carrera_id
|
||||||
"SELECT id, nombre FROM FS_MATERIA WHERE carrera = COALESCE(:carrera, carrera) ORDER BY nombre",
|
FROM materia
|
||||||
[':carrera' => empty($carrera) ? null : $carrera]
|
JOIN carrera USING (carrera_id)
|
||||||
|
JOIN facultad USING (facultad_id)
|
||||||
|
WHERE
|
||||||
|
(facultad_id = :facultad_id OR :facultad_id IS NULL)
|
||||||
|
ORDER BY carrera_nombre DESC
|
||||||
|
SQL,
|
||||||
|
array('facultad_id' => $facultad_id)
|
||||||
);
|
);
|
||||||
?>
|
|
||||||
|
|
||||||
<?= json_encode([
|
// $user->print_to_log("Crea carrera", old: $_POST);
|
||||||
'status' => 'success',
|
|
||||||
'materias' => $materias,
|
die(json_encode($materias));
|
||||||
]); ?>
|
|
||||||
36
action/carrera.php
Normal file
36
action/carrera.php
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once "{$_SERVER['DOCUMENT_ROOT']}/class/c_login.php";
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
if (!Login::is_logged()) {
|
||||||
|
header('HTTP/1.1 401 Unauthorized');
|
||||||
|
echo json_encode(['error' => 'No se ha iniciado sesión']);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
$user = Login::get_user();
|
||||||
|
|
||||||
|
try {
|
||||||
|
switch ($_SERVER['REQUEST_METHOD']) {
|
||||||
|
case 'GET':
|
||||||
|
// Fetch all puestos
|
||||||
|
$facultad_id = $user->facultad['facultad_id'];
|
||||||
|
$carreras = $db->query(<<<SQL
|
||||||
|
SELECT carrera_id, carrera_nombre, clave_carrera, facultad_id
|
||||||
|
FROM carrera
|
||||||
|
WHERE facultad_id = :facultad_id OR :facultad_id IS NULL
|
||||||
|
SQL, ['facultad_id' => $facultad_id]);
|
||||||
|
echo json_encode($carreras);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
header('HTTP/1.1 405 Method Not Allowed');
|
||||||
|
echo json_encode(['error' => 'Método no permitido']);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
echo json_encode([
|
||||||
|
'error' => $e->getMessage(),
|
||||||
|
'query' => $db->getLastQuery(),
|
||||||
|
'exception' => $e->getTraceAsString()
|
||||||
|
]);
|
||||||
|
}
|
||||||
@@ -26,7 +26,7 @@ try {
|
|||||||
->join('puesto_usuario', 'puesto_usuario.usuario_id = usuario.usuario_id', 'LEFT')
|
->join('puesto_usuario', 'puesto_usuario.usuario_id = usuario.usuario_id', 'LEFT')
|
||||||
->getOne('usuario', ['usuario.usuario_id', 'usuario_nombre', 'usuario_clave']),
|
->getOne('usuario', ['usuario.usuario_id', 'usuario_nombre', 'usuario_clave']),
|
||||||
),
|
),
|
||||||
$db->orderBy('puesto_id', 'desc')
|
$db->orderBy('puesto.nombre', 'desc')
|
||||||
->where('facultad_id', $facultad_id)
|
->where('facultad_id', $facultad_id)
|
||||||
->get(tableName: 'puesto', numRows: count($carreras), columns: 'puesto_id, nombre'),
|
->get(tableName: 'puesto', numRows: count($carreras), columns: 'puesto_id, nombre'),
|
||||||
);
|
);
|
||||||
@@ -61,7 +61,7 @@ try {
|
|||||||
$raw_input = file_get_contents('php://input');
|
$raw_input = file_get_contents('php://input');
|
||||||
$input_data = json_decode($raw_input, true);
|
$input_data = json_decode($raw_input, true);
|
||||||
|
|
||||||
if (!$input_data || !isset($input_data['puesto_id'], $input_data['materias'], $input_data['usuario_id'])) {
|
if (!$input_data || !isset($input_data['puesto_id'], $input_data['materias'])) {
|
||||||
header('HTTP/1.1 400 Bad Request');
|
header('HTTP/1.1 400 Bad Request');
|
||||||
echo json_encode(['error' => 'Datos inválidos']);
|
echo json_encode(['error' => 'Datos inválidos']);
|
||||||
exit();
|
exit();
|
||||||
@@ -77,10 +77,11 @@ try {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->insert('puesto_usuario', [
|
if (isset($input_data['usuario_id']))
|
||||||
'puesto_id' => $input_data['puesto_id'],
|
$db->insert('puesto_usuario', [
|
||||||
'usuario_id' => $input_data['usuario_id'],
|
'puesto_id' => $input_data['puesto_id'],
|
||||||
]);
|
'usuario_id' => $input_data['usuario_id'],
|
||||||
|
]);
|
||||||
|
|
||||||
echo json_encode(['msg' => 'Puesto actualizado exitosamente']);
|
echo json_encode(['msg' => 'Puesto actualizado exitosamente']);
|
||||||
break;
|
break;
|
||||||
@@ -95,7 +96,7 @@ try {
|
|||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->where('puesto_id', $input_data['puesto_id'])->delete('puestos');
|
$db->where('puesto_id', $input_data['puesto_id'])->delete('puesto');
|
||||||
echo json_encode(['msg' => 'Puesto eliminado exitosamente']);
|
echo json_encode(['msg' => 'Puesto eliminado exitosamente']);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -7,12 +7,14 @@ $ruta = "../";
|
|||||||
require_once "../class/c_login.php";
|
require_once "../class/c_login.php";
|
||||||
|
|
||||||
// check if the session is started
|
// check if the session is started
|
||||||
$user = Login::get_user();
|
if (!isset($_SESSION['user']))
|
||||||
|
die('No se ha iniciado sesión');
|
||||||
|
|
||||||
|
$user = unserialize($_SESSION['user']);
|
||||||
|
|
||||||
$pag = "../reposiciones_autorizar.php";
|
$pag = "../reposiciones_autorizar.php";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(!isset($_POST["id"]) || !isset($_POST["edo"]) ){
|
if(!isset($_POST["id"]) || !isset($_POST["edo"]) ){
|
||||||
header("Location: ".$pag."?error=0");
|
header("Location: ".$pag."?error=0");
|
||||||
exit();
|
exit();
|
||||||
@@ -21,30 +23,31 @@ if(!isset($_POST["id"]) || !isset($_POST["edo"]) ){
|
|||||||
$id_repo = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto
|
$id_repo = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto
|
||||||
$edo = filter_input(INPUT_POST, "edo", FILTER_SANITIZE_NUMBER_INT);//limpia texto
|
$edo = filter_input(INPUT_POST, "edo", FILTER_SANITIZE_NUMBER_INT);//limpia texto
|
||||||
if(isset($_POST["salon"]) && $_POST["salon"] != "")
|
if(isset($_POST["salon"]) && $_POST["salon"] != "")
|
||||||
$salon = trim(filter_input(INPUT_POST, "salon", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));//limpia texto
|
$salon = filter_input(INPUT_POST, "salon", FILTER_SANITIZE_NUMBER_INT);//limpia texto
|
||||||
|
|
||||||
$motivo = "";
|
|
||||||
if(isset($_POST["motivo"]) && $_POST["motivo"] != "")
|
|
||||||
$motivo = trim($_POST["motivo"]);
|
|
||||||
|
|
||||||
if($edo == 4){//cancelación
|
if($edo == 4){//cancelación
|
||||||
|
$motivo = "";
|
||||||
|
if(isset($_POST["motivo"]) && $_POST["motivo"] != "")
|
||||||
|
$motivo = trim($_POST["motivo"]);
|
||||||
$db->querySingle('SELECT fu_reposicion_cancela(:id, :motivo)',
|
$db->querySingle('SELECT fu_reposicion_cancela(:id, :motivo)',
|
||||||
[':id' => $id_repo, ':motivo' => $motivo]
|
[':id' => $id_repo, ':motivo' => $motivo]
|
||||||
);
|
);
|
||||||
}else{
|
}else{
|
||||||
if(!empty($salon)){
|
if(!empty($salon)){
|
||||||
$db->querySingle('SELECT fu_reposicion(:id, NULL, NULL, NULL, :sal, :edo, NULL, NULL, NULL, NULL)',
|
$db->querySingle('SELECT fu_reposicion_solicitud(:id, NULL, NULL, NULL, :sal, :edo, NULL, NULL, NULL, NULL)',
|
||||||
[':id' => $id_repo, ':sal' => $salon, ':edo' => $edo]
|
[':id' => $id_repo, ':sal' => $salon, ':edo' => $edo]
|
||||||
);
|
);
|
||||||
}else{
|
}else{
|
||||||
$db->querySingle('SELECT fu_reposicion(:id, NULL, NULL, NULL, NULL, :edo, NULL, NULL, NULL, NULL)',
|
$db->querySingle('SELECT fu_reposicion_solicitud(:id, NULL, NULL, NULL, NULL, :edo, NULL, NULL, NULL, NULL)',
|
||||||
[':id' => $id_repo, ':edo' => $edo]
|
[':id' => $id_repo, ':edo' => $edo]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Obtener datos del usuario que creó la reposición y mandar correo
|
//Obtener datos del usuario que creó la reposición y mandar correo
|
||||||
/*$stmt = $pdo->prepare('Select * from fs_reposicion(:id, :periodo, NULL, NULL, NULL, NULL, NULL, 0, 1)');
|
/*$stmt = $pdo->prepare('Select * from
|
||||||
|
:id, :periodo, NULL, NULL, NULL, NULL, NULL, 0, 1)');
|
||||||
$stmt->bindParam(":id", $id_repo);
|
$stmt->bindParam(":id", $id_repo);
|
||||||
$stmt->bindParam(":periodo", $_SESSION["periodo_id"]);
|
$stmt->bindParam(":periodo", $_SESSION["periodo_id"]);
|
||||||
if(!$stmt->execute()){
|
if(!$stmt->execute()){
|
||||||
|
|||||||
@@ -7,17 +7,20 @@ $ruta = "../";
|
|||||||
require_once "../class/c_login.php";
|
require_once "../class/c_login.php";
|
||||||
|
|
||||||
// check if the session is started
|
// check if the session is started
|
||||||
$user = Login::get_user();
|
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
|
//--- Objeto para validar usuario. El id de usuario lo lee desde sesión
|
||||||
if(!isset($_POST["id"], $_POST["prof"])){
|
if(!isset($_POST["id"])){
|
||||||
$return["error"] = "Error! No se recibió la información necesaria.";
|
$return["error"] = "Error! No se recibió la información necesaria.";
|
||||||
}else{
|
}else{
|
||||||
$id = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto
|
$id = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto
|
||||||
$prof = $user["id"];
|
$creador = $user->user["id"];
|
||||||
|
|
||||||
try{
|
try{
|
||||||
$db->query('SELECT * from fd_reposicion(:id, :prof)', [":id"=> $id, ":prof"=>$prof]);
|
$db->query('SELECT * from fd_reposicion_solicitud(:id, :creador)', [":id"=> $id, ":creador"=>$creador]);
|
||||||
$return["ok"] = "La reposición se borró correctamente";
|
$return["ok"] = "La reposición se borró correctamente";
|
||||||
|
|
||||||
}catch(Exception $e){
|
}catch(Exception $e){
|
||||||
|
|||||||
@@ -55,7 +55,17 @@ $user = unserialize($_SESSION['user']);
|
|||||||
$return["materia"] = $rs["materia_id"];
|
$return["materia"] = $rs["materia_id"];
|
||||||
$return["materia_desc"] = $rs["materia_nombre"];
|
$return["materia_desc"] = $rs["materia_nombre"];
|
||||||
$return["salon"] = $rs["salon_id"];
|
$return["salon"] = $rs["salon_id"];
|
||||||
$return["salon_desc"] = $rs["salon"]=="" ? "-Pendiente-": $rs["salon"];
|
if($rs["salon_id"]==""){
|
||||||
|
$return["salon_desc"] = "Pendiente";
|
||||||
|
}else{
|
||||||
|
$salon_json = json_decode($rs["salon_array"], true);
|
||||||
|
if($salon_json[0]== "UNIVERSIDAD LA SALLE"){
|
||||||
|
unset($salon_json[0]);
|
||||||
|
}
|
||||||
|
$return["salon_desc"] = join(" / ",$salon_json);
|
||||||
|
}
|
||||||
|
|
||||||
|
//$return["salon_desc"] = $rs["salon"]=="" ? "-Pendiente-": $rs["salon"];
|
||||||
$return["ciclo"] = $rs["ciclo"];
|
$return["ciclo"] = $rs["ciclo"];
|
||||||
$return["bloque"] = $rs["bloque"];
|
$return["bloque"] = $rs["bloque"];
|
||||||
$return["profesor"] = $rs["profesor_id"];
|
$return["profesor"] = $rs["profesor_id"];
|
||||||
@@ -69,6 +79,7 @@ $user = unserialize($_SESSION['user']);
|
|||||||
$return["dia"] = date('w', strtotime($rs["fecha_clase"]));
|
$return["dia"] = date('w', strtotime($rs["fecha_clase"]));
|
||||||
$return["motivo_cancelacion"] = $rs["motivo_cancelacion"];
|
$return["motivo_cancelacion"] = $rs["motivo_cancelacion"];
|
||||||
$return["estado"] = $rs["estado_reposicion_id"];
|
$return["estado"] = $rs["estado_reposicion_id"];
|
||||||
|
$return["facultad"] = $rs["facultad_nombre"];
|
||||||
}
|
}
|
||||||
echo json_encode($return);
|
echo json_encode($return);
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -60,7 +60,6 @@ try {
|
|||||||
'reposicion_hora',
|
'reposicion_hora',
|
||||||
'salon_reposicion.salon as reposicion_salon',
|
'salon_reposicion.salon as reposicion_salon',
|
||||||
];
|
];
|
||||||
|
|
||||||
$data = array_map(
|
$data = array_map(
|
||||||
fn($ruta) => array_merge(
|
fn($ruta) => array_merge(
|
||||||
[
|
[
|
||||||
@@ -77,6 +76,8 @@ try {
|
|||||||
->where('horario_dia = EXTRACT(DOW FROM CURRENT_DATE)')
|
->where('horario_dia = EXTRACT(DOW FROM CURRENT_DATE)')
|
||||||
->where('bloque_horario.id', $_GET['bloque_horario_id'])
|
->where('bloque_horario.id', $_GET['bloque_horario_id'])
|
||||||
->where('salon_view.id_espacio_padre', $ruta['id_espacio_sgu'])
|
->where('salon_view.id_espacio_padre', $ruta['id_espacio_sgu'])
|
||||||
|
->orderBy('horario_hora')
|
||||||
|
->orderBy('salon_view.salon')
|
||||||
->get(
|
->get(
|
||||||
'horario_view',
|
'horario_view',
|
||||||
columns: $columns
|
columns: $columns
|
||||||
|
|||||||
28
action/usuarios.php
Normal file
28
action/usuarios.php
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
$ruta = "../";
|
||||||
|
require_once "../class/c_login.php";
|
||||||
|
|
||||||
|
// check if the session is started
|
||||||
|
if (!isset($_SESSION['user']))
|
||||||
|
die(json_encode(['error' => 'No se ha iniciado sesión']));
|
||||||
|
|
||||||
|
$user = unserialize($_SESSION['user']);
|
||||||
|
|
||||||
|
$ruta = "../";
|
||||||
|
require_once "../include/bd_pdo.php";
|
||||||
|
$facultad_id = $user->facultad['facultad_id'];
|
||||||
|
$materias = $db->query(<<<SQL
|
||||||
|
SELECT usuario_id, usuario_nombre, usuario_clave
|
||||||
|
FROM usuario
|
||||||
|
WHERE
|
||||||
|
(facultad_id = :facultad_id OR :facultad_id IS NULL)
|
||||||
|
ORDER BY usuario_nombre ASC
|
||||||
|
SQL,
|
||||||
|
array('facultad_id' => $facultad_id)
|
||||||
|
);
|
||||||
|
|
||||||
|
// $user->print_to_log("Crea carrera", old: $_POST);
|
||||||
|
|
||||||
|
die(json_encode($materias));
|
||||||
@@ -218,7 +218,16 @@
|
|||||||
|
|
||||||
<div class="mt-3 d-flex justify-content-between flex-wrap align-items-center">
|
<div class="mt-3 d-flex justify-content-between flex-wrap align-items-center">
|
||||||
<!-- botón descargar -->
|
<!-- botón descargar -->
|
||||||
<div class="col-md-5 col-12 text-center">
|
<div class="col-md-2 col-12 text-center">
|
||||||
|
<div class="btn-group my-3">
|
||||||
|
<button type="button" class="btn btn-outline-primary mr-3">
|
||||||
|
Justificar profesores
|
||||||
|
<i class="ing-justificar"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- botón descargar -->
|
||||||
|
<div class="col-md-2 col-12 text-center">
|
||||||
<div class="btn-group my-3" v-if="store.registros.relevant.length > 0">
|
<div class="btn-group my-3" v-if="store.registros.relevant.length > 0">
|
||||||
<button type="button" class="btn btn-outline-primary mr-3" @click="store.registros.descargar">
|
<button type="button" class="btn btn-outline-primary mr-3" @click="store.registros.descargar">
|
||||||
Descargar reporte
|
Descargar reporte
|
||||||
@@ -233,7 +242,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- Reporte -->
|
<!-- Reporte -->
|
||||||
<div class="col-md-7 col-12 justify-content-around d-flex align-items-center">
|
<div class="col-md-8 col-12 justify-content-around d-flex align-items-center">
|
||||||
<span v-for="estado in store.estados.data" :class="`text-${estado.estado_color}`"
|
<span v-for="estado in store.estados.data" :class="`text-${estado.estado_color}`"
|
||||||
class="text-center col-2">
|
class="text-center col-2">
|
||||||
<i :class="`${estado.estado_icon} ing-lg`"></i>
|
<i :class="`${estado.estado_icon} ing-lg`"></i>
|
||||||
@@ -313,7 +322,8 @@
|
|||||||
<span class="mr-2" :class="`text-${registro.estado_color}`">
|
<span class="mr-2" :class="`text-${registro.estado_color}`">
|
||||||
<i :class="`${registro.estado_icon} ing-2x`"></i>
|
<i :class="`${registro.estado_icon} ing-2x`"></i>
|
||||||
</span>
|
</span>
|
||||||
<strong v-if="registro.usuario_nombre">{{ registro.usuario_nombre }}</strong>
|
<strong v-if="registro.usuario_nombre">{{ registro.usuario_nombre
|
||||||
|
}}</strong>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12" v-if="registro.registro_fecha_supervisor">
|
<div class="col-12" v-if="registro.registro_fecha_supervisor">
|
||||||
Hora
|
Hora
|
||||||
@@ -452,7 +462,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<strong>Horario:</strong>
|
<strong>Horario:</strong>
|
||||||
{{ clase_vista.horario_hora?.slice(0, 5) }} - {{clase_vista.horario_fin?.slice(0, 5) }}
|
{{ clase_vista.horario_hora?.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>
|
||||||
@@ -602,20 +613,8 @@
|
|||||||
class="text-muted">{{store.current.justificada.profesor_nombre}}</span>
|
class="text-muted">{{store.current.justificada.profesor_nombre}}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row mt-3">
|
<hr>
|
||||||
<div class="col-12">
|
<div class="input-group">
|
||||||
<div class="form-check" v-if="!store.current.justificada.justificacion">
|
|
||||||
<input class="form-check-input" type="checkbox" value="" id="observaciones"
|
|
||||||
v-model="store.current.observaciones">
|
|
||||||
<label class="form-check-label" for="observaciones">
|
|
||||||
¿Deseas añadir observaciones?
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<hr v-if="store.current.observaciones || store.current.justificada.justificacion">
|
|
||||||
<div class="input-group" v-if="store.current.observaciones || store.current.justificada.justificacion">
|
|
||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text text-white bg-primary">Observaciones</span>
|
<span class="input-group-text text-white bg-primary">Observaciones</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -632,7 +631,10 @@
|
|||||||
<i class="ing-cancelar"></i>
|
<i class="ing-cancelar"></i>
|
||||||
Cancelar
|
Cancelar
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="btn btn-primary" data-dismiss="modal" @click="store.justificar">
|
<button type="button" class="btn btn-primary"
|
||||||
|
:disabled="!store.current.justificada.justificacion"
|
||||||
|
:class="{'disabled': !store.current.justificada.justificacion}" data-dismiss="modal"
|
||||||
|
@click="store.justificar">
|
||||||
Justificar
|
Justificar
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -37,29 +37,99 @@ $write = $user->admin || in_array($user->acceso, ['r']);
|
|||||||
include("import/html_header.php");
|
include("import/html_header.php");
|
||||||
html_header("Consultar horario", "Sistema de gestión de checador");
|
html_header("Consultar horario", "Sistema de gestión de checador");
|
||||||
?>
|
?>
|
||||||
<main class="container px-4 mt-4 h-100" id="app" v-cloak @vue:mounted="mounted" style="min-height: 60vh;">
|
<main class="container px-4 mt-4 h-100" id="app" v-cloak @vue:mounted="mounted" style="min-height: 60vh;"
|
||||||
|
v-scope="">
|
||||||
<section id="message"></section>
|
<section id="message"></section>
|
||||||
<? // require('import/periodo.php') ?>
|
<nav>
|
||||||
<div class="form-box">
|
<div class="nav nav-tabs" id="nav-tab" role="tablist">
|
||||||
<div class="form-group row">
|
<button class="nav-link active" id="nav-home-tab" data-toggle="tab" data-target="#nav-home"
|
||||||
<label for="profesor" class="col-4 col-form-label">Seleccionar profesor</label>
|
type="button" role="tab" aria-controls="nav-home" aria-selected="true" @click="horarios.data = []">
|
||||||
<div class="col-6">
|
Horario por profesor
|
||||||
<div class="form-row justify-content-around align-items-center">
|
</button>
|
||||||
<input id="profesor" name="profesor" class="form-control col-11 mr-1 px-2"
|
<button class="nav-link" id="nav-profile-tab" data-toggle="tab" data-target="#nav-profile" type="button"
|
||||||
placeholder="Seleccione un profesor" list="dlProfesor" v-model="profesores.search"
|
role="tab" aria-controls="nav-profile" aria-selected="false" @click="horarios.data = []">
|
||||||
@input="horarios.fetch">
|
Horario por grupo
|
||||||
<button type="button" class="btn btn-outline-danger btn-sm form-control col ml-auto"
|
</button>
|
||||||
@click="profesores.search = null; horarios.data = []">
|
</div>
|
||||||
<i class="ing-borrar"></i>
|
</nav>
|
||||||
</button>
|
<div class="tab-content" id="nav-tabContent">
|
||||||
|
<div class="tab-pane fade show active" id="nav-home" role="tabpanel" aria-labelledby="nav-home-tab">
|
||||||
|
<div class="form-box">
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="profesor" class="col-4 col-form-label">Seleccionar profesor</label>
|
||||||
|
<div class="col-6">
|
||||||
|
<div class="form-row justify-content-around align-items-center">
|
||||||
|
<input id="profesor" name="profesor" class="form-control col-11 mr-1 px-2"
|
||||||
|
placeholder="Seleccione un profesor" list="dlProfesor" v-model="profesores.search"
|
||||||
|
@input="horarios.fetch(null)">
|
||||||
|
<button type="button" class="btn btn-outline-danger btn-sm form-control col ml-auto"
|
||||||
|
@click="profesores.search = null; horarios.data = []">
|
||||||
|
<i class="ing-borrar"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<datalist id="dlProfesor">
|
||||||
|
<option v-for="profesor in profesores.data" :key="profesor.profesor_id"
|
||||||
|
:value="`(${profesor.profesor_clave}) ${profesor.profesor_nombre}`">
|
||||||
|
</datalist>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<datalist id="dlProfesor">
|
</div>
|
||||||
<option v-for="profesor in profesores.data" :key="profesor.profesor_id"
|
</div>
|
||||||
:value="`(${profesor.profesor_clave}) ${profesor.profesor_nombre}`">
|
<div class="tab-pane fade" id="nav-profile" role="tabpanel" aria-labelledby="nav-profile-tab"
|
||||||
</datalist>
|
v-scope="{facultad_id: null, carrera_id: null, grupo: null}">
|
||||||
|
<?
|
||||||
|
require('import/periodo.php');
|
||||||
|
?>
|
||||||
|
<div class="form-box" v-show="facultades.data.every(facultad => facultad.carreras.length > 0)">
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="carrera_id" class="col-4 col-form-label">Carrera</label>
|
||||||
|
<div class="col-6">
|
||||||
|
<div id="dlCarreras" class="datalist datalist-select mb-1 w-100">
|
||||||
|
<div class="datalist-input">
|
||||||
|
Selecciona una carrera
|
||||||
|
</div>
|
||||||
|
<span class="icono ing-buscar"></span>
|
||||||
|
<ul style="display:none">
|
||||||
|
<div v-for="facultad in facultades.data">
|
||||||
|
<li class="not-selectable">
|
||||||
|
{{ facultad.facultad_nombre }}
|
||||||
|
</li>
|
||||||
|
<li v-for="carrera in facultad.carreras" :key="carrera.carrera_id"
|
||||||
|
@click="carrera_id = carrera.carrera_id; facultad_id = facultad.facultad_id; grupo = null">
|
||||||
|
{{ carrera.carrera_nombre }}
|
||||||
|
</li>
|
||||||
|
</div>
|
||||||
|
</ul>
|
||||||
|
<input type="hidden" id="carrera_id" name="id">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-box" v-if="carrera_id">
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="grupo" class="col-4 col-form-label">Grupo</label>
|
||||||
|
<div class="col-6">
|
||||||
|
<div id="dlGrupo" class="datalist datalist-select mb-1 w-100">
|
||||||
|
<div class="datalist-input">
|
||||||
|
Selecciona un grupo
|
||||||
|
</div>
|
||||||
|
<span class="icono ing-buscar"></span>
|
||||||
|
<ul style="display:none">
|
||||||
|
<li v-for="grupo in facultades.data.find(facultad => facultad.facultad_id === facultad_id).carreras.find(carrera => carrera.carrera_id === carrera_id).grupos"
|
||||||
|
@click="grupo = grupo; horarios.fetch(grupo, carrera_id)">
|
||||||
|
{{ grupo }}
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<input type="hidden" id="grupo" name="grupo">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
<div id="btn-excel-horario" class="mb-2 float-right hidden">
|
<div id="btn-excel-horario" class="mb-2 float-right hidden">
|
||||||
<button class="btn btn-outline-secondary " title="Exportar a Excel" v-if="false">
|
<button class="btn btn-outline-secondary " title="Exportar a Excel" v-if="false">
|
||||||
@@ -94,8 +164,7 @@ $write = $user->admin || in_array($user->acceso, ['r']);
|
|||||||
class="align-middle h-100"
|
class="align-middle h-100"
|
||||||
:style="`width: ${(100 - 6) / (horarios.structure?.sábado ? 6 : 5)}%;`">
|
:style="`width: ${(100 - 6) / (horarios.structure?.sábado ? 6 : 5)}%;`">
|
||||||
<!-- Content Container -->
|
<!-- Content Container -->
|
||||||
<div class="overflow-auto"
|
<div class="overflow-auto" :style="`max-height: ${horarios.getHorarioData(hour, block, día)?.bloques * 2}em;
|
||||||
:style="`max-height: ${horarios.getHorarioData(hour, block, día)?.bloques * 2}em;
|
|
||||||
min-height: 2em;
|
min-height: 2em;
|
||||||
`">
|
`">
|
||||||
<div v-if="horarios.getHorarioData(hour, block, día)" class="text-center">
|
<div v-if="horarios.getHorarioData(hour, block, día)" class="text-center">
|
||||||
@@ -111,12 +180,14 @@ $write = $user->admin || in_array($user->acceso, ['r']);
|
|||||||
{{horarios.getHorarioData(hour, block, día)?.materia}}
|
{{horarios.getHorarioData(hour, block, día)?.materia}}
|
||||||
</b>
|
</b>
|
||||||
</div>
|
</div>
|
||||||
<small
|
<small class="text-muted">
|
||||||
class="text-muted">{{horarios.getHorarioData(hour,
|
{{horarios.getHorarioData(hour, block, día)?.carrera}}
|
||||||
block, día)?.carrera}}</small>
|
</small>
|
||||||
<br><span>Salón: </span><small
|
<br>
|
||||||
class="font-weight-lighter text-muted">{{horarios.getHorarioData(hour,
|
<span>Salón: </span>
|
||||||
block, día)?.salon}}</small>
|
<small class="font-weight-lighter text-muted">
|
||||||
|
{{horarios.getHorarioData(hour, block, día)?.salon}}
|
||||||
|
</small>
|
||||||
</div>
|
</div>
|
||||||
<div v-else> </div>
|
<div v-else> </div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -14,10 +14,32 @@ const profesores = reactive({
|
|||||||
return this.data.find((profesor) => profesor.profesor_clave === profesores.clave);
|
return this.data.find((profesor) => profesor.profesor_clave === profesores.clave);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const horarios = reactive({
|
const facultades = reactive({
|
||||||
data: [],
|
data: [],
|
||||||
fetch: async function () {
|
fetch: async function () {
|
||||||
if (profesores.current) {
|
const facultades = await fetch('action/action_facultad.php').then(response => response.json());
|
||||||
|
const carreras = await fetch(`action/carrera.php`).then(response => response.json());
|
||||||
|
this.data = await Promise.all(facultades.map(async (facultad) => ({
|
||||||
|
...facultad,
|
||||||
|
carreras: await Promise.all(carreras.filter((carrera) => carrera.facultad_id === facultad.facultad_id).map(async (carrera) => {
|
||||||
|
const grupos = await fetch(`action/action_grupo.php?carrera_id=${carrera.carrera_id}`).then(response => response.json());
|
||||||
|
return {
|
||||||
|
...carrera,
|
||||||
|
grupos,
|
||||||
|
};
|
||||||
|
})),
|
||||||
|
})));
|
||||||
|
this.data = this.data.filter((facultad) => facultad.carreras.length > 0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const horarios = reactive({
|
||||||
|
data: [],
|
||||||
|
fetch: async function (grupo = null, carrera_id = null) {
|
||||||
|
if (grupo && carrera_id) {
|
||||||
|
const response = await fetch(`action/action_horario.php?grupo=${grupo}&carrera_id=${carrera_id}`);
|
||||||
|
this.data = await response.json();
|
||||||
|
}
|
||||||
|
else if (profesores.current) {
|
||||||
const response = await fetch(`action/action_horario.php?profesor_id=${profesores.current.profesor_id}`);
|
const response = await fetch(`action/action_horario.php?profesor_id=${profesores.current.profesor_id}`);
|
||||||
this.data = await response.json();
|
this.data = await response.json();
|
||||||
}
|
}
|
||||||
@@ -76,7 +98,9 @@ const horarios = reactive({
|
|||||||
const app = createApp({
|
const app = createApp({
|
||||||
profesores,
|
profesores,
|
||||||
horarios,
|
horarios,
|
||||||
|
facultades,
|
||||||
mounted: async function () {
|
mounted: async function () {
|
||||||
await profesores.fetch();
|
await profesores.fetch();
|
||||||
|
await facultades.fetch();
|
||||||
}
|
}
|
||||||
}).mount('#app');
|
}).mount('#app');
|
||||||
|
|||||||
@@ -15,6 +15,31 @@ const app = createApp({
|
|||||||
});
|
});
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
this.puestos.push(data);
|
this.puestos.push(data);
|
||||||
|
// order by puesto.nombre
|
||||||
|
this.puestos.sort((a, b) => a.nombre.localeCompare(b.nombre));
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
alert(`Error: ${error}`);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
to_delete: null,
|
||||||
|
async eliminarPuesto(puesto_id) {
|
||||||
|
try {
|
||||||
|
const res = await fetch('action/puesto.php', {
|
||||||
|
method: 'DELETE',
|
||||||
|
body: JSON.stringify({
|
||||||
|
puesto_id
|
||||||
|
})
|
||||||
|
});
|
||||||
|
const data = await res.json();
|
||||||
|
this.message = data.msg;
|
||||||
|
// after 3 seconds, remove the message
|
||||||
|
setTimeout(() => {
|
||||||
|
this.message = null;
|
||||||
|
}, 3000);
|
||||||
|
this.puestos = this.puestos.filter((p) => p.puesto_id !== puesto_id);
|
||||||
|
// order by puesto.nombre
|
||||||
|
this.puestos.sort((a, b) => a.nombre.localeCompare(b.nombre));
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
alert(`Error: ${error}`);
|
alert(`Error: ${error}`);
|
||||||
|
|||||||
2
logs.php
2
logs.php
@@ -49,7 +49,7 @@
|
|||||||
<?
|
<?
|
||||||
global $db;
|
global $db;
|
||||||
$registros = $db
|
$registros = $db
|
||||||
->where('momento::DATE = CURRENT_DATE')
|
->where('momento::DATE = ' . (isset($_GET['fecha']) ? "'{$_GET['fecha']}'" : 'CURRENT_DATE'))
|
||||||
->orderBy('momento', 'desc')
|
->orderBy('momento', 'desc')
|
||||||
->get('log_registro');
|
->get('log_registro');
|
||||||
|
|
||||||
|
|||||||
351
puestos.php
351
puestos.php
@@ -26,164 +26,243 @@
|
|||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
html_header(
|
html_header(
|
||||||
"Puestos de la {$user->facultad['facultad']}",
|
is_null($user->facultad['facultad_id']) ? "Puestos" : "Puestos de la {$user->facultad['facultad']}",
|
||||||
"Sistema de gestión de checador",
|
"Sistema de gestión de checador",
|
||||||
);
|
);
|
||||||
?>
|
if (!is_null($user->facultad['facultad_id'])) {
|
||||||
|
?>
|
||||||
|
|
||||||
<main class="container-fluid px-4 mt-4" id="app" v-cloak @vue:mounted="mounted" style="min-height: 70vh;"
|
<main class="container-fluid px-4 mt-4" id="app" v-cloak @vue:mounted="mounted" style="min-height: 70vh;"
|
||||||
v-scope="{new_puesto: null}">
|
v-scope="{new_puesto: null}">
|
||||||
|
|
||||||
<div class="alert alert-success" role="alert" v-if="message">
|
<div class="alert alert-success" role="alert" v-if="message">
|
||||||
{{message}}
|
{{message}}
|
||||||
</div>
|
</div>
|
||||||
<div class="justify-content-between align-items-center d-flex mb-4">
|
<div class="justify-content-between align-items-center d-flex mb-4">
|
||||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#nuevo-puesto">
|
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#nuevo-puesto">
|
||||||
<span class="ing-mas"></span>
|
<span class="ing-mas"></span>
|
||||||
Agregar puesto
|
Agregar puesto
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex flex-wrap justify-content-around">
|
|
||||||
<div class="col-6" v-for="puesto in puestos" :key="puesto.puesto_id">
|
<div class="d-flex flex-wrap justify-content-around">
|
||||||
<div class="card text-center"
|
<div class="accordion col-8 mb-4" id="puestos"
|
||||||
v-scope="{selected_carrera_id: -1, current_materia: null, current_encargado: null}">
|
v-scope="{selected_carrera_id: -1, current_materia: null, current_encargado: null}"
|
||||||
<div class="card-header bg-primary text-white font-weight-bold text-uppercase">
|
v-if="puestos.length">
|
||||||
{{puesto.nombre}}
|
<div class="card" v-for="(puesto, index) in puestos" :key="puesto.puesto_id">
|
||||||
</div>
|
<div class="card-header bg-primary" :id="`puesto-${puesto.nombre}`">
|
||||||
<div class="card-body">
|
<h2 class="mb-0">
|
||||||
<!-- Encargado -->
|
<button class="btn btn-link btn-block text-left text-light" type="button"
|
||||||
<div class="form-row justify-content-around align-items-center mb-2">
|
data-toggle="collapse" :data-target="`#puesto-${puesto.puesto_id}`" aria-expanded="true"
|
||||||
<label :for="`encargado-${puesto.puesto_id}`" class="col-3">
|
:aria-controls="`puesto-${puesto.puesto_id}`">
|
||||||
Encargado del área
|
{{puesto.nombre}}
|
||||||
</label>
|
|
||||||
<div id="encargados" class="datalist datalist-select mb-1 col-9">
|
<button type="button" class="btn btn-outline-danger float-right"
|
||||||
<div class="datalist-input" v-if="puesto.encargado">
|
data-target="#eliminar-puesto" data-toggle="modal" @click="to_delete = puesto">
|
||||||
({{puesto.encargado.usuario_clave}}) {{ puesto.encargado.usuario_nombre }}
|
<span class="icono ing-basura"></span>
|
||||||
</div>
|
</button>
|
||||||
<div class="datalist-input" v-else>
|
</button>
|
||||||
Selecciona un encargado
|
</h2>
|
||||||
</div>
|
|
||||||
<span class="icono ing-buscar"></span>
|
|
||||||
<ul style="display:none">
|
|
||||||
<li class="datalist-option" v-for="usuario in usuarios" :key="usuario.usuario_id"
|
|
||||||
:data-id="usuario.usuario_id" style=" white-space: nowrap;"
|
|
||||||
@click="puesto.encargado = usuario"
|
|
||||||
:class="{'selected': puesto.encargado.usuario_id == usuario.usuario_id}">
|
|
||||||
(<small> {{usuario.usuario_clave}} </small>) {{ usuario.usuario_nombre }}
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<input type="hidden" id="encargado_id" name="id">
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
|
||||||
<fieldset class="container d-flex flex-column justify-content-center align-items-center">
|
<div :id="`puesto-${puesto.puesto_id}`" class="collapse" :class="{'show': index == 0}"
|
||||||
<legend>Materias Asignadas <span
|
:aria-labelledby="`puesto-${puesto.nombre}`" data-parent="#puestos">
|
||||||
class="badge badge-secondary">{{puesto.materias.length}}</span></legend>
|
<div class="card-body">
|
||||||
<ul class="list-group overflow-auto col-10" v-if="puesto.materias.length"
|
<!-- Encargado -->
|
||||||
style="max-height: 200px; overflow-y: auto;">
|
<div class="form-row justify-content-around align-items-center mb-2">
|
||||||
<li class="list-group-item list-group-item-action" v-for="materia in puesto.materias"
|
<label :for="`encargado-${puesto.puesto_id}`" class="col-3">
|
||||||
:key="materia.materia_id"
|
Encargado del área
|
||||||
@click="puesto.materias.splice(puesto.materias.indexOf(materia), 1); materias.push(materia)"
|
</label>
|
||||||
style="cursor: pointer;">
|
<div id="encargados" class="datalist datalist-select mb-1 col-9">
|
||||||
<div class="d-flex justify-content-center">
|
<div class="datalist-input" v-if="puesto.encargado">
|
||||||
<div class="col-2">
|
({{puesto.encargado.usuario_clave}}) {{ puesto.encargado.usuario_nombre }}
|
||||||
<span class="icono ing-borrar text-danger"></span>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-10 text-left">
|
<div class="datalist-input" v-else>
|
||||||
{{materia.clave_materia}} - {{materia.materia_nombre}}
|
Selecciona un encargado
|
||||||
</div>
|
</div>
|
||||||
|
<span class="icono ing-buscar"></span>
|
||||||
|
<ul style="display:none">
|
||||||
|
<li class="datalist-option" v-for="usuario in usuarios"
|
||||||
|
:key="usuario.usuario_id" :data-id="usuario.usuario_id"
|
||||||
|
style=" white-space: nowrap;" @click="puesto.encargado = usuario"
|
||||||
|
:class="{'selected': puesto.encargado?.usuario_id == usuario.usuario_id}">
|
||||||
|
(<small> {{usuario.usuario_clave}} </small>) {{ usuario.usuario_nombre }}
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<input type="hidden" id="encargado_id" name="id">
|
||||||
</div>
|
</div>
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<div class="alert alert-light" role="alert" v-else>
|
|
||||||
No hay materias asignadas
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
|
||||||
<hr>
|
|
||||||
|
|
||||||
<div class="form-row justify-content-around align-items-center mb-2" v-show="carreras.length">
|
|
||||||
<label :for="`carrera-${puesto.puesto_id}`" class="col-3">
|
|
||||||
Carrera
|
|
||||||
</label>
|
|
||||||
<div id="dlCarreras" class="datalist datalist-select mb-1 col-9">
|
|
||||||
<div class="datalist-input">
|
|
||||||
Selecciona una carrera
|
|
||||||
</div>
|
</div>
|
||||||
<span class="icono ing-buscar"></span>
|
<hr>
|
||||||
<ul style="display:none">
|
|
||||||
<li class="datalist-option" data-id="0" @click="selected_carrera_id = 0">
|
<div class="form-row justify-content-around align-items-center mb-2"
|
||||||
Todas las carreras
|
v-show="carreras.length">
|
||||||
</li>
|
<label :for="`carrera-${puesto.puesto_id}`" class="col-3">
|
||||||
<li class="datalist-option" v-for="carrera in carreras" :key="carrera.carrera_id"
|
Carrera
|
||||||
:data-id="carrera.carrera_id" style=" white-space: nowrap;"
|
</label>
|
||||||
@click="selected_carrera_id = carrera.carrera_id">
|
<div id="dlCarreras" class="datalist datalist-select mb-1 col-9">
|
||||||
(<small> {{carrera.clave_carrera}} </small>) {{ carrera.carrera_nombre }}
|
<div class="datalist-input">
|
||||||
</li>
|
Selecciona una carrera
|
||||||
</ul>
|
</div>
|
||||||
<input type="hidden" id="carrera_id" name="id">
|
<span class="icono ing-buscar"></span>
|
||||||
</div>
|
<ul style="display:none">
|
||||||
</div>
|
<li class="datalist-option" data-id="0" @click="selected_carrera_id = 0">
|
||||||
<div class="form-row justify-content-around align-items-center"
|
Todas las carreras
|
||||||
v-scope="{to_add_materia: null}">
|
</li>
|
||||||
<label :for="`materias-${puesto.puesto_id}`" class="col-3">
|
<li class="datalist-option" v-for="carrera in carreras"
|
||||||
Materias
|
:key="carrera.carrera_id" :data-id="carrera.carrera_id"
|
||||||
</label>
|
style=" white-space: nowrap;"
|
||||||
<input name="materia" placeholder="Seleccione una materia" list="datalist-materias"
|
@click="selected_carrera_id = carrera.carrera_id">
|
||||||
class="form-control col-9 " v-model="current_materia" @input="to_add_materia = materias.find(m => current_materia == `${m.clave_materia} - ${m.materia_nombre}`);
|
(<small> {{carrera.clave_carrera}} </small>) {{ carrera.carrera_nombre }}
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<input type="hidden" id="carrera_id" name="id">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-row justify-content-around align-items-center"
|
||||||
|
v-scope="{to_add_materia: null}">
|
||||||
|
<label :for="`materias-${puesto.puesto_id}`" class="col-3">
|
||||||
|
Materias
|
||||||
|
</label>
|
||||||
|
<input name="materia" placeholder="Seleccione una materia" list="datalist-materias"
|
||||||
|
class="form-control col-9 " v-model="current_materia" @input="to_add_materia = materias.find(m => current_materia == `${m.clave_materia} - ${m.materia_nombre}`);
|
||||||
if (to_add_materia) {
|
if (to_add_materia) {
|
||||||
|
if (puesto.materias.find(p => p.materia_id == to_add_materia.materia_id)) {
|
||||||
|
console.log('La materia ya está asignada');
|
||||||
|
current_materia = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
puesto.materias.push(to_add_materia);
|
puesto.materias.push(to_add_materia);
|
||||||
materias.splice(materias.indexOf(to_add_materia), 1);
|
materias.splice(materias.indexOf(to_add_materia), 1);
|
||||||
current_materia = null;
|
current_materia = null;
|
||||||
}" :disabled="selected_carrera_id == -1" v-model="current_materia"
|
}" :disabled="selected_carrera_id == -1" v-model="current_materia"
|
||||||
:id="`materias-${puesto.puesto_id}`">
|
:id="`materias-${puesto.puesto_id}`" autocomplete="off">
|
||||||
</div>
|
</div>
|
||||||
<datalist id="datalist-materias">
|
<datalist id="datalist-materias">
|
||||||
<option
|
<option
|
||||||
v-for="materia in materias.filter(m => selected_carrera_id == 0 || m.carrera_id == selected_carrera_id)"
|
v-for="materia in materias.filter(m => selected_carrera_id == 0 || m.carrera_id == selected_carrera_id).filter(m => !puesto.materias.find(p => p.materia_id == m.materia_id))"
|
||||||
:value="`${materia.clave_materia} - ${materia.materia_nombre}`">
|
:value="`${materia.clave_materia} - ${materia.materia_nombre}`">
|
||||||
</datalist>
|
</datalist>
|
||||||
</div>
|
|
||||||
<div class="card-footer text-muted">
|
<hr>
|
||||||
<button type="button" class="btn btn-outline-primary btn-lg btn-block" v-if="puesto.encargado"
|
<fieldset class="container d-flex flex-column justify-content-center align-items-center">
|
||||||
@click="actualizarPuesto(puesto.puesto_id, puesto.materias, puesto.encargado.usuario_id)">
|
<legend>Materias Asignadas <span
|
||||||
Guardar cambios
|
class="badge badge-secondary">{{puesto.materias.length}}</span></legend>
|
||||||
</button>
|
<ul class="list-group overflow-auto col-10" v-if="puesto.materias.length"
|
||||||
</div>
|
style="max-height: 200px; overflow-y: auto;">
|
||||||
</div>
|
<li class="list-group-item list-group-item-action"
|
||||||
</div>
|
v-for="materia in puesto.materias" :key="materia.materia_id"
|
||||||
</div>
|
@click="puesto.materias.splice(puesto.materias.indexOf(materia), 1); materias.push(materia)"
|
||||||
|
style="cursor: pointer;">
|
||||||
|
<div class="d-flex justify-content-center">
|
||||||
|
<div class="col-2 text-center">
|
||||||
|
<span class="icono ing-borrar text-danger"></span>
|
||||||
|
</div>
|
||||||
|
<div class="col-10 text-left">
|
||||||
|
{{materia.clave_materia}} - {{materia.materia_nombre}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<div class="alert alert-light" role="alert" v-else>
|
||||||
|
No hay materias asignadas
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
<div class="modal" tabindex="-1" role="dialog" accesskey="a" id="nuevo-puesto">
|
|
||||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header text-white">
|
|
||||||
<h5 class="modal-title">Agregar un nuevo puesto</h5>
|
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
||||||
<span aria-hidden="true" class="text-white">×</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<fieldset>
|
|
||||||
<legend>Nombre del puesto</legend>
|
|
||||||
<div class="form-row">
|
|
||||||
<input type="text" class="form-control" v-model="new_puesto"
|
|
||||||
placeholder="Área del puesto">
|
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
<div class="card-footer text-muted">
|
||||||
|
<!-- scroll to top -->
|
||||||
|
<button type="button" class="btn btn-outline-primary btn-lg btn-block"
|
||||||
|
@click="actualizarPuesto(puesto.puesto_id, puesto.materias, puesto.encargado?.usuario_id)"
|
||||||
|
onclick="window.scrollTo(0, 0);">
|
||||||
|
{{ puesto.encargado ? 'Guardar cambios' : 'Guardar sin encargado' }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
</div>
|
||||||
<button type="button" class="btn btn-outline-danger" data-dismiss="modal"
|
<div v-else>
|
||||||
@click="new_puesto = null">Cancelar</button>
|
<div class="alert alert-dark" role="alert">
|
||||||
<button type="button" class="btn btn-primary" data-dismiss="modal"
|
No hay puestos registrados
|
||||||
@click="nuevoPuesto(new_puesto)">Guardar</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</main>
|
|
||||||
|
|
||||||
<? include "import/html_footer.php"; ?>
|
<div class="modal" tabindex="-1" role="dialog" accesskey="a" id="nuevo-puesto">
|
||||||
|
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header text-white">
|
||||||
|
<h5 class="modal-title">Agregar un nuevo puesto</h5>
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
|
<span aria-hidden="true" class="text-white">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<fieldset>
|
||||||
|
<legend>Nombre del puesto</legend>
|
||||||
|
<div class="form-row">
|
||||||
|
<input type="text" class="form-control" v-model="new_puesto"
|
||||||
|
placeholder="Área del puesto">
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-outline-danger" data-dismiss="modal"
|
||||||
|
@click="new_puesto = null">Cancelar</button>
|
||||||
|
<button type="button" class="btn btn-primary" data-dismiss="modal"
|
||||||
|
@click="nuevoPuesto(new_puesto); new_puesto = null">Guardar</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal" tabindex="-1" role="dialog" accesskey="a" id="eliminar-puesto">
|
||||||
|
<div class="modal-dialog modal-dialog-centered" role="document" v-if="to_delete">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header text-white">
|
||||||
|
<h5 class="modal-title">Eliminar puesto</h5>
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
|
<span aria-hidden="true" class="text-white">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<fieldset>
|
||||||
|
<legend>¿Estás seguro de que deseas eliminar el puesto?</legend>
|
||||||
|
<p>Esta acción no se puede deshacer. Se perderán las asignaciones de materias y de
|
||||||
|
encargado.</p>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-outline-danger" data-dismiss="modal"
|
||||||
|
@click="new_puesto = null">Cancelar</button>
|
||||||
|
<button type="button" class="btn btn-danger" data-dismiss="modal"
|
||||||
|
@click="eliminarPuesto(to_delete.puesto_id)">Eliminar</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<?
|
||||||
|
} else {
|
||||||
|
?>
|
||||||
|
<main class="container mt-5" style="min-height: 70vh;">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-8 offset-md-2">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header text-white bg-danger">
|
||||||
|
Sin Facultad Asociada
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title">Atención</h5>
|
||||||
|
<p class="card-text">No tienes una facultad asociada a tu perfil. El rol
|
||||||
|
<?= $user->rol['rol'] ?> no tiene acceso a esta sección.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
<? }
|
||||||
|
include "import/html_footer.php"; ?>
|
||||||
<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>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ if (!isset($_SESSION['user'])){
|
|||||||
$user = Login::get_user();
|
$user = Login::get_user();
|
||||||
|
|
||||||
$user->access();
|
$user->access();
|
||||||
echo $user;
|
//echo $user;
|
||||||
/*print_r($user);
|
/*print_r($user);
|
||||||
print_r($user->user["id"]);
|
print_r($user->user["id"]);
|
||||||
echo "****|";
|
echo "****|";
|
||||||
@@ -53,7 +53,7 @@ if($user->periodo_id!= ""){
|
|||||||
$carrera_rs = $db->query('SELECT * FROM fs_profesor_facultad(NULL, :periodo)', [ ':periodo' => $user->periodo_id]);
|
$carrera_rs = $db->query('SELECT * FROM fs_profesor_facultad(NULL, :periodo)', [ ':periodo' => $user->periodo_id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$salones_rs = $db->query('SELECT * FROM salon_view WHERE tiene_salones IS true');
|
$salones_rs = $db->query('SELECT * from salon_view where es_salon is true');
|
||||||
|
|
||||||
//Periodo
|
//Periodo
|
||||||
$periodo_rs = $db->querySingle('SELECT periodo_fecha_inicio, periodo_fecha_fin FROM periodo WHERE periodo_id = :periodo_id', [':periodo_id' => $user->periodo_id]);
|
$periodo_rs = $db->querySingle('SELECT periodo_fecha_inicio, periodo_fecha_fin FROM periodo WHERE periodo_id = :periodo_id', [':periodo_id' => $user->periodo_id]);
|
||||||
@@ -227,7 +227,7 @@ if($user->periodo_id!= ""){
|
|||||||
<a class="nav-link" id="tab3-tab" data-toggle="tab" href="#tab3" role="tab" aria-controls="lista" aria-selected="false">Autorizadas por Vicerrectoría</a>
|
<a class="nav-link" id="tab3-tab" data-toggle="tab" href="#tab3" role="tab" aria-controls="lista" aria-selected="false">Autorizadas por Vicerrectoría</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" id="tab4-tab" data-toggle="tab" href="#tab4" role="tab" aria-controls="lista" aria-selected="false">Rechazadas</a>
|
<a class="nav-link" id="tab4-tab" data-toggle="tab" href="#tab4" role="tab" aria-controls="lista" aria-selected="false">Declinadas</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="tab-content" id="TabContent">
|
<div class="tab-content" id="TabContent">
|
||||||
@@ -303,7 +303,8 @@ if($user->periodo_id!= ""){
|
|||||||
</td>
|
</td>
|
||||||
<td class="text-center align-middle"><?php
|
<td class="text-center align-middle"><?php
|
||||||
if($reposicion["salon_id"] != ""){
|
if($reposicion["salon_id"] != ""){
|
||||||
echo $reposicion["salon_id"];
|
$salon_json = json_decode($reposicion["salon_array"], true);
|
||||||
|
echo $salon_json[count($salon_json)-1];
|
||||||
}else
|
}else
|
||||||
echo "Pendiente";
|
echo "Pendiente";
|
||||||
?>
|
?>
|
||||||
@@ -313,13 +314,13 @@ if($user->periodo_id!= ""){
|
|||||||
<td class="text-center align-middle icono-acciones text-nowrap">
|
<td class="text-center align-middle icono-acciones text-nowrap">
|
||||||
<?php if (duracionMinutos($reposicion["fecha_nueva"], date("Y-m-d H:i:00")) < 0){ ?>
|
<?php if (duracionMinutos($reposicion["fecha_nueva"], date("Y-m-d H:i:00")) < 0){ ?>
|
||||||
<?php //no se cumple la fecha de la reposicion, es jefe de carrera
|
<?php //no se cumple la fecha de la reposicion, es jefe de carrera
|
||||||
if(($user->jefe_carrera || $user->admin) && $reposicion["estado_reposicion_id"] == 1){?>
|
if((!$user->jefe_carrera || $user->admin || !$coordinador) && $reposicion["estado_reposicion_id"] == 1){?>
|
||||||
<a href="#" data-toggle="modal" data-target="#modal_aprobar" data-tipo="2" title="Aprobar"><?php echo $ICO["ver"];?></a>
|
<a href="#" data-toggle="modal" data-target="#modal_aprobar" data-tipo="2" title="Aprobar"><?php echo $ICO["ver"];?></a>
|
||||||
<?php } //no se cumple la fecha de la reposicion, no es jefe de carrera
|
<?php } //no se cumple la fecha de la reposicion, no es jefe de carrera
|
||||||
else if((!$user->jefe_carrera || $user->admin) && $reposicion["estado_reposicion_id"] >= 2){?>
|
else if(($supervisor || $user->admin) && $reposicion["estado_reposicion_id"] == 2){?>
|
||||||
<a href="#" data-toggle="modal" data-target="#modal_aprobar" data-tipo="3" title="Autorizar" ><?php echo $ICO["ver"];?></a>
|
<a href="#" data-toggle="modal" data-target="#modal_aprobar" data-tipo="3" title="Autorizar" ><?php echo $ICO["ver"];?></a>
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
<a href="#" data-toggle="modal" data-target="#modal_aprobar" data-tipo="1" title="Aprobar"><?php echo $ICO["ver"];?></a>
|
<a href="#" data-toggle="modal" data-target="#modal_aprobar" data-tipo="1" title="Ver detalle"><?php echo $ICO["ver"];?></a>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php
|
<?php
|
||||||
}else{ //fecha ya pasó?>
|
}else{ //fecha ya pasó?>
|
||||||
@@ -375,6 +376,14 @@ if($user->periodo_id!= ""){
|
|||||||
<p class="rep-prof"></p>
|
<p class="rep-prof"></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-6 col-sm-4 barra-right text-right">
|
||||||
|
<p class="font-weight-bold">Dependencia</p>
|
||||||
|
</div>
|
||||||
|
<div class="col-6">
|
||||||
|
<p class="rep-fac"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-6 col-sm-4 barra-right text-right">
|
<div class="col-6 col-sm-4 barra-right text-right">
|
||||||
<p class="font-weight-bold">Materia</p>
|
<p class="font-weight-bold">Materia</p>
|
||||||
@@ -461,13 +470,18 @@ if($user->periodo_id!= ""){
|
|||||||
<?php
|
<?php
|
||||||
foreach ($salones_rs as $salon) {
|
foreach ($salones_rs as $salon) {
|
||||||
extract($salon);
|
extract($salon);
|
||||||
|
$salon_json = json_decode($salon_array, true);
|
||||||
|
if($salon_json[0]== "UNIVERSIDAD LA SALLE"){
|
||||||
|
unset($salon_json[0]);
|
||||||
|
}
|
||||||
|
$salon_nombre = join(" / ",$salon_json);
|
||||||
?>
|
?>
|
||||||
<option data-id="<?= $salon_id ?>" data-nombre="<?= $salon ?>" value="<?= $salon ?>"></option>
|
<option data-id="<?= $salon_id ?>" data-nombre="<?= $salon_nombre ?>" value="<?= $salon_nombre ?>"></option>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</datalist>
|
</datalist>
|
||||||
<ul class="list-group" id="salones"></ul>
|
<!-- <ul class="list-group" id="salones"></ul> -->
|
||||||
<input type="hidden" id="salon" name="salon" value="">
|
<input type="hidden" id="salon" name="salon" value="">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -610,6 +624,27 @@ if($user->periodo_id!= ""){
|
|||||||
$("#motivo").val("")
|
$("#motivo").val("")
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$('#dlSalon').on('change', function() {
|
||||||
|
const selectedValue = $(this).val();
|
||||||
|
//console.log(selectedValue)
|
||||||
|
const selectedOption = $(`option[value="${selectedValue}"]`);
|
||||||
|
//console.log(selectedOption.length)
|
||||||
|
|
||||||
|
const salonesList = $('#salones');
|
||||||
|
|
||||||
|
if (selectedOption.length) {
|
||||||
|
const salonId = selectedOption.data('id');
|
||||||
|
$('#salon').val(salonId);
|
||||||
|
//const salonNombre = selectedOption.data('nombre');
|
||||||
|
//salonesList.html(`<li class="list-group-item">${salonNombre}</li>`);
|
||||||
|
} else {
|
||||||
|
$('#salon').val('');
|
||||||
|
//salonesList.empty();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$('#modal_aprobar').on('show.bs.modal', function (event) {
|
$('#modal_aprobar').on('show.bs.modal', function (event) {
|
||||||
var button = $(event.relatedTarget); // Button that triggered the modal
|
var button = $(event.relatedTarget); // Button that triggered the modal
|
||||||
var id = button.parents("tr").data("id");
|
var id = button.parents("tr").data("id");
|
||||||
@@ -619,7 +654,6 @@ if($user->periodo_id!= ""){
|
|||||||
$("#edo").val(edo);
|
$("#edo").val(edo);
|
||||||
$("#id").val(id);
|
$("#id").val(id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: './action/reposicion_select.php',
|
url: './action/reposicion_select.php',
|
||||||
@@ -631,8 +665,9 @@ if($user->periodo_id!= ""){
|
|||||||
triggerMessage(result["error"], "Error");
|
triggerMessage(result["error"], "Error");
|
||||||
$('#modal_aprobar').modal("hide");
|
$('#modal_aprobar').modal("hide");
|
||||||
}else{
|
}else{
|
||||||
|
$("#dlSalon").val("");
|
||||||
$("#modal_aprobar .rep-prof").text(result["profesor_nombre"]);
|
$("#modal_aprobar .rep-prof").text(result["profesor_nombre"]);
|
||||||
|
$("#modal_aprobar .rep-fac").text(result["facultad"]);
|
||||||
$("#modal_aprobar .rep-mat").text(result["materia_desc"]);
|
$("#modal_aprobar .rep-mat").text(result["materia_desc"]);
|
||||||
$("#modal_aprobar .rep-ciclo").text(result["ciclo"]);
|
$("#modal_aprobar .rep-ciclo").text(result["ciclo"]);
|
||||||
$("#modal_aprobar .rep-bloque").text(result["bloque"]);
|
$("#modal_aprobar .rep-bloque").text(result["bloque"]);
|
||||||
@@ -663,23 +698,30 @@ if($user->periodo_id!= ""){
|
|||||||
if(edo == 1){// 1 ver
|
if(edo == 1){// 1 ver
|
||||||
$("#modalLabel").text("Detalle de reposición");
|
$("#modalLabel").text("Detalle de reposición");
|
||||||
$(".aprobar-block").hide();
|
$(".aprobar-block").hide();
|
||||||
|
|
||||||
|
/*if(parseInt($("#modal_aprobar .rep-aula").data("aula")) != 1){//tipo aula 1 (salon normal) - ver
|
||||||
|
$("#salon-ver").hide();
|
||||||
|
$("#salon-editar").show();
|
||||||
|
}else{
|
||||||
|
$("#salon-ver").show();
|
||||||
|
$("#salon-editar").hide();
|
||||||
|
}*/
|
||||||
$("#salon-ver").show();
|
$("#salon-ver").show();
|
||||||
$("#salon-editar").hide();
|
$("#salon-editar").hide();
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
if(parseInt($("#modal_aprobar .rep-aula").data("aula")) == 1){//tipo aula 1 (salon normal) - ver
|
$("#modalLabel").text("Aprobar reposición");
|
||||||
$("#modalLabel").text("Detalle de reposición");
|
$(".aprobar-block").show();
|
||||||
$(".aprobar-block").hide();
|
|
||||||
|
if(edo == 2 && parseInt($("#modal_aprobar .rep-aula").data("aula")) == 1){//tipo aula 1 (salon normal) - ver
|
||||||
|
$("#salon-ver").show();
|
||||||
|
$("#salon-editar").hide();
|
||||||
|
}else if(edo == 3 && parseInt($("#modal_aprobar .rep-aula").data("aula")) != 1){//aprobar (con salón especial)
|
||||||
$("#salon-ver").show();
|
$("#salon-ver").show();
|
||||||
$("#salon-editar").hide();
|
$("#salon-editar").hide();
|
||||||
}else{
|
}else{
|
||||||
$("#modalLabel").text("Aprobar reposición");
|
$("#salon-ver").hide();
|
||||||
$(".aprobar-block").show();
|
$("#salon-editar").show();
|
||||||
if(edo == 3){//aprobar (con salón)
|
|
||||||
$("#salon-ver").hide();
|
|
||||||
$("#salon-editar").show();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ if ($user->acceso === null && !$user->admin){
|
|||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//if (!$user->admin && in_array($user->acceso, ['n']))
|
//if (!$user->admin && in_array($user->acceso, ['n']))
|
||||||
//die(header('Location: main.php?error=1'));
|
//die(header('Location: main.php?error=1'));
|
||||||
//$user->print_to_log('Reposiciones');
|
//$user->print_to_log('Reposiciones');
|
||||||
@@ -34,51 +33,59 @@ $write = true; //
|
|||||||
|
|
||||||
$en_fecha = $db->querySingle("SELECT ESTA_EN_PERIODO(NOW()::DATE, :periodo_id)", [':periodo_id' => $user->periodo_id])['esta_en_periodo'];
|
$en_fecha = $db->querySingle("SELECT ESTA_EN_PERIODO(NOW()::DATE, :periodo_id)", [':periodo_id' => $user->periodo_id])['esta_en_periodo'];
|
||||||
|
|
||||||
if($user->jefe_carrera){
|
//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"]]);
|
//$prof_rs = $db->query('SELECT DISTINCT * FROM fs_profesores(null, null, :fac) ORDER BY PROFESOR_NOMBRE', [':fac' => $user->facultad["facultad_id"]]);
|
||||||
}
|
$prof_rs = $db->query('SELECT DISTINCT PROFESOR.* FROM PUESTO_USUARIO
|
||||||
|
JOIN PUESTO_MATERIA USING (PUESTO_ID)
|
||||||
|
JOIN HORARIO_VIEW USING (MATERIA_ID)
|
||||||
|
JOIN HORARIO_PROFESOR USING (HORARIO_ID)
|
||||||
|
JOIN PROFESOR USING (PROFESOR_ID)
|
||||||
|
WHERE USUARIO_ID = :usr', [':usr' => $user->user["id"]]);
|
||||||
|
//}
|
||||||
|
|
||||||
//Duraciones
|
//Duraciones
|
||||||
$duracion_rs = $db->query("select * from duracion order by duracion_interval");
|
$duracion_rs = $db->query("select * from duracion order by duracion_interval");
|
||||||
|
|
||||||
//Periodo
|
if(!is_null($user->periodo_id)){
|
||||||
$periodo_rs = $db->querySingle('SELECT periodo_fecha_inicio, periodo_fecha_fin FROM periodo WHERE periodo_id = :periodo_id', [':periodo_id' => $user->periodo_id]);
|
//Periodo
|
||||||
$periodo_fin = $periodo_rs["periodo_fecha_fin"];
|
$periodo_rs = $db->querySingle('SELECT periodo_fecha_inicio, periodo_fecha_fin FROM periodo WHERE periodo_id = :periodo_id', [':periodo_id' => $user->periodo_id]);
|
||||||
if(strtotime($periodo_rs["periodo_fecha_inicio"])>strtotime(date("Y-m-d")) )
|
$periodo_fin = $periodo_rs["periodo_fecha_fin"];
|
||||||
$fecha_man = date("d/m/Y", strtotime($periodo_rs["periodo_fecha_inicio"]));
|
if(strtotime($periodo_rs["periodo_fecha_inicio"])>strtotime(date("Y-m-d")) )
|
||||||
else{
|
$fecha_man = date("d/m/Y", strtotime($periodo_rs["periodo_fecha_inicio"]));
|
||||||
$dias = 3;
|
else{
|
||||||
if( intval(date("w")) >=3 && intval(date("w"))<=5 )//Mie a Vie
|
$dias = 3;
|
||||||
$dias+=3;
|
if( intval(date("w")) >=3 && intval(date("w"))<=5 )//Mie a Vie
|
||||||
else if( intval(date("w")) ==6 )//Sab
|
$dias+=3;
|
||||||
$dias+=2;
|
else if( intval(date("w")) ==6 )//Sab
|
||||||
else if( intval(date("w")) ==0 )//Do
|
$dias+=2;
|
||||||
$dias+=1;
|
else if( intval(date("w")) ==0 )//Do
|
||||||
|
$dias+=1;
|
||||||
$fecha_man = date("d/m/Y", strtotime("+".$dias." day"));
|
|
||||||
|
$fecha_man = date("d/m/Y", strtotime("+".$dias." day"));
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
// Materias
|
||||||
|
$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
|
||||||
|
$fecha_ini = date("d/m/Y", strtotime($periodo_rs["periodo_fecha_inicio"]));
|
||||||
|
|
||||||
|
if(isset($_POST["fecha_final"]))
|
||||||
|
$fecha_fin = $_POST["fecha_final"];
|
||||||
|
else
|
||||||
|
$fecha_fin = date("d/m/Y", strtotime($periodo_rs["periodo_fecha_fin"]));
|
||||||
|
|
||||||
|
$date = DateTime::createFromFormat('d/m/Y', $fecha_ini);
|
||||||
|
$fecha_ini_db = $date->format('Y-m-d');
|
||||||
|
|
||||||
|
$date = DateTime::createFromFormat('d/m/Y', $fecha_fin);
|
||||||
|
$fecha_fin_db = $date->format('Y-m-d');
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
// Materias
|
|
||||||
$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
|
|
||||||
$fecha_ini = date("d/m/Y", strtotime($periodo_rs["periodo_fecha_inicio"]));
|
|
||||||
|
|
||||||
if(isset($_POST["fecha_final"]))
|
|
||||||
$fecha_fin = $_POST["fecha_final"];
|
|
||||||
else
|
|
||||||
$fecha_fin = date("d/m/Y", strtotime($periodo_rs["periodo_fecha_fin"]));
|
|
||||||
|
|
||||||
$date = DateTime::createFromFormat('d/m/Y', $fecha_ini);
|
|
||||||
$fecha_ini_db = $date->format('Y-m-d');
|
|
||||||
|
|
||||||
$date = DateTime::createFromFormat('d/m/Y', $fecha_fin);
|
|
||||||
$fecha_fin_db = $date->format('Y-m-d');
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
@@ -132,7 +139,7 @@ $fecha_fin_db = $date->format('Y-m-d');
|
|||||||
<?php }?>
|
<?php }?>
|
||||||
<section id="message"></section>
|
<section id="message"></section>
|
||||||
<?php require('import/periodo.php') ?>
|
<?php require('import/periodo.php') ?>
|
||||||
|
<?php if(!is_null($user->periodo_id)) { ?>
|
||||||
<form id="asistencia" method="post" onsubmit="return validaFechas()">
|
<form id="asistencia" method="post" onsubmit="return validaFechas()">
|
||||||
<div class="form-box">
|
<div class="form-box">
|
||||||
<input type="hidden" name="facultad" value="">
|
<input type="hidden" name="facultad" value="">
|
||||||
@@ -160,8 +167,8 @@ $fecha_fin_db = $date->format('Y-m-d');
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$reposiciones_rs = $db->query('SELECT * FROM fs_reposiciones_solicitud(:f_ini, :f_fin, :usr ,NULL, NULL)', [':f_ini' => $fecha_ini_db, ':f_fin' => $fecha_fin_db, ':usr' => $user->user["id"]]);
|
$reposiciones_rs = $db->query('SELECT * FROM fs_reposiciones_solicitud(:f_ini, :f_fin, :usr ,NULL, NULL)', [':f_ini' => $fecha_ini_db, ':f_fin' => $fecha_fin_db, ':usr' => $user->user["id"]]);
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -245,11 +252,17 @@ $fecha_fin_db = $date->format('Y-m-d');
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<?php } else { ?>
|
<?php } else {
|
||||||
|
if(is_null($user->periodo_id)){ ?>
|
||||||
|
<div class="col-12 text-center">
|
||||||
|
<h4 class="mt-4 text-danger">Selecciona un periodo</h4>
|
||||||
|
</div>
|
||||||
|
<?php } else {?>
|
||||||
<div class="col-12 text-center">
|
<div class="col-12 text-center">
|
||||||
<h4 class="mt-4 text-danger">No tienes reposiciones disponibles que cumplan con los filtros</h4>
|
<h4 class="mt-4 text-danger">No tienes reposiciones disponibles que cumplan con los filtros</h4>
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php }
|
||||||
|
} ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal fade" id="modal" tabindex="-1" role="dialog" aria-labelledby="modal" aria-hidden="true">
|
<div class="modal fade" id="modal" tabindex="-1" role="dialog" aria-labelledby="modal" aria-hidden="true">
|
||||||
@@ -752,15 +765,13 @@ $fecha_fin_db = $date->format('Y-m-d');
|
|||||||
$("#filtro_final").removeClass("is-invalid");
|
$("#filtro_final").removeClass("is-invalid");
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#dlProfesor ul li").click(function(){//cambia datalist
|
function obtieneProf(pid){
|
||||||
var pid = $(this).data('id');
|
return $.ajax({
|
||||||
//busca materias del profesor
|
|
||||||
$.ajax({
|
|
||||||
url: './action/reposicion_profesor_materias.php',
|
url: './action/reposicion_profesor_materias.php',
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
data: { id: pid, },
|
data: { id: pid, },
|
||||||
async: false,
|
//async: false,
|
||||||
success: function(result) {
|
success: function(result) {
|
||||||
if(result["error"]!= "" && result["error"] !== undefined){
|
if(result["error"]!= "" && result["error"] !== undefined){
|
||||||
triggerMessage(result["error"], "Error");
|
triggerMessage(result["error"], "Error");
|
||||||
@@ -780,29 +791,42 @@ $fecha_fin_db = $date->format('Y-m-d');
|
|||||||
);
|
);
|
||||||
$("#dlMateria ul").append(html);
|
$("#dlMateria ul").append(html);
|
||||||
}
|
}
|
||||||
//setDatalistFirst("#horario");
|
|
||||||
$("#dlMateria ul li:first").click();
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(jqXHR, textStatus, errorThrown ){
|
error: function(jqXHR, textStatus, errorThrown ){
|
||||||
triggerMessage(errorThrown, "Error");
|
triggerMessage(errorThrown, "Error");
|
||||||
}
|
}
|
||||||
});//ajax
|
});//ajax
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).on( "click", "#dlProfesor ul li", function(event){//cambia datalist
|
||||||
|
var pid = $(this).data('id');
|
||||||
|
//busca materias del profesor
|
||||||
|
var profCarga = obtieneProf(pid);
|
||||||
|
profCarga.done(function(){
|
||||||
|
$("#dlMateria ul li:first").click();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
//Actualiza días elegibles de calendario
|
//Actualiza días elegibles de calendario
|
||||||
$(document).on( "click", "#dlMateria ul li", function(event){//manda al frente de todos
|
$(document).on( "click", "#dlMateria ul li", function(event){//manda al frente de todos
|
||||||
_dia_valido = $(this).data('dia');
|
_dia_valido = $(this).data('dia');//variable global
|
||||||
var grupo = $(this).data("gpo");
|
var grupo = $(this).data("gpo");
|
||||||
var duracionMateria = $(this).data("duracion");
|
var duracionMateria = $(this).data("duracion");
|
||||||
|
|
||||||
$.ajax({
|
$(".date-picker" ).datepicker(datepickerOptions);
|
||||||
|
var hora = $(this).data("hr");
|
||||||
|
var min = $(this).data("min");
|
||||||
|
$("#hora_ini").val(hora)
|
||||||
|
$("#min_ini").val(min)
|
||||||
|
|
||||||
|
return $.ajax({
|
||||||
url: './action/asistenciasprofesor_select.php',
|
url: './action/asistenciasprofesor_select.php',
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
data: { "id": $("#prof").val(), "hor": $(this).data("id") },
|
data: { "id": $("#prof").val(), "hor": $(this).data("id") },
|
||||||
|
//async: false,
|
||||||
success: function(result) {
|
success: function(result) {
|
||||||
if(result["error"]!= "" && result["error"] !== undefined){
|
if(result["error"]!= "" && result["error"] !== undefined){
|
||||||
triggerMessage(result["error"], "Error");
|
triggerMessage(result["error"], "Error");
|
||||||
@@ -819,7 +843,6 @@ $fecha_fin_db = $date->format('Y-m-d');
|
|||||||
$(this).prop('selected', true);
|
$(this).prop('selected', true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log("fin materia click");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
@@ -827,12 +850,8 @@ $fecha_fin_db = $date->format('Y-m-d');
|
|||||||
triggerMessage(errorThrown, "Error");
|
triggerMessage(errorThrown, "Error");
|
||||||
}
|
}
|
||||||
});//ajax
|
});//ajax
|
||||||
|
|
||||||
$(".date-picker" ).datepicker(datepickerOptions);
|
|
||||||
var hora = $(this).data("hr");
|
|
||||||
var min = $(this).data("min");
|
|
||||||
$("#hora_ini").val(hora)
|
|
||||||
$("#min_ini").val(min)
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#dlTipo ul li").click(function(){//cambia datalist
|
$("#dlTipo ul li").click(function(){//cambia datalist
|
||||||
@@ -857,7 +876,7 @@ $fecha_fin_db = $date->format('Y-m-d');
|
|||||||
if(result["error"]!= "" && result["error"] !== undefined){
|
if(result["error"]!= "" && result["error"] !== undefined){
|
||||||
triggerMessage(result["error"], "Error");
|
triggerMessage(result["error"], "Error");
|
||||||
}else{
|
}else{
|
||||||
triggerMessage(result["ok"], "Éxito");
|
triggerMessage(result["ok"], "Éxito", "success");
|
||||||
$("#id"+r_id).remove();
|
$("#id"+r_id).remove();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -919,13 +938,17 @@ $fecha_fin_db = $date->format('Y-m-d');
|
|||||||
type: 'POST',
|
type: 'POST',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
data: { id: r_id },
|
data: { id: r_id },
|
||||||
|
async: true,
|
||||||
success: function(result) {
|
success: function(result) {
|
||||||
if(result["error"]!= "" && result["error"] !== undefined){
|
if(result["error"]!= "" && result["error"] !== undefined){
|
||||||
triggerMessage(result["error"], "Error");
|
triggerMessage(result["error"], "Error");
|
||||||
$("#modal").modal('hide');
|
$("#modal").modal('hide');
|
||||||
}else{
|
}else{
|
||||||
//setDatalist("#prof", result["profesor"]);
|
//setDatalist("#prof", result["profesor"]);
|
||||||
setDatalist("#prof", result["profesor"])
|
setDatalist("#prof", result["profesor"]);
|
||||||
|
|
||||||
|
var profCarga = obtieneProf(result["profesor"]);
|
||||||
|
|
||||||
//$('#salon').val(result["salon"]);
|
//$('#salon').val(result["salon"]);
|
||||||
$("#fecha_falta").val(result["fecha_clase"]);
|
$("#fecha_falta").val(result["fecha_clase"]);
|
||||||
$('#hora_ini').val(result["hora_ini"]);
|
$('#hora_ini').val(result["hora_ini"]);
|
||||||
@@ -947,8 +970,11 @@ $fecha_fin_db = $date->format('Y-m-d');
|
|||||||
_dia_valido = parseInt(result["dia"]);
|
_dia_valido = parseInt(result["dia"]);
|
||||||
$(".date-picker" ).datepicker(datepickerOptions);
|
$(".date-picker" ).datepicker(datepickerOptions);
|
||||||
$("#dlTipo ul li:selected").click();
|
$("#dlTipo ul li:selected").click();
|
||||||
console.log("llega a cambio horario"+result["horario"]);
|
|
||||||
setTimeout(setDatalist("#horario", result["horario"]), 20);// No se actualiza TODO
|
|
||||||
|
profCarga.done(function(){
|
||||||
|
setDatalist("#horario", result["horario"]);// No se actualiza TODO
|
||||||
|
});
|
||||||
setDatalist("#aula", result["aula"]);
|
setDatalist("#aula", result["aula"]);
|
||||||
modal.modal('show');
|
modal.modal('show');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,21 @@ type Horario = {
|
|||||||
bloques: number;
|
bloques: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Facultad = {
|
||||||
|
clave_dependencia: string;
|
||||||
|
facultad_id: number;
|
||||||
|
facultad_nombre: string;
|
||||||
|
carreras: Carrera[];
|
||||||
|
}
|
||||||
|
|
||||||
|
type Carrera = {
|
||||||
|
carrera_id: number;
|
||||||
|
carrera_nombre: string;
|
||||||
|
clave_carrera: string;
|
||||||
|
facultad_id: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const profesores = reactive({
|
const profesores = reactive({
|
||||||
data: [] as Profesor[],
|
data: [] as Profesor[],
|
||||||
@@ -55,6 +70,26 @@ const profesores = reactive({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const facultades = reactive({
|
||||||
|
data: [] as Facultad[],
|
||||||
|
fetch: async function () {
|
||||||
|
const facultades = await fetch('action/action_facultad.php').then(response => response.json()) as Facultad[]
|
||||||
|
const carreras = await fetch(`action/carrera.php`).then(response => response.json()) as Carrera[]
|
||||||
|
this.data = await Promise.all(facultades.map(async facultad => ({
|
||||||
|
...facultad,
|
||||||
|
carreras: await Promise.all(carreras.filter((carrera: Carrera) => carrera.facultad_id === facultad.facultad_id).map(async (carrera: Carrera) => {
|
||||||
|
const grupos = await fetch(`action/action_grupo.php?carrera_id=${carrera.carrera_id}`).then(response => response.json())
|
||||||
|
return {
|
||||||
|
...carrera,
|
||||||
|
grupos,
|
||||||
|
}
|
||||||
|
})),
|
||||||
|
})))
|
||||||
|
|
||||||
|
this.data = this.data.filter((facultad: Facultad) => facultad.carreras.length > 0)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
type Structure = {
|
type Structure = {
|
||||||
sábado: boolean;
|
sábado: boolean;
|
||||||
hora_mínima: number;
|
hora_mínima: number;
|
||||||
@@ -64,8 +99,12 @@ type Structure = {
|
|||||||
|
|
||||||
const horarios = reactive({
|
const horarios = reactive({
|
||||||
data: [] as Horario[],
|
data: [] as Horario[],
|
||||||
fetch: async function () {
|
fetch: async function (grupo: number | null = null, carrera_id: number | null = null) {
|
||||||
if (profesores.current) {
|
if (grupo && carrera_id) {
|
||||||
|
const response = await fetch(`action/action_horario.php?grupo=${grupo}&carrera_id=${carrera_id}`)
|
||||||
|
this.data = await response.json()
|
||||||
|
}
|
||||||
|
else if (profesores.current) {
|
||||||
const response = await fetch(`action/action_horario.php?profesor_id=${profesores.current.profesor_id}`)
|
const response = await fetch(`action/action_horario.php?profesor_id=${profesores.current.profesor_id}`)
|
||||||
this.data = await response.json()
|
this.data = await response.json()
|
||||||
}
|
}
|
||||||
@@ -134,7 +173,9 @@ const horarios = reactive({
|
|||||||
const app = createApp({
|
const app = createApp({
|
||||||
profesores,
|
profesores,
|
||||||
horarios,
|
horarios,
|
||||||
|
facultades,
|
||||||
mounted: async function () {
|
mounted: async function () {
|
||||||
await profesores.fetch()
|
await profesores.fetch()
|
||||||
|
await facultades.fetch()
|
||||||
}
|
}
|
||||||
}).mount('#app')
|
}).mount('#app')
|
||||||
@@ -41,13 +41,41 @@ const app = createApp({
|
|||||||
})
|
})
|
||||||
const data = await res.json()
|
const data = await res.json()
|
||||||
this.puestos.push(data)
|
this.puestos.push(data)
|
||||||
|
// order by puesto.nombre
|
||||||
|
this.puestos.sort((a: Puesto, b: Puesto) => a.nombre.localeCompare(b.nombre))
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
alert(`Error: ${error}`)
|
alert(`Error: ${error}`)
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async actualizarPuesto(puesto_id: number, materias: Materia[], usuario_id: number) {
|
to_delete: null as Puesto | null,
|
||||||
|
async eliminarPuesto(puesto_id: number) {
|
||||||
|
try {
|
||||||
|
const res = await fetch('action/puesto.php', {
|
||||||
|
method: 'DELETE',
|
||||||
|
body: JSON.stringify({
|
||||||
|
puesto_id
|
||||||
|
})
|
||||||
|
})
|
||||||
|
const data = await res.json()
|
||||||
|
this.message = data.msg;
|
||||||
|
|
||||||
|
// after 3 seconds, remove the message
|
||||||
|
setTimeout(() => {
|
||||||
|
this.message = null
|
||||||
|
}, 3000)
|
||||||
|
|
||||||
|
this.puestos = this.puestos.filter((p: Puesto) => p.puesto_id !== puesto_id)
|
||||||
|
// order by puesto.nombre
|
||||||
|
this.puestos.sort((a: Puesto, b: Puesto) => a.nombre.localeCompare(b.nombre))
|
||||||
|
} catch (error) {
|
||||||
|
alert(`Error: ${error}`)
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
async actualizarPuesto(puesto_id: number, materias: Materia[], usuario_id: number | null) {
|
||||||
try {
|
try {
|
||||||
const res = await fetch('action/puesto.php', {
|
const res = await fetch('action/puesto.php', {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
|
|||||||
Reference in New Issue
Block a user