Reposiciones

This commit is contained in:
2023-09-05 18:53:27 +00:00
parent 2479bc4574
commit 0e400cb745
5 changed files with 88 additions and 39 deletions

View File

@@ -172,7 +172,7 @@
</div>
<div class="col-12">
<button type="button" class="btn btn-outline-dark btn-sm"
@click="store.profesor_selected.horario_id = clase.horario_id; store.profesor_selected.profesor_id = clase.profesor_id"
@click="store.profesor_selected.horario_id = clase.horario_id; store.profesor_selected.profesor_id = clase.profesor_id; store.profesor_selected.es_reposicion = false"
data-toggle="modal" data-target="#ver-detalle">
Ver detalle <i class="ing-ojo"></i>
</button>
@@ -209,8 +209,10 @@
</div>
</td>
</tr>
<tr v-for="clase in reposiciones" :key="`${clase.horario_id}-${clase.profesor_id}`">
<tr class="table-primary" v-if="reposiciones.length > 0">
<th colspan="5" class="text-center align-middle">Reposiciones</th>
</tr>
<tr v-for="clase in reposiciones" :key="`reposicion-${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">
@@ -218,18 +220,18 @@
</div>
<div class="col-12">
<button type="button" class="btn btn-outline-dark btn-sm"
@click="store.profesor_selected.horario_id = clase.horario_id; store.profesor_selected.profesor_id = clase.profesor_id"
@click="store.profesor_selected.horario_id = clase.horario_id; store.profesor_selected.profesor_id = clase.profesor_id; store.profesor_selected.es_reposicion = true"
data-toggle="modal" data-target="#ver-detalle">
Ver detalle <i class="ing-ojo"></i>
</button>
</div>
<td class="text-center align-middle">
{{ clase.horario_hora?.slice(0, 5) }} - {{ clase.horario_fin?.slice(0, 5) }}
{{ clase.reposicion_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, clase.profesor_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, true)"
: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>
@@ -587,9 +589,9 @@
},
// estado
async cambiarEstado(horario_id, profesor_id, estadoId) {
async cambiarEstado(horario_id, profesor_id, estadoId, reposicion = false) {
const ruta = store.rutas.data.find(ruta => ruta.salon_id == this.rutas.selected);
const clase = ruta.horarios.find(clase => clase.horario_id == horario_id && clase.profesor_id == profesor_id);
const clase = ruta[reposicion ? 'reposiciones' : 'horarios'].find(clase => clase.horario_id == horario_id && clase.profesor_id == profesor_id);
clase.estado_supervisor_id = estadoId;
try {
@@ -692,6 +694,7 @@
return clases;
},
get reposiciones() {
console.log('Rutas: ', store.rutas.data, store.rutas.selected);
const reposiciones = store.rutas.data.find(ruta => ruta.salon_id == store.rutas.selected)?.reposiciones ?? [];
return reposiciones;
},
@@ -783,8 +786,13 @@
},
get clase_vista() {
return this.clases.find(clase => clase.horario_id == store.profesor_selected.horario_id && clase.profesor_id == store.profesor_selected.profesor_id) ?? false;
},
if (!store.profesor_selected.horario_id || !store.profesor_selected.profesor_id)
return false;
return store.profesor_selected.es_reposicion
? this.reposiciones.find(clase => clase.horario_id == store.profesor_selected.horario_id && clase.profesor_id == store.profesor_selected.profesor_id) ?? false
: this.clases.find(clase => clase.horario_id == store.profesor_selected.horario_id && clase.profesor_id == store.profesor_selected.profesor_id) ?? false;
},
}).mount('#app')
</script>
</body>