Redistribución de periodo a periodo_id

This commit is contained in:
2023-08-15 15:58:14 +00:00
parent 60256ec460
commit e1f3d21b83
21 changed files with 762 additions and 1731 deletions

View File

@@ -1,3 +1,4 @@
import { Alert } from 'bootstrap';
import { createApp, reactive } from 'https://unpkg.com/petite-vue?module'
type Registro = {
@@ -55,15 +56,20 @@ type Bloque_Horario = {
selected: boolean;
}
type Filter = {
type: string;
value: string;
icon: string;
field: string;
label: string;
type Periodo = {
created_at: Date;
estado_id: number;
fecha_final: Date;
id_periodo_sgu: number;
nivel_id: number;
periodo_clave: string;
periodo_fecha_fin: Date;
periodo_fecha_inicio: Date;
periodo_id: number;
periodo_nombre: string;
}
const store = reactive({
loading: false,
current: {
@@ -91,16 +97,20 @@ const store = reactive({
profesor: null,
periodo_id: null,
bloque_horario: null,
sin_registro: false,
estados: [],
switchFecha: false,
switchFechas() {
async switchFechas() {
const periodo = await fetch('action/periodo_datos.php');
const periodo_data = await periodo.json() as Periodo;
// console.log(`Fecha inicio: ${periodo_data.periodo_fecha_inicio} Fecha fin: ${periodo_data.fecha_final}`);
$(function () {
store.filters.fecha_inicio = store.filters.fecha_fin = store.filters.fecha = null
$("#fecha, #fecha_inicio, #fecha_fin").datepicker({
minDate: -15,
maxDate: new Date(),
minDate: new Date(`${periodo_data.periodo_fecha_inicio}:00:00:00`),
maxDate: new Date(`${periodo_data.fecha_final}:00:00:00`),
dateFormat: "yy-mm-dd",
showAnim: "slide",
});
@@ -232,8 +242,11 @@ createApp({
perPage: 10,
*/
return this.data.filter((registro: Registro) => {
return filters.every((filtro) => {
if (store.filters.sin_registro && !registro.registro_fecha_supervisor) return true
else if (store.filters.sin_registro) return false
return filters.every((filtro) => {
switch (filtro) {
case 'fecha':
return registro.registro_fecha_ideal === store.filters[filtro];
@@ -269,6 +282,7 @@ createApp({
async descargar() {
store.current.modal_state = 'Generando reporte en Excel...'
$('div.modal#cargando').modal('show');
this.loading = true;
if (this.relevant.length === 0) return;
try {
@@ -321,12 +335,13 @@ createApp({
},
async mounted() {
$('div.modal#cargando').modal('show');
await this.registros.fetch()
await store.facultades.fetch()
await store.estados.fetch()
await store.bloques_horario.fetch()
store.filters.switchFechas()
await store.filters.switchFechas()
$('div.modal#cargando').modal('hide');
}
}).mount('#app')