master
ifiguero 2024-08-05 09:21:51 -04:00
parent a2687861a2
commit 9c1d9bf372
1 changed files with 18 additions and 18 deletions

View File

@ -1,15 +1,15 @@
<script> <script>
import Paginate from "$/components/Paginate.svelte"; import Paginate from "$/components/Paginate.svelte";
import { downloadGtfsArchivo, getGtfsArchivo,getGtfsArchivoId,getGtfsBase } from "$/services/gtfs_archivo"; import { downloadGtfsArchivo, getGtfsArchivo,getGtfsArchivoId,getGtfsBase } from "$/services/gtfs_archivo";
import PageTitle from "$/components/PageTitle.svelte"; import PageTitle from "$/components/PageTitle.svelte";
import { useLocation } from "svelte-navigator"; import { useLocation } from "svelte-navigator";
import { getPermisosPath } from "$/services/usuarios"; import { getPermisosPath } from "$/services/usuarios";
import ModalgtfsUpload from "./ModalgtfsUpload.svelte"; import ModalgtfsUpload from "./ModalgtfsUpload.svelte";
import { getRedTransporte } from "$/services/red_transporte"; import { getRedTransporte } from "$/services/red_transporte";
import { space } from "svelte/internal"; import { space } from "svelte/internal";
let id_red; let id_red;
let escritura = false; let escritura = false;
const limit = 15; const limit = 15;
@ -36,7 +36,7 @@
async function onPage(p) { async function onPage(p) {
try { try {
if (!id_red) { if (!id_red) {
return; return;
} }
loading = true loading = true
@ -81,14 +81,14 @@
// Extraer la fecha, la hora y el desplazamiento de zona horaria // Extraer la fecha, la hora y el desplazamiento de zona horaria
const [datePart, timePart] = isoString.split('T'); const [datePart, timePart] = isoString.split('T');
const [time, offset] = timePart.split(/(?=[-+])/); // Usa una expresión regular para dividir por el signo más cercano (+ o -) const [time, offset] = timePart.split(/(?=[-+])/); // Usa una expresión regular para dividir por el signo más cercano (+ o -)
// Convertir a fecha/hora UTC // Convertir a fecha/hora UTC
const dateTime = new Date(`${datePart}T${time}Z`); const dateTime = new Date(`${datePart}T${time}Z`);
// Extraer las horas y minutos del desplazamiento // Extraer las horas y minutos del desplazamiento
const offsetSign = offset[0] === '+' ? 1 : -1; // Determinar si el desplazamiento es positivo o negativo const offsetSign = offset[0] === '+' ? 1 : -1; // Determinar si el desplazamiento es positivo o negativo
const [offsetHours, offsetMinutes] = offset.slice(1).split(':').map(Number); const [offsetHours, offsetMinutes] = offset.slice(1).split(':').map(Number);
// Ajustar la fecha/hora basándose en el desplazamiento // Ajustar la fecha/hora basándose en el desplazamiento
dateTime.setUTCHours(dateTime.getUTCHours() + offsetSign * offsetHours); dateTime.setUTCHours(dateTime.getUTCHours() + offsetSign * offsetHours);
dateTime.setUTCMinutes(dateTime.getUTCMinutes() + offsetSign * offsetMinutes); dateTime.setUTCMinutes(dateTime.getUTCMinutes() + offsetSign * offsetMinutes);
@ -101,7 +101,7 @@
const adjustedMinutes = String(dateTime.getUTCMinutes()).padStart(2, '0'); const adjustedMinutes = String(dateTime.getUTCMinutes()).padStart(2, '0');
return `${adjustedDate}-${adjustedMonth}-${adjustedYear} ${adjustedHours}:${adjustedMinutes}`; return `${adjustedDate}-${adjustedMonth}-${adjustedYear} ${adjustedHours}:${adjustedMinutes}`;
} }
</script> </script>
@ -141,14 +141,14 @@
<a href={"#"} on:click|preventDefault={() => onOrderBy('id_gtfs')}>ID</a> <a href={"#"} on:click|preventDefault={() => onOrderBy('id_gtfs')}>ID</a>
<!-- {#if ordering === 'id_gtfs'}<i class="bi bi-caret-up-fill"></i>{/if} <!-- {#if ordering === 'id_gtfs'}<i class="bi bi-caret-up-fill"></i>{/if}
{#if ordering === '-id_gtfs'}<i class="bi bi-caret-down-fill"></i>{/if}--> {#if ordering === '-id_gtfs'}<i class="bi bi-caret-down-fill"></i>{/if}-->
</th> </th>
<th> <th>
<a href={"#"} on:click|preventDefault={() => onOrderBy('archivo')}>Archivo</a> <a href={"#"} on:click|preventDefault={() => onOrderBy('archivo')}>Archivo</a>
<!-- {#if ordering === 'archivo'}<i class="bi bi-caret-up-fill"></i>{/if} <!-- {#if ordering === 'archivo'}<i class="bi bi-caret-up-fill"></i>{/if}
{#if ordering === '-archivo'}<i class="bi bi-caret-down-fill"></i>{/if}--> {#if ordering === '-archivo'}<i class="bi bi-caret-down-fill"></i>{/if}-->
</th> </th>
<th> <th>
<a href={"#"} on:click|preventDefault={() => onOrderBy('created')}>Creado el</a> <a href={"#"} on:click|preventDefault={() => onOrderBy('created')}>Creado el</a>
<!-- {#if ordering === 'created'}<i class="bi bi-caret-up-fill"></i>{/if} <!-- {#if ordering === 'created'}<i class="bi bi-caret-up-fill"></i>{/if}
@ -187,20 +187,20 @@
{/if} {/if}
</td> </td>
<td>{adjustDateTimeByOffset(app.created)}</td> <td>{adjustDateTimeByOffset(app.created)}</td>
<td > <td >
{#if app.status.toUpperCase().includes('CON REPAROS')} {#if app.status.toUpperCase().startsWith('E') or app.status.toUpperCase().startsWith('V')}
<!-- Elemento interactivo para usuarios con 'CON REPAROS' en el estado --> <!-- Elemento interactivo para usuarios con 'CON REPAROS' en el estado -->
<a href={"#"} on:click|preventDefault={() => reporteErroresCargaGTFS(id_red, app.id_gtfs)}> <a href={"#"} on:click|preventDefault={() => reporteErroresCargaGTFS(id_red, app.id_gtfs)}>
{app.status}</a> {app.status}</a>
{:else} {:else}
<!-- Solo texto para estados sin 'CON REPAROS' --> <!-- Solo texto para estados sin 'CON REPAROS' -->
{app.status} {app.status}
{/if} {/if}
</td> </td>
<td>{app.valid_from}</td> <td>{app.valid_from}</td>
<td>{app.vigente ? '✅':'🚫'}</td> <td>{app.vigente ? '✅':'🚫'}</td>
</tr> </tr>
@ -224,11 +224,11 @@
{#if showUpload} {#if showUpload}
<ModalgtfsUpload on:close={() => showUpload = false} {id_red} on:refresh={() => onPage(page)} /> <ModalgtfsUpload on:close={() => showUpload = false} {id_red} on:refresh={() => onPage(page)} />
{/if} {/if}
<style> <style>
.table-responsive { .table-responsive {
max-height: calc(100vh - 300px); max-height: calc(100vh - 300px);
} }
</style> </style>