Stable without período in autidoría

This commit is contained in:
2023-08-11 15:41:57 +00:00
parent ec382e989a
commit 3ae35c84f9
14 changed files with 1145 additions and 934 deletions

View File

@@ -115,7 +115,7 @@
</button>
<h3 class="text-white font-weight-bold text-uppercase text-center">
{{ store.hora_inicio.slice(0, 5) }} - {{ store.hora_fin.slice(0, 5) }}
{{ store.hora_inicio?.slice(0, 5) }} - {{ store.hora_fin?.slice(0, 5) }}
</h3>
<button class="btn btn-info"
@@ -165,7 +165,7 @@
<tr v-if="clases.length == 0">
<td colspan="6" class="text-center">No hay clases en este horario</td>
</tr>
<tr v-for="clase in clases" :key="clase.horario_id">
<tr v-for="clase in clases" :key="`${clase.horario_id}-${clase.profesor_id}`">
<td class="text-center align-middle">{{ clase.salon }}</td>
<td class="text-center align-middle">
<div class="col-12">
@@ -173,8 +173,8 @@
</div>
<div class="col-12">
<button type="button" class="btn btn-outline-dark btn-sm"
@click="store.profesor_selected = clase.horario_id" data-toggle="modal"
data-target="#ver-detalle">
@click="store.profesor_selected.horario_id = clase.horario_id; store.profesor_selected.profesor_id = clase.profesor_id"
data-toggle="modal" data-target="#ver-detalle">
Ver detalle <i class="ing-ojo"></i>
</button>
</div>
@@ -182,12 +182,12 @@
</td>
<td class="text-center align-middle">
{{ clase.horario_hora.slice(0, 5) }} - {{ clase.horario_fin.slice(0, 5) }}
{{ clase.horario_hora?.slice(0, 5) }} - {{ clase.horario_fin?.slice(0, 5) }}
</td>
<td class="text-center align-middle text-nowrap">
<!-- data-toggle="button" -->
<button class="btn text-center mx-2" v-for="estado in estados" :key="estado.id"
@click="store.cambiarEstado(clase.horario_id, estado.id === clase.estado_supervisor_id ? null : estado.id)"
@click="store.cambiarEstado(clase.horario_id, clase.profesor_id, estado.id === clase.estado_supervisor_id ? null : estado.id)"
:class="[{'active': estado.id === clase.estado_supervisor_id}, `btn-outline-${estado.color}`]"
:aria-pressed="estado.id === clase.estado_supervisor_id">
<i :class="estado.icon"></i>
@@ -226,7 +226,7 @@
v-for="horario in store.bloquesHorario.data" :key="horario.id"
@click="store.bloquesHorario.selected = store.bloquesHorario.data.indexOf(horario)">
<div class="d-flex w-100 justify-content-between">
<h5 class="mb-1">{{ horario.hora_inicio.slice(0, 5) }} - {{horario.hora_fin.slice(0, 5)
<h5 class="mb-1">{{ horario.hora_inicio?.slice(0, 5) }} - {{horario.hora_fin?.slice(0, 5)
}}</h5>
</div>
</a>
@@ -415,7 +415,7 @@
</div>
<div class="col-6 text-center" v-else>
El profesor registró su asistencia a las
<code>{{clase_vista.registro_fecha.slice(11, 16)}}</code>
<code>{{clase_vista.registro_fecha?.slice(11, 16)}}</code>
<hr>
<p v-if="!clase_vista.registro_retardo" class="text-center">
<span class="badge badge-success"><i class="ing-aceptar"></i></span>
@@ -440,7 +440,17 @@
</div>
</div>
</div>
</div>
<div class="modal-dialog modal-dialog-centered modal-xl" v-else>
<div class="modal-content">
<div class="modal-header">
<h2 class="modal-title">Error al cargar la clase</h2>
<button type="button" class="close text-white" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<!-- cuerpo del modal -->
</div>
</div>
</div>
</main>
<?php
@@ -481,7 +491,6 @@
data: [],
push_message(message, silent = false) {
if (silent) {
console.log(message);
return
}
// go to the top
@@ -524,7 +533,6 @@
const finals = this.rutas.data.filter(ruta => ruta.horarios.length > 0 && ruta.horarios.every(horario => horario.estado_supervisor_id));
const lasts = this.rutas.data.filter(ruta => ruta.horarios.length == 0);
const notLasts = this.rutas.data.filter(ruta => ruta.horarios.some(horario => !horario.estado_supervisor_id));
// console.log("finals", finals, "lasts", lasts, "notLasts", notLasts)
this.rutas.data = [...notLasts, ...finals, ...lasts];
},
// clases
@@ -533,9 +541,9 @@
},
// estado
async cambiarEstado(horario_id, estadoId) {
async cambiarEstado(horario_id, profesor_id, estadoId) {
const ruta = store.rutas.data.find(ruta => ruta.salon_id == this.rutas.selected);
const clase = ruta.horarios.find(clase => clase.horario_id == horario_id);
const clase = ruta.horarios.find(clase => clase.horario_id == horario_id && clase.profesor_id == profesor_id);
clase.estado_supervisor_id = estadoId;
try {
@@ -588,12 +596,15 @@
const ruta = store.rutas.data.find(ruta => ruta.salon_id == this.rutas.selected);
const clase = ruta.horarios.find(clase => clase.horario_id == this.editor.id);
clase.comentario = this.editor.texto;
store.cambiarEstado(clase.horario_id, clase.estado_supervisor_id);
store.cambiarEstado(clase.horario_id, clase.profesor_id, clase.estado_supervisor_id);
},
limpiarComentario() {
this.editor.texto = "";
},
profesor_selected: null,
profesor_selected: {
horario_id: null,
profesor_id: null,
},
});
$(document).ready(function () {
@@ -632,7 +643,6 @@
},
get clases() {
const clases = store.rutas.data.find(ruta => ruta.salon_id == store.rutas.selected)?.horarios ?? [];
// console.log("All clases", JSON.parse(JSON.stringify(clases)), "Selected: ", store.rutas.selected);
return clases;
},
async guardarCambios() {
@@ -641,7 +651,6 @@
if (!navigator.onLine)
throw "No hay conexión a internet";
console.log(store.rutas.data.map(ruta => ruta.horarios).flat(1).filter(clase => clase.pendiente));
const cambio = await fetch("action/registro_supervisor.php", {
method: "POST",
headers: {
@@ -681,7 +690,6 @@
async mounted() {
store.bloquesHorario.data = await fetch('action/action_grupo_horario.php').then(res => res.json());
store.bloquesHorario.selected = store.bloquesHorario.data.findIndex(bloque => bloque.selected);
// console.log(store.bloquesHorario.selected);
this.header = (store.bloquesHorario.selected == -1) ? "Seleccione un horario" : "Seleccione una ruta";
this.catálogo_rutas.data = await fetch('action/rutas.php').then(res => res.json());
this.loading = false;
@@ -725,7 +733,7 @@
},
get clase_vista() {
return this.clases.find(clase => clase.horario_id == store.profesor_selected) ?? false;
return this.clases.find(clase => clase.horario_id == store.profesor_selected.horario_id && clase.profesor_id == store.profesor_selected.profesor_id) ?? false;
},
}).mount('#app')
</script>