From 70ba06120da3919bcb0839390b38e8607a3164e5 Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 20 Jan 2025 09:28:19 -0600 Subject: [PATCH 01/23] =?UTF-8?q?Datos=20m=C3=ADnimos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- action/action_auditoria.php | 45 +++++++++++++++++++++++++++++-------- auditoria.php | 15 ++++++------- 2 files changed, 43 insertions(+), 17 deletions(-) diff --git a/action/action_auditoria.php b/action/action_auditoria.php index 3aae895..05db5ed 100644 --- a/action/action_auditoria.php +++ b/action/action_auditoria.php @@ -8,8 +8,8 @@ ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); -$ruta = "../"; -require_once $ruta . "class/c_login.php"; +$ruta = ".."; +require_once "$ruta/class/c_login.php"; if (!isset($_SESSION['user'])) { http_response_code(401); die(json_encode(['error' => 'unauthorized'])); @@ -30,17 +30,44 @@ try { // ':periodo_id' => $_GET['periodo_id'] > 0 ? $user->periodo_id : null, ':facultad_id' => $user->facultad['facultad_id'], ':fecha_inicio' => $_GET['fecha'] ?? $_GET['fecha_inicio'] ?? date('Y-m-d'), - ':fecha_fin' => $baseDate ? date('Y-m-d H:i:s', strtotime($baseDate . ' +24 hours')) : date('Y-m-d H:i:s'), + ':fecha_fin' => $baseDate ? date('Y-m-d H:i:s', strtotime("$baseDate +24 hours")) : date('Y-m-d H:i:s'), + 'usuario_id' => $user->user['id'], ]; $data = $db->query( - "SELECT * FROM PUBLIC.AUDITORIA_MAT - WHERE FACULTAD_ID = COALESCE(:facultad_id, FACULTAD_ID) - AND REGISTRO_FECHA_IDEAL + HORARIO_HORA between :fecha_inicio AND :fecha_fin - ORDER BY registro_fecha_ideal asc, horario_hora asc", + "WITH AUDITORIA_DATA AS ( + SELECT * FROM PUBLIC.AUDITORIA_MAT + WHERE FACULTAD_ID = COALESCE(:facultad_id, FACULTAD_ID) + AND REGISTRO_FECHA_IDEAL + HORARIO_HORA between :fecha_inicio AND :fecha_fin + ), INSERTION AS ( + INSERT INTO last_auditoria VALUES (:usuario_id , COALESCE(( + SELECT jsonb_agg(AUDITORIA_DATA) FROM AUDITORIA_DATA + ), '[]'::JSONB)) + ON CONFLICT (usuario_id) DO UPDATE SET auditoria = EXCLUDED.auditoria + ) + SELECT + registro_id, + registro_fecha_ideal, + horario_id, + profesor_id, + salon, + profesor_clave, + profesor_nombre, + horario_hora, + horario_fin, + registro_fecha, + color, + estado_color, + estado_icon, + usuario_nombre, + registro_fecha_supervisor, + comentario, + registro_justificada, + reposicion_id + FROM AUDITORIA_DATA", $params ); - - echo json_encode(array_merge($data), JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT); + // Print the JSON file + echo json_encode($data); } else { http_response_code(405); echo json_encode(['error' => 'method not allowed']); diff --git a/auditoria.php b/auditoria.php index 5da539d..cadf07c 100644 --- a/auditoria.php +++ b/auditoria.php @@ -266,7 +266,7 @@ {{ registro.profesor_clave }} {{ registro.profesor_nombre }} @@ -275,7 +275,6 @@ {{ registro.horario_hora?.slice(0,5) }} - {{registro.horario_fin?.slice(0,5) }} -
@@ -406,7 +405,7 @@
Correo: {{ - clase_vista.profesor_correo }} + detalle.correo }}
Clave: @@ -414,7 +413,7 @@
Facultad: - {{ clase_vista.facultad }} + {{ detalle.facultad }}
@@ -423,19 +422,19 @@
Materia: - {{ clase_vista.materia }} + {{ detalle.materia }}
Carrera: - {{ clase_vista.carrera }} + {{ detalle.carrera }}
Nivel: - {{ clase_vista.nivel}} + {{ detalle.nivel}}
Grupo: - {{ clase_vista.horario_grupo }} + {{ detalle.horario_grupo }}
Horario: From 13f89636fcfa75e751502fa55421d0f9235193f9 Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 20 Jan 2025 09:28:33 -0600 Subject: [PATCH 02/23] Detalles AJAX --- action/action_auditoria_detalle.php | 47 +++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 action/action_auditoria_detalle.php diff --git a/action/action_auditoria_detalle.php b/action/action_auditoria_detalle.php new file mode 100644 index 0000000..52336af --- /dev/null +++ b/action/action_auditoria_detalle.php @@ -0,0 +1,47 @@ + 'unauthorized'])); +} +$user = unserialize($_SESSION['user']); + +// check method +try { + if ($_SERVER['REQUEST_METHOD'] === 'GET') { + + $data = $db + ->where('horario_id', $_GET['horario_id']) + ->where('profesor_id', $_GET['profesor_id']) + ->getOne('auditoria_mat'); + // Print the JSON file + echo json_encode($data); + } else { + http_response_code(405); + echo json_encode(['error' => 'method not allowed']); + exit; + } +} catch (PDOException $th) { + http_response_code(500); + echo json_encode([ + 'error' => $th->getMessage(), + // 'query' => $db->getLastQuery(), + ], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_PARTIAL_OUTPUT_ON_ERROR); + exit; +} catch (Exception $th) { + http_response_code(500); + echo json_encode([ + 'error' => $th->getMessage(), + ], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT); + exit; +} \ No newline at end of file From 184abed9a194be66a87e86301cef2c43d650f739 Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 20 Jan 2025 09:28:41 -0600 Subject: [PATCH 03/23] Excel sin recibir datos --- export/supervisor_excel.php | 31 +++++++++++++++++--------- js/auditoría.js | 44 ++++++++++++++++++++++++++++++++++++- 2 files changed, 64 insertions(+), 11 deletions(-) diff --git a/export/supervisor_excel.php b/export/supervisor_excel.php index d490512..d80d43d 100644 --- a/export/supervisor_excel.php +++ b/export/supervisor_excel.php @@ -1,4 +1,3 @@ - 'unauthorized'])); +} +$user = unserialize($_SESSION['user']); + +/* $json = file_get_contents('php://input'); +$data = json_decode($json, true); */ + +$query = $db + ->where('usuario_id', $user->user['id']) + ->getOne('last_auditoria', 'auditoria')['auditoria']; + +$data = json_decode($query, true); + +empty($data) and die(json_encode(['error' => 'No se recibieron datos', 'data' => $data])); use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Style\Border; @@ -28,11 +44,6 @@ $drawing->setName('La Salle') ->setOffsetX(10) ->setWorksheet($spreadsheet->getActiveSheet()); -$json = file_get_contents('php://input'); -$data = json_decode($json, true); - -empty($data) and die(json_encode(['error' => 'No se recibieron datos', 'data' => $data])); - $data_excel = array( "FECHA" => 'registro_fecha_ideal', "CLAVE" => 'profesor_clave', @@ -137,8 +148,8 @@ function getFormattedValue($key, $registro) 'registro_fecha_supervisor' => is_null($registro[$key]) ? 'Sin registro' : date('H:i', strtotime($registro[$key])), 'nombre' => $registro[$key] ?? "Sin registro", 'horario_hora_completa' => "{$registro['horario_hora']} - {$registro['horario_fin']}", - 'usuario_nombre', - 'salon_array' => implode(", ", json_decode($registro[$key], true)), + 'usuario_nombre' => $registro[$key] ?? "Sin registro", + 'salon_array' => json_encode($registro[$key], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE), 'justificacion', 'comentario' => $registro[$key] ?? "Sin registro", default => $registro[$key] @@ -161,7 +172,7 @@ foreach ($data as $index => $registro) { array_walk($values, function ($row, $column_index) use ($sheet, $index, $registro) { $value = getFormattedValue($row, $registro); $cellLocation = chr(65 + $column_index) . (ROW + $index + 1); - + $sheet->setCellValue($cellLocation, $value); if ($value == "Sin registro") { diff --git a/js/auditoría.js b/js/auditoría.js index 9269247..fd55006 100644 --- a/js/auditoría.js +++ b/js/auditoría.js @@ -290,7 +290,7 @@ const store = reactive({ headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify(this.relevant) + // body: JSON.stringify(this.relevant) }); const blob = await res.blob(); window.saveAs(blob, `auditoria_${new Date().toISOString().slice(0, 10)}.xlsx`); @@ -314,8 +314,50 @@ const store = reactive({ } }, }); + +const detalle = reactive({ + correo: null, + facultad: null, + materia: null, + carrera: null, + nivel: null, + horario_grupo: null, + + reset() { + this.correo = null + this.facultad = null + this.materia = null + this.carrera = null + this.nivel = null + this.horario_grupo = null + }, + + async obtener_detalle(horario_id, profesor_id) { + detalle.reset(); + + $('div.modal#cargando').modal('show'); + try { + const resultado = await (await fetch(`action/action_auditoria_detalle.php?${new URLSearchParams({ horario_id, profesor_id })}`)).json(); + + this.correo = resultado.profesor_correo; + this.facultad = resultado.facultad; + this.materia = resultado.materia; + this.carrera = resultado.carrera; + this.nivel = resultado.nivel; + this.grupo = resultado.grupo; + } + catch (error) { + console.log('Error:', error) + } + finally { + $('div.modal#cargando').modal('hide'); + } + } +}); + createApp({ store, + detalle, messages: [], get clase_vista() { return store.current.clase_vista; From afd1dadd7ee94523adb8a9f11c6acdd5f94c5400 Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 20 Jan 2025 09:28:53 -0600 Subject: [PATCH 04/23] SFTP --- .vscode/sftp.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .vscode/sftp.json diff --git a/.vscode/sftp.json b/.vscode/sftp.json new file mode 100644 index 0000000..9fd1666 --- /dev/null +++ b/.vscode/sftp.json @@ -0,0 +1,12 @@ +{ + "name": "PAAD", + "host": "paad.lci.ulsa.mx", + "protocol": "sftp", + "port": 22, + "username": "miniroot", + "remotePath": "/saa_dsk/www", + "uploadOnSave": false, + "useTempFile": false, + "openSsh": false, + "password": "T4nP0d3r0s1s1m0##" +} From 1eba397a1ac41e87ccc65f6ba73b10e51fa48528 Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 20 Jan 2025 09:28:53 -0600 Subject: [PATCH 05/23] SFTP --- .vscode/sftp.json | 12 ++++++++++++ js/auditoría.js | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 .vscode/sftp.json diff --git a/.vscode/sftp.json b/.vscode/sftp.json new file mode 100644 index 0000000..9fd1666 --- /dev/null +++ b/.vscode/sftp.json @@ -0,0 +1,12 @@ +{ + "name": "PAAD", + "host": "paad.lci.ulsa.mx", + "protocol": "sftp", + "port": 22, + "username": "miniroot", + "remotePath": "/saa_dsk/www", + "uploadOnSave": false, + "useTempFile": false, + "openSsh": false, + "password": "T4nP0d3r0s1s1m0##" +} diff --git a/js/auditoría.js b/js/auditoría.js index fd55006..a6b9948 100644 --- a/js/auditoría.js +++ b/js/auditoría.js @@ -344,7 +344,7 @@ const detalle = reactive({ this.materia = resultado.materia; this.carrera = resultado.carrera; this.nivel = resultado.nivel; - this.grupo = resultado.grupo; + this.horario_grupo = resultado.horario_grupo; } catch (error) { console.log('Error:', error) From 37f4cc42c11482894b3c4b64af98a4590ac3127c Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 20 Jan 2025 15:44:19 -0600 Subject: [PATCH 06/23] Individual JSON's --- action/action_auditoria.php | 9 +++++---- export/supervisor_excel.php | 37 ++++++++++++++++++++++++++++++------- 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/action/action_auditoria.php b/action/action_auditoria.php index 05db5ed..028e93b 100644 --- a/action/action_auditoria.php +++ b/action/action_auditoria.php @@ -38,11 +38,12 @@ try { SELECT * FROM PUBLIC.AUDITORIA_MAT WHERE FACULTAD_ID = COALESCE(:facultad_id, FACULTAD_ID) AND REGISTRO_FECHA_IDEAL + HORARIO_HORA between :fecha_inicio AND :fecha_fin + ), DELETION AS ( + DELETE FROM last_auditoria + WHERE usuario_id = :usuario_id ), INSERTION AS ( - INSERT INTO last_auditoria VALUES (:usuario_id , COALESCE(( - SELECT jsonb_agg(AUDITORIA_DATA) FROM AUDITORIA_DATA - ), '[]'::JSONB)) - ON CONFLICT (usuario_id) DO UPDATE SET auditoria = EXCLUDED.auditoria + INSERT INTO last_auditoria + SELECT :usuario_id, to_jsonb(AUDITORIA_DATA) FROM AUDITORIA_DATA ) SELECT registro_id, diff --git a/export/supervisor_excel.php b/export/supervisor_excel.php index d80d43d..c615d4f 100644 --- a/export/supervisor_excel.php +++ b/export/supervisor_excel.php @@ -16,11 +16,34 @@ $user = unserialize($_SESSION['user']); /* $json = file_get_contents('php://input'); $data = json_decode($json, true); */ -$query = $db - ->where('usuario_id', $user->user['id']) - ->getOne('last_auditoria', 'auditoria')['auditoria']; - -$data = json_decode($query, true); +$data = $db->query( +"SELECT + auditoria->>'registro_fecha_ideal' as registro_fecha_ideal, + auditoria->>'profesor_clave' as profesor_clave, + auditoria->>'profesor_nombre' as profesor_nombre, + auditoria->>'profesor_correo' as profesor_correo, + auditoria->>'facultad' as facultad, + auditoria->>'materia' as materia, + auditoria->>'carrera' as carrera, + auditoria->>'horario_grupo' as horario_grupo, + auditoria->>'horario_hora_completa' as horario_hora_completa, + auditoria->>'salon' as salon, + auditoria->>'salon_array' as salon_array, + auditoria->>'asistencia' as asistencia, + auditoria->>'registro_fecha' as registro_fecha, + auditoria->>'usuario_nombre' as usuario_nombre, + auditoria->>'nombre' as nombre, + auditoria->>'registro_fecha_supervisor' as registro_fecha_supervisor, + auditoria->>'comentario' as comentario, + auditoria->>'justificacion' as justificacion, + auditoria->>'horario_hora' as horario_hora, + auditoria->>'horario_fin' as horario_fin, + auditoria->>'registro_retardo' as registro_retardo + FROM last_auditoria + WHERE auditoria->>'registro_fecha_ideal' IS NOT NULL + AND USUARIO_ID = ?", + [$user->user['id']] +); empty($data) and die(json_encode(['error' => 'No se recibieron datos', 'data' => $data])); @@ -149,7 +172,7 @@ function getFormattedValue($key, $registro) 'nombre' => $registro[$key] ?? "Sin registro", 'horario_hora_completa' => "{$registro['horario_hora']} - {$registro['horario_fin']}", 'usuario_nombre' => $registro[$key] ?? "Sin registro", - 'salon_array' => json_encode($registro[$key], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE), + 'salon_array' => json_encode($registro[$key], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE), 'justificacion', 'comentario' => $registro[$key] ?? "Sin registro", default => $registro[$key] @@ -172,7 +195,7 @@ foreach ($data as $index => $registro) { array_walk($values, function ($row, $column_index) use ($sheet, $index, $registro) { $value = getFormattedValue($row, $registro); $cellLocation = chr(65 + $column_index) . (ROW + $index + 1); - + $sheet->setCellValue($cellLocation, $value); if ($value == "Sin registro") { From 8d96d45f58b62b94724b6037195ae4786e438bcd Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 21 Jan 2025 10:56:42 -0600 Subject: [PATCH 07/23] =?UTF-8?q?Excel=20=C3=B3ptimo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- action/action_auditoria.php | 3 +++ export/supervisor_excel.php | 46 ++++++++++++++++++++++++++++--------- js/auditoría.js | 6 ++++- 3 files changed, 43 insertions(+), 12 deletions(-) diff --git a/action/action_auditoria.php b/action/action_auditoria.php index 028e93b..00572af 100644 --- a/action/action_auditoria.php +++ b/action/action_auditoria.php @@ -44,6 +44,7 @@ try { ), INSERTION AS ( INSERT INTO last_auditoria SELECT :usuario_id, to_jsonb(AUDITORIA_DATA) FROM AUDITORIA_DATA + WHERE REGISTRO_FECHA_IDEAL IS NOT NULL ) SELECT registro_id, @@ -59,6 +60,8 @@ try { color, estado_color, estado_icon, + estado_supervisor_id, + facultad_id, usuario_nombre, registro_fecha_supervisor, comentario, diff --git a/export/supervisor_excel.php b/export/supervisor_excel.php index c615d4f..b44c5bd 100644 --- a/export/supervisor_excel.php +++ b/export/supervisor_excel.php @@ -1,9 +1,9 @@ query( -"SELECT + "SELECT auditoria->>'registro_fecha_ideal' as registro_fecha_ideal, auditoria->>'profesor_clave' as profesor_clave, auditoria->>'profesor_nombre' as profesor_nombre, @@ -38,13 +42,28 @@ $data = $db->query( auditoria->>'justificacion' as justificacion, auditoria->>'horario_hora' as horario_hora, auditoria->>'horario_fin' as horario_fin, + (auditoria->>'estado_supervisor_id')::integer as estado_id, auditoria->>'registro_retardo' as registro_retardo FROM last_auditoria - WHERE auditoria->>'registro_fecha_ideal' IS NOT NULL - AND USUARIO_ID = ?", - [$user->user['id']] + WHERE USUARIO_ID = :usuario_id + AND auditoria->>'facultad_id' = COALESCE(:facultad_id, auditoria->>'facultad_id') + AND auditoria->>'profesor_clave' = COALESCE(:profesor_clave, auditoria->>'profesor_clave')", + [ + 'usuario_id' => $user->user['id'], + 'facultad_id' => $params['facultad_id'], + 'profesor_clave' => $profesor_clave, + ] ); +$estados = empty($params['estados']) ? null : $params['estados']; + +$data = array_filter( + $data, + fn($fila) => in_array($fila['estado_id'], $estados ?? [$fila['estado_id']]) +); + +$data = array_values($data); + empty($data) and die(json_encode(['error' => 'No se recibieron datos', 'data' => $data])); use PhpOffice\PhpSpreadsheet\Spreadsheet; @@ -122,7 +141,7 @@ array_walk($keys, function ($key, $index) use ($sheet) { $sheet->getStyle($headers_range)->applyFromArray([ 'font' => [ 'bold' => true, - 'size' => 15, + 'size' => 12, 'name' => 'Indivisa Text Sans', 'color' => ['argb' => Color::COLOR_WHITE], ], @@ -144,7 +163,7 @@ $sheet->setAutoFilter($headers_range); // Styles that are common for all rows can be set outside the loop const DEFAULT_FONT = [ - 'size' => 12, + 'size' => 10, 'name' => 'Indivisa Text Sans', 'color' => ['argb' => '001d68'] ]; @@ -206,7 +225,12 @@ foreach ($data as $index => $registro) { foreach ($sheet->getColumnIterator() as $column) { - $sheet->getColumnDimension($column->getColumnIndex())->setAutoSize(true); + $colIndex = $column->getColumnIndex(); + if ($colIndex === 'Q') { + $sheet->getColumnDimension($colIndex)->setWidth(100); // Ajusta el valor según el tamaño deseado + } else { + $sheet->getColumnDimension($colIndex)->setAutoSize(true); + } } $writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); diff --git a/js/auditoría.js b/js/auditoría.js index a6b9948..f38e627 100644 --- a/js/auditoría.js +++ b/js/auditoría.js @@ -290,7 +290,11 @@ const store = reactive({ headers: { 'Content-Type': 'application/json' }, - // body: JSON.stringify(this.relevant) + body: JSON.stringify({ + 'facultad_id': store.filters.facultad_id, + 'estados': store.filters.estados, + 'profesor': store.filters.profesor, + }) }); const blob = await res.blob(); window.saveAs(blob, `auditoria_${new Date().toISOString().slice(0, 10)}.xlsx`); From 5792338d29bc27d470825534a7581e7f65d7c110 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 21 Jan 2025 11:39:07 -0600 Subject: [PATCH 08/23] =?UTF-8?q?Sal=C3=B3n=20array?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- export/supervisor_excel.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/export/supervisor_excel.php b/export/supervisor_excel.php index b44c5bd..0424092 100644 --- a/export/supervisor_excel.php +++ b/export/supervisor_excel.php @@ -16,8 +16,8 @@ $user = unserialize($_SESSION['user']); $json = file_get_contents('php://input'); $params = json_decode($json, true); -$profesor_clave = isset($params['profesor']) - ? preg_replace('/[^\d]/', '', $params['profesor']) +$profesor_clave = isset($params['profesor']) + ? preg_replace('/[^\d]/', '', $params['profesor']) : null; $data = $db->query( @@ -32,7 +32,10 @@ $data = $db->query( auditoria->>'horario_grupo' as horario_grupo, auditoria->>'horario_hora_completa' as horario_hora_completa, auditoria->>'salon' as salon, - auditoria->>'salon_array' as salon_array, + ( + SELECT string_agg(value, '/' ORDER BY value) + FROM jsonb_array_elements_text(auditoria->'salon_array') AS value + ) as salon_array, auditoria->>'asistencia' as asistencia, auditoria->>'registro_fecha' as registro_fecha, auditoria->>'usuario_nombre' as usuario_nombre, From 4b4a4a55ca0687d9b375759629fb9e277b26f0ae Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 21 Jan 2025 11:45:04 -0600 Subject: [PATCH 09/23] Mejora de NULL y de salones array --- export/supervisor_excel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/export/supervisor_excel.php b/export/supervisor_excel.php index 0424092..46f818c 100644 --- a/export/supervisor_excel.php +++ b/export/supervisor_excel.php @@ -190,11 +190,11 @@ function getFormattedValue($key, $registro) return match ($key) { 'asistencia' => is_null($registro['registro_fecha']) ? "Sin registro" : ($registro['registro_retardo'] ? "Retardo " : "Asistencia "), 'registro_fecha', - 'registro_fecha_supervisor' => is_null($registro[$key]) ? 'Sin registro' : date('H:i', strtotime($registro[$key])), + 'registro_fecha_supervisor' => $registro[$key] === null ? 'Sin registro' : date('H:i', strtotime($registro[$key])), 'nombre' => $registro[$key] ?? "Sin registro", 'horario_hora_completa' => "{$registro['horario_hora']} - {$registro['horario_fin']}", 'usuario_nombre' => $registro[$key] ?? "Sin registro", - 'salon_array' => json_encode($registro[$key], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE), + 'salon_array' => $registro[$key], 'justificacion', 'comentario' => $registro[$key] ?? "Sin registro", default => $registro[$key] From fd0876fb4dd65c2bb5b4efab0a5643b96db469d3 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 21 Jan 2025 11:45:31 -0600 Subject: [PATCH 10/23] Diagonales con espacios --- export/supervisor_excel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/export/supervisor_excel.php b/export/supervisor_excel.php index 46f818c..e7f1c9f 100644 --- a/export/supervisor_excel.php +++ b/export/supervisor_excel.php @@ -33,7 +33,7 @@ $data = $db->query( auditoria->>'horario_hora_completa' as horario_hora_completa, auditoria->>'salon' as salon, ( - SELECT string_agg(value, '/' ORDER BY value) + SELECT string_agg(value, ' / ' ORDER BY value) FROM jsonb_array_elements_text(auditoria->'salon_array') AS value ) as salon_array, auditoria->>'asistencia' as asistencia, From 6bafc570f6fdbe3739da681fb0b6b21be5c5a6c8 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 21 Jan 2025 11:50:45 -0600 Subject: [PATCH 11/23] Sin correo --- export/supervisor_excel.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/export/supervisor_excel.php b/export/supervisor_excel.php index e7f1c9f..7c7bf24 100644 --- a/export/supervisor_excel.php +++ b/export/supervisor_excel.php @@ -25,7 +25,7 @@ $data = $db->query( auditoria->>'registro_fecha_ideal' as registro_fecha_ideal, auditoria->>'profesor_clave' as profesor_clave, auditoria->>'profesor_nombre' as profesor_nombre, - auditoria->>'profesor_correo' as profesor_correo, + NULLIF(auditoria->>'profesor_correo', '') as profesor_correo, auditoria->>'facultad' as facultad, auditoria->>'materia' as materia, auditoria->>'carrera' as carrera, @@ -197,6 +197,7 @@ function getFormattedValue($key, $registro) 'salon_array' => $registro[$key], 'justificacion', 'comentario' => $registro[$key] ?? "Sin registro", + 'profesor_correo' => $registro[$key] ?? "Sin correo", default => $registro[$key] }; } @@ -220,7 +221,7 @@ foreach ($data as $index => $registro) { $sheet->setCellValue($cellLocation, $value); - if ($value == "Sin registro") { + if (in_array($value, ["Sin registro", "Sin asignar", "Sin correo"])) { $sheet->getStyle($cellLocation)->applyFromArray(['font' => ['color' => ['argb' => 'ea0029']]]); } }); From 5f3ae0350f8d8dcc652eae7c85fbef4e6673b4a4 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 21 Jan 2025 14:14:56 -0600 Subject: [PATCH 12/23] Excel mejorado --- export/supervisor_excel.php | 16 ++++++++++++---- js/auditoría.js | 1 + 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/export/supervisor_excel.php b/export/supervisor_excel.php index 7c7bf24..b0f2801 100644 --- a/export/supervisor_excel.php +++ b/export/supervisor_excel.php @@ -29,7 +29,7 @@ $data = $db->query( auditoria->>'facultad' as facultad, auditoria->>'materia' as materia, auditoria->>'carrera' as carrera, - auditoria->>'horario_grupo' as horario_grupo, + NULLIF(auditoria->>'horario_grupo', '') as horario_grupo, auditoria->>'horario_hora_completa' as horario_hora_completa, auditoria->>'salon' as salon, ( @@ -48,6 +48,8 @@ $data = $db->query( (auditoria->>'estado_supervisor_id')::integer as estado_id, auditoria->>'registro_retardo' as registro_retardo FROM last_auditoria + JOIN BLOQUE_HORARIO ON BLOQUE_HORARIO.ID = :bloque_horario_id + AND ((auditoria->>'horario_hora')::TIME, (auditoria->>'horario_fin')::TIME) OVERLAPS (HORA_INICIO, HORA_FIN) WHERE USUARIO_ID = :usuario_id AND auditoria->>'facultad_id' = COALESCE(:facultad_id, auditoria->>'facultad_id') AND auditoria->>'profesor_clave' = COALESCE(:profesor_clave, auditoria->>'profesor_clave')", @@ -55,6 +57,7 @@ $data = $db->query( 'usuario_id' => $user->user['id'], 'facultad_id' => $params['facultad_id'], 'profesor_clave' => $profesor_clave, + 'bloque_horario_id' => $params['bloque_horario'] ] ); @@ -188,15 +191,20 @@ const DEFAULT_STYLE = [ function getFormattedValue($key, $registro) { return match ($key) { - 'asistencia' => is_null($registro['registro_fecha']) ? "Sin registro" : ($registro['registro_retardo'] ? "Retardo " : "Asistencia "), + 'asistencia' => $registro['registro_fecha'] === null + ? "Sin registro" + : ($registro['registro_retardo'] ? "Retardo " : "Asistencia "), 'registro_fecha', - 'registro_fecha_supervisor' => $registro[$key] === null ? 'Sin registro' : date('H:i', strtotime($registro[$key])), + 'registro_fecha_supervisor' => $registro[$key] === null + ? 'Sin registro' + : date('H:i', strtotime($registro[$key])), 'nombre' => $registro[$key] ?? "Sin registro", 'horario_hora_completa' => "{$registro['horario_hora']} - {$registro['horario_fin']}", 'usuario_nombre' => $registro[$key] ?? "Sin registro", 'salon_array' => $registro[$key], 'justificacion', 'comentario' => $registro[$key] ?? "Sin registro", + 'horario_grupo' => $registro[$key] ?? "Sin registro", 'profesor_correo' => $registro[$key] ?? "Sin correo", default => $registro[$key] }; @@ -230,7 +238,7 @@ foreach ($data as $index => $registro) { foreach ($sheet->getColumnIterator() as $column) { $colIndex = $column->getColumnIndex(); - if ($colIndex === 'Q') { + if (in_array($colIndex, ['Q', 'R'])) { $sheet->getColumnDimension($colIndex)->setWidth(100); // Ajusta el valor según el tamaño deseado } else { $sheet->getColumnDimension($colIndex)->setAutoSize(true); diff --git a/js/auditoría.js b/js/auditoría.js index f38e627..ef0833d 100644 --- a/js/auditoría.js +++ b/js/auditoría.js @@ -294,6 +294,7 @@ const store = reactive({ 'facultad_id': store.filters.facultad_id, 'estados': store.filters.estados, 'profesor': store.filters.profesor, + 'bloque_horario': store.filters.bloque_horario, }) }); const blob = await res.blob(); From b98334ef388e0422c634ad96fbc514e40394ce0c Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 21 Jan 2025 14:14:56 -0600 Subject: [PATCH 13/23] Excel mejorado --- export/supervisor_excel.php | 16 ++++++++++++---- js/auditoría.js | 1 + 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/export/supervisor_excel.php b/export/supervisor_excel.php index 7c7bf24..8603451 100644 --- a/export/supervisor_excel.php +++ b/export/supervisor_excel.php @@ -29,7 +29,7 @@ $data = $db->query( auditoria->>'facultad' as facultad, auditoria->>'materia' as materia, auditoria->>'carrera' as carrera, - auditoria->>'horario_grupo' as horario_grupo, + NULLIF(auditoria->>'horario_grupo', '') as horario_grupo, auditoria->>'horario_hora_completa' as horario_hora_completa, auditoria->>'salon' as salon, ( @@ -48,6 +48,8 @@ $data = $db->query( (auditoria->>'estado_supervisor_id')::integer as estado_id, auditoria->>'registro_retardo' as registro_retardo FROM last_auditoria + JOIN BLOQUE_HORARIO ON BLOQUE_HORARIO.ID = COALESCE(:bloque_horario_id, BLOQUE_HORARIO.ID) + AND ((auditoria->>'horario_hora')::TIME, (auditoria->>'horario_fin')::TIME) OVERLAPS (HORA_INICIO, HORA_FIN) WHERE USUARIO_ID = :usuario_id AND auditoria->>'facultad_id' = COALESCE(:facultad_id, auditoria->>'facultad_id') AND auditoria->>'profesor_clave' = COALESCE(:profesor_clave, auditoria->>'profesor_clave')", @@ -55,6 +57,7 @@ $data = $db->query( 'usuario_id' => $user->user['id'], 'facultad_id' => $params['facultad_id'], 'profesor_clave' => $profesor_clave, + 'bloque_horario_id' => $params['bloque_horario'] ] ); @@ -188,15 +191,20 @@ const DEFAULT_STYLE = [ function getFormattedValue($key, $registro) { return match ($key) { - 'asistencia' => is_null($registro['registro_fecha']) ? "Sin registro" : ($registro['registro_retardo'] ? "Retardo " : "Asistencia "), + 'asistencia' => $registro['registro_fecha'] === null + ? "Sin registro" + : ($registro['registro_retardo'] ? "Retardo " : "Asistencia "), 'registro_fecha', - 'registro_fecha_supervisor' => $registro[$key] === null ? 'Sin registro' : date('H:i', strtotime($registro[$key])), + 'registro_fecha_supervisor' => $registro[$key] === null + ? 'Sin registro' + : date('H:i', strtotime($registro[$key])), 'nombre' => $registro[$key] ?? "Sin registro", 'horario_hora_completa' => "{$registro['horario_hora']} - {$registro['horario_fin']}", 'usuario_nombre' => $registro[$key] ?? "Sin registro", 'salon_array' => $registro[$key], 'justificacion', 'comentario' => $registro[$key] ?? "Sin registro", + 'horario_grupo' => $registro[$key] ?? "Sin registro", 'profesor_correo' => $registro[$key] ?? "Sin correo", default => $registro[$key] }; @@ -230,7 +238,7 @@ foreach ($data as $index => $registro) { foreach ($sheet->getColumnIterator() as $column) { $colIndex = $column->getColumnIndex(); - if ($colIndex === 'Q') { + if (in_array($colIndex, ['Q', 'R'])) { $sheet->getColumnDimension($colIndex)->setWidth(100); // Ajusta el valor según el tamaño deseado } else { $sheet->getColumnDimension($colIndex)->setAutoSize(true); diff --git a/js/auditoría.js b/js/auditoría.js index f38e627..ef0833d 100644 --- a/js/auditoría.js +++ b/js/auditoría.js @@ -294,6 +294,7 @@ const store = reactive({ 'facultad_id': store.filters.facultad_id, 'estados': store.filters.estados, 'profesor': store.filters.profesor, + 'bloque_horario': store.filters.bloque_horario, }) }); const blob = await res.blob(); From bab0c9ce03cf07e96a2eb9dbe84c80ad1fa716ec Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 21 Jan 2025 14:35:53 -0600 Subject: [PATCH 14/23] Bloque horario --- export/supervisor_excel.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/export/supervisor_excel.php b/export/supervisor_excel.php index 8603451..d7ff65f 100644 --- a/export/supervisor_excel.php +++ b/export/supervisor_excel.php @@ -48,11 +48,11 @@ $data = $db->query( (auditoria->>'estado_supervisor_id')::integer as estado_id, auditoria->>'registro_retardo' as registro_retardo FROM last_auditoria - JOIN BLOQUE_HORARIO ON BLOQUE_HORARIO.ID = COALESCE(:bloque_horario_id, BLOQUE_HORARIO.ID) - AND ((auditoria->>'horario_hora')::TIME, (auditoria->>'horario_fin')::TIME) OVERLAPS (HORA_INICIO, HORA_FIN) + JOIN BLOQUE_HORARIO ON ((auditoria->>'horario_hora')::TIME, (auditoria->>'horario_fin')::TIME) OVERLAPS (HORA_INICIO, HORA_FIN) WHERE USUARIO_ID = :usuario_id AND auditoria->>'facultad_id' = COALESCE(:facultad_id, auditoria->>'facultad_id') - AND auditoria->>'profesor_clave' = COALESCE(:profesor_clave, auditoria->>'profesor_clave')", + AND auditoria->>'profesor_clave' = COALESCE(:profesor_clave, auditoria->>'profesor_clave') + AND BLOQUE_HORARIO.ID = COALESCE(:bloque_horario_id, BLOQUE_HORARIO.ID)", [ 'usuario_id' => $user->user['id'], 'facultad_id' => $params['facultad_id'], From 44e8e3277fe7e28e4341f307528519c04d033259 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 21 Jan 2025 14:37:22 -0600 Subject: [PATCH 15/23] Distinct Bloque Horario --- export/supervisor_excel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/export/supervisor_excel.php b/export/supervisor_excel.php index d7ff65f..359d27c 100644 --- a/export/supervisor_excel.php +++ b/export/supervisor_excel.php @@ -21,7 +21,7 @@ $profesor_clave = isset($params['profesor']) : null; $data = $db->query( - "SELECT + "SELECT DISTINCT auditoria->>'registro_fecha_ideal' as registro_fecha_ideal, auditoria->>'profesor_clave' as profesor_clave, auditoria->>'profesor_nombre' as profesor_nombre, From 1b1a145478103dfc50965116ba92584038943ea4 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 22 Jan 2025 16:56:45 -0600 Subject: [PATCH 16/23] =?UTF-8?q?Primera=20iteraci=C3=B3n=20de=20nuevo=20d?= =?UTF-8?q?ise=C3=B1o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- action/action_auditoria_detalle.php | 3 +- auditoria.php | 247 +++++++++------------------- css/auditoria-ux.css | 139 ++++++++++++++++ export/supervisor_excel.php | 6 +- fonts/svg/portrait.svg | 2 + js/auditoría.js | 7 +- 6 files changed, 231 insertions(+), 173 deletions(-) create mode 100644 css/auditoria-ux.css create mode 100644 fonts/svg/portrait.svg diff --git a/action/action_auditoria_detalle.php b/action/action_auditoria_detalle.php index 52336af..824237b 100644 --- a/action/action_auditoria_detalle.php +++ b/action/action_auditoria_detalle.php @@ -21,11 +21,12 @@ try { if ($_SERVER['REQUEST_METHOD'] === 'GET') { $data = $db + ->where('registro_fecha_ideal', $_GET['registro_fecha_ideal']) ->where('horario_id', $_GET['horario_id']) ->where('profesor_id', $_GET['profesor_id']) ->getOne('auditoria_mat'); // Print the JSON file - echo json_encode($data); + echo json_encode(array_merge($data, ['query' => $db->getLastQuery(), 'get' => $_GET])); } else { http_response_code(405); echo json_encode(['error' => 'method not allowed']); diff --git a/auditoria.php b/auditoria.php index cadf07c..937710e 100644 --- a/auditoria.php +++ b/auditoria.php @@ -13,6 +13,7 @@ display: none; } + @@ -266,19 +267,20 @@ {{ registro.profesor_clave }} {{ registro.profesor_nombre }} - {{ registro.horario_hora?.slice(0,5) }} - - {{registro.horario_fin?.slice(0,5) }} + + {{ `${registro.horario_hora?.slice(0,5)} - ${registro.horario_fin?.slice(0,5)}` }} +
- Registro {{ registro.registro_fecha?.slice(11,19) }} + Registro {{ `${registro.registro_fecha?.slice(11,19)}` }}
@@ -298,21 +300,22 @@ - {{ registro.usuario_nombre - }} + + {{ registro.usuario_nombre }} +
Hora - {{ registro.registro_fecha_supervisor?.slice(11,19) }} + {{ `${registro.registro_fecha_supervisor?.slice(11,19)}` }}
Observaciones: - {{registro.comentario?.slice(0,25)}}{{registro.comentario.length - > 10 ? '...' : ''}} + {{`${registro.comentario?.slice(0,25)} + ${registro.comentario.length + > 10 ? '...' : ''}`}}
@@ -388,165 +391,75 @@
{{clase_vista.carrera}}
-
+
{{clase_vista.materia}}
diff --git a/css/auditoria-ux.css b/css/auditoria-ux.css index bd00e8f..a52b6f8 100644 --- a/css/auditoria-ux.css +++ b/css/auditoria-ux.css @@ -176,7 +176,7 @@ .facultad { font-family: 'La Salle Display Heavy'; font-size: 1.4rem; - color: #e1e1e1; + color: #969696; position: absolute; bottom: 0; right: 0; From 1d686515764f3ed08fb1a156b416372828e69f69 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 23 Jan 2025 15:23:18 -0600 Subject: [PATCH 23/23] Estandard --- auditoria.php | 33 ++++++++++++++++++++++----------- css/auditoria-ux.css | 31 +++++++++++++++++++++---------- 2 files changed, 43 insertions(+), 21 deletions(-) diff --git a/auditoria.php b/auditoria.php index f91ac30..aec8de1 100644 --- a/auditoria.php +++ b/auditoria.php @@ -262,15 +262,20 @@ :class="{ 'table-warning': registro.reposicion_id }"> {{ registro.registro_fecha_ideal }} - {{ registro.salon }} - - {{ registro.profesor_clave }} - {{ registro.profesor_nombre }} - + {{ + `${registro.salon?.slice(0,15)}${registro.salon?.length > 15 ? '...' : ''}` }} + +
+ + {{ registro.profesor_clave }} + {{ registro.profesor_nombre }} + + + + +
@@ -315,7 +320,7 @@ Observaciones: {{`${registro.comentario?.slice(0,25)} ${registro.comentario.length - > 10 ? '...' : ''}`}} + > 25 ? '...' : ''}`}}
@@ -392,6 +397,11 @@