faltas.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import { createApp, reactive } from 'https://unpkg.com/petite-vue?module';
  2. // define that $ has type any
  3. declare const $: any;
  4. const filter = reactive({
  5. facultad: -1,
  6. profesor: '',
  7. porcentaje: 0
  8. });
  9. const app = createApp({
  10. filter,
  11. facultades: [],
  12. profesores: [],
  13. faltas: [],
  14. openModal() {
  15. const modal = document.getElementById('cargando');
  16. $(modal).modal('show');
  17. },
  18. closeModal() {
  19. const modal = document.getElementById('cargando');
  20. $(modal).modal('hide');
  21. },
  22. async refresh() {
  23. <<<<<<< HEAD
  24. alert(`Facultad: ${filter.facultad} - Profesor: ${filter.profesor} - Porcentaje: ${filter.porcentaje}%`
  25. if(filter.facultad == -1 || filter.porcetaje < 10) {
  26. =======
  27. if(filter.facultad == -1 || filter.porcentaje < 10) {
  28. >>>>>>> 7688f1aac1824c234bc5f19b154e9ad1f4808d4f
  29. return;
  30. }
  31. this.openModal();
  32. this.faltas = await fetch(`action/profesor_faltas.php?facultad=${this.filter.facultad}&profesor=${this.filter.profesor}&porcentaje=${this.filter.porcentaje}`).then(res => res.json());
  33. this.closeModal();
  34. },
  35. async mounted() {
  36. this.facultades = await fetch('action/action_facultad.php').then(res => res.json());
  37. this.profesores = await fetch('action/action_profesor.php').then(res => res.json());
  38. }
  39. }).mount('#app');