2023-07-21 19:26:43 -04:00
|
|
|
<script>
|
2023-07-24 22:40:57 -04:00
|
|
|
import PageTitle from "$/components/PageTitle.svelte";
|
|
|
|
import { getMarcasParaderos } from "$/services/mapas";
|
|
|
|
import { storeParaderos } from "$/stores/global";
|
|
|
|
import GoogleMap from '$/components/GoogleMap.svelte'
|
|
|
|
import IconLoading from "$/components/IconLoading.svelte";
|
2023-07-21 19:26:43 -04:00
|
|
|
|
2023-07-24 22:40:57 -04:00
|
|
|
let my_map = null;
|
|
|
|
let data_map = null
|
2023-07-21 19:26:43 -04:00
|
|
|
|
2023-07-24 22:40:57 -04:00
|
|
|
$: init_google_map($storeParaderos)
|
|
|
|
$: console.log({ data_map })
|
|
|
|
|
|
|
|
async function init_google_map(data_inicial) {
|
|
|
|
const paraderos = data_inicial || await getMarcasParaderos()
|
|
|
|
storeParaderos.set(paraderos);
|
|
|
|
data_map = paraderos;
|
2023-07-21 19:26:43 -04:00
|
|
|
}
|
2023-07-24 22:40:57 -04:00
|
|
|
|
|
|
|
|
2023-07-21 19:26:43 -04:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<PageTitle>Paraderos</PageTitle>
|
|
|
|
|
|
|
|
<div class="card">
|
2023-07-24 22:40:57 -04:00
|
|
|
<div class="card-header">
|
|
|
|
<button class="btn btn-outline-secondary" on:click|preventDefault={() => init_google_map(null)}><i class="bi bi-arrow-repeat"></i> Refrescar</button>
|
|
|
|
</div>
|
2023-07-21 19:26:43 -04:00
|
|
|
<div class="card-body">
|
2023-07-24 22:40:57 -04:00
|
|
|
{#if data_map}
|
|
|
|
<GoogleMap
|
|
|
|
google_api_key={data_map.google_api_key}
|
|
|
|
center={data_map.center}
|
|
|
|
zoom={data_map.zoom}
|
|
|
|
marks={data_map.marks}
|
|
|
|
/>
|
|
|
|
{:else}
|
|
|
|
<IconLoading />
|
|
|
|
{/if}
|
2023-07-21 19:26:43 -04:00
|
|
|
</div>
|
|
|
|
</div>
|