Add new files and make code improvements

This commit is contained in:
2024-03-06 15:14:39 +00:00
parent 113ac2aedd
commit 0a712e1864
55 changed files with 9390 additions and 973 deletions

View File

@@ -78,13 +78,13 @@
{{ JSON.parse(ruta.salon_array).splice(1).join('/') }}
<span class="badge mx-3"
v-if="ruta.horarios.some(({estado_supervisor_id}) => !estado_supervisor_id)"
:class="{ 'badge-success': ruta.horarios.length > 0, 'badge-danger': ruta.horarios.length == 0 }">
:class="{ 'badge-success': ruta.horarios.length > 0 || ruta.reposiciones.length > 0, 'badge-danger': ruta.horarios.length == 0 }">
{{ ruta.horarios.filter(({estado_supervisor_id}) => estado_supervisor_id).length
}} / {{
ruta.horarios.length }}
</span>
<span v-else class="badge mx-3"
:class="{ 'badge-success': ruta.horarios.length > 0, 'badge-danger': ruta.horarios.length == 0 }">
:class="{ 'badge-success': ruta.horarios.length > 0 || ruta.reposiciones.length > 0, 'badge-danger': ruta.horarios.length == 0 }">
<i class="ing-aceptar"></i>
</span>
@@ -227,7 +227,16 @@
</button>
</div>
<td class="text-center align-middle">
{{ clase.reposicion_hora?.slice(0, 5) }} - {{ clase.reposicion_fin?.slice(0, 5) }}
<fieldset>
<legend>Hora de la reposición</legend>
{{ clase.reposicion_hora?.slice(0, 5) }} - {{ clase.reposicion_fin?.slice(0, 5)
}}
</fieldset>
<fieldset>
<legend>Horario original</legend>
{{ clase.horario_hora?.slice(0, 5) }} - {{ clase.horario_fin?.slice(0, 5) }} el
día {{clase.registro_fecha_ideal}}
</fieldset>
</td>
<td class="text-center align-middle text-nowrap">
<!-- data-toggle="button" -->
@@ -534,6 +543,11 @@
icon: "ing-justificar",
id: 4,
},
{
color: "primary",
icon: "ing-ubicacion",
id: 5,
}
];
const messages = PetiteVue.reactive({
@@ -579,8 +593,8 @@
this.rutas.selected = index;
},
order() {
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 finals = this.rutas.data.filter((ruta => ruta.horarios.length > 0 && ruta.horarios.every(horario => horario.estado_supervisor_id)) || (ruta => ruta.reposiciones.length > 0 && ruta.reposiciones.every(reposicion => reposicion.estado_supervisor_id)));
const lasts = this.rutas.data.filter(ruta => ruta.horarios.length == 0 && ruta.reposiciones.length == 0);
const notLasts = this.rutas.data.filter(ruta => ruta.horarios.some(horario => !horario.estado_supervisor_id));
this.rutas.data = [...notLasts, ...finals, ...lasts];
},
@@ -695,7 +709,6 @@
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;
},
@@ -710,7 +723,9 @@
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(store.rutas.data.map(ruta => ruta.horarios).flat(1).filter(clase => clase.pendiente).map(clase => ({
body: JSON.stringify(store.rutas.data.map(ruta => ruta.horarios).flat(1).filter((clase, index, self) => clase.pendiente &&
self.findIndex(c => c.horario_id == clase.horario_id && c.profesor_id == clase.profesor_id) === index
).map(clase => ({
horario_id: clase.horario_id,
estado: clase.estado_supervisor_id,
profesor_id: clase.profesor_id,
@@ -758,14 +773,16 @@
this.loading = true;
this.header = `Cargando rutas para ${this.catálogo_rutas.data.find(ruta => ruta.id_espacio_sgu == id_espacio_sgu).salon}`;
this.catálogo_rutas.selected = id_espacio_sgu;
const url = 'action/rutas_salón_horario.php'
const url = 'action/rutas_salón_horario.php';
// obtener parámetros del url
const searchParams = new URLSearchParams({
id_espacio_sgu: id_espacio_sgu,
bloque_horario_id: store.bloquesHorario.data[store.bloquesHorario.selected].id
bloque_horario_id: store.bloquesHorario.data[store.bloquesHorario.selected].id,
fecha: new URL(document.location).searchParams.get('fecha') ?? null,
});
try {
const rutas = await fetch(`${url}?${searchParams}`).then(res => res.json());
store.rutas.data = rutas.filter(ruta => ruta.horarios.length > 0);
store.rutas.data = rutas.filter(ruta => ruta.horarios.length > 0 || ruta.reposiciones.length > 0);
} catch (error) {
console.error(error);
this.header = `Error al cargar rutas`;
@@ -787,7 +804,7 @@
},
get clase_vista() {
if (!store.profesor_selected.horario_id || !(store.profesor_selected.profesor_id >= 0) )
if (!store.profesor_selected.horario_id || !(store.profesor_selected.profesor_id >= 0))
return false;
return store.profesor_selected.es_reposicion