New things

This commit is contained in:
2023-11-27 15:13:44 +00:00
parent 4f74257c1b
commit da22d3c86b
9 changed files with 742 additions and 35 deletions

38
ts/faltas.ts Normal file
View File

@@ -0,0 +1,38 @@
import { createApp, reactive } from 'https://unpkg.com/petite-vue?module';
// define that $ has type any
declare const $: any;
const filter = reactive({
facultad: -1,
profesor: '',
porcentaje: 0
});
const app = createApp({
filter,
facultades: [],
profesores: [],
faltas: [],
openModal() {
const modal = document.getElementById('cargando');
$(modal).modal('show');
},
closeModal() {
const modal = document.getElementById('cargando');
$(modal).modal('hide');
},
async refresh() {
if(filter.facultad == -1 || filter.porcentaje < 10) {
return;
}
this.openModal();
this.faltas = await fetch(`action/profesor_faltas.php?facultad=${this.filter.facultad}&profesor=${this.filter.profesor}&porcentaje=${this.filter.porcentaje}`).then(res => res.json());
this.closeModal();
},
async mounted() {
this.facultades = await fetch('action/action_facultad.php').then(res => res.json());
this.profesores = await fetch('action/action_profesor.php').then(res => res.json());
}
}).mount('#app');