Corrección de periodo

This commit is contained in:
Alejandro Rosales
2024-04-15 12:35:12 -06:00
committed by GitHub
parent 6708c5794f
commit 857baa0163
2 changed files with 5 additions and 7 deletions

View File

@@ -22,7 +22,7 @@ try {
$baseDate = $_GET['fecha'] ?? $_GET['fecha_fin'] ?? null; $baseDate = $_GET['fecha'] ?? $_GET['fecha_fin'] ?? null;
$params = [ $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'], ':facultad_id' => $user->facultad['facultad_id'],
':fecha_inicio' => $_GET['fecha'] ?? $_GET['fecha_inicio'] ?? date('Y-m-d'), ':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'),

View File

@@ -198,17 +198,15 @@ const store = reactive({
// if (!store.filters.facultad_id || !store.filters.periodo_id) return // if (!store.filters.facultad_id || !store.filters.periodo_id) return
this.loading = true; this.loading = true;
this.data = []; this.data = [];
const params = { const params = {};
facultad_id: 19,
periodo_id: 2,
};
if (fecha) if (fecha)
params['fecha'] = fecha; params['fecha'] = fecha;
if (fecha_inicio) if (fecha_inicio)
params['fecha_inicio'] = fecha_inicio; params['fecha_inicio'] = fecha_inicio;
if (fecha_fin) if (fecha_fin)
params['fecha_fin'] = 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(); const paramsUrl = new URLSearchParams(params).toString();
try { try {
const res = await fetch(`action/action_auditoria.php?${paramsUrl}`, { const res = await fetch(`action/action_auditoria.php?${paramsUrl}`, {
@@ -335,12 +333,12 @@ createApp({
async mounted() { async mounted() {
$('div.modal#cargando').modal('show'); $('div.modal#cargando').modal('show');
try { try {
store.periodo = await fetch('action/periodo_datos.php').then(res => res.json());
// await store.registros.fetch() // await store.registros.fetch()
await store.facultades.fetch(); await store.facultades.fetch();
await store.estados.fetch(); await store.estados.fetch();
await store.bloques_horario.fetch(); await store.bloques_horario.fetch();
await store.filters.switchFechas(); 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.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() }); this.messages.push({ title: 'Datos cargados', text: 'Los datos se han cargado correctamente', type: 'success', timestamp: new Date() });
} }