From 857baa0163d4f2998551a2fa1863d653e1e06755 Mon Sep 17 00:00:00 2001 From: Alejandro Rosales <98922270+ja-rg@users.noreply.github.com> Date: Mon, 15 Apr 2024 12:35:12 -0600 Subject: [PATCH] =?UTF-8?q?Correcci=C3=B3n=20de=20periodo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- action/action_auditoria.php | 2 +- js/auditoría.js | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/action/action_auditoria.php b/action/action_auditoria.php index 225d211..0af4bbf 100644 --- a/action/action_auditoria.php +++ b/action/action_auditoria.php @@ -22,7 +22,7 @@ try { $baseDate = $_GET['fecha'] ?? $_GET['fecha_fin'] ?? null; $params = [ - ':periodo_id' => $_GET['periodo_id'] == 1 ? $user->periodo_id : null, + ':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'), diff --git a/js/auditoría.js b/js/auditoría.js index 881ef2b..d8a5a83 100644 --- a/js/auditoría.js +++ b/js/auditoría.js @@ -198,17 +198,15 @@ const store = reactive({ // if (!store.filters.facultad_id || !store.filters.periodo_id) return this.loading = true; this.data = []; - const params = { - facultad_id: 19, - periodo_id: 2, - }; + const params = {}; if (fecha) params['fecha'] = fecha; if (fecha_inicio) params['fecha_inicio'] = fecha_inicio; if (fecha_fin) params['fecha_fin'] = fecha_fin; - params['periodo_id'] = store.filters.todos_los_periodos ? 1 : 0; + params['periodo_id'] = store.filters.todos_los_periodos ? 0 : store.periodo.periodo_id; + console.log(store.periodo); const paramsUrl = new URLSearchParams(params).toString(); try { const res = await fetch(`action/action_auditoria.php?${paramsUrl}`, { @@ -335,12 +333,12 @@ createApp({ async mounted() { $('div.modal#cargando').modal('show'); try { + store.periodo = await fetch('action/periodo_datos.php').then(res => res.json()); // await store.registros.fetch() await store.facultades.fetch(); await store.estados.fetch(); await store.bloques_horario.fetch(); await store.filters.switchFechas(); - store.periodo = await fetch('action/periodo_datos.php').then(res => res.json()); this.profesores = await (await fetch('action/action_profesor.php')).json(); this.messages.push({ title: 'Datos cargados', text: 'Los datos se han cargado correctamente', type: 'success', timestamp: new Date() }); }