<script>
    import { getCountBusesRecorridos } from "$/services/lineas";

    import { createEventDispatcher, onMount } from "svelte";
    const dispatch = createEventDispatcher()
    
    let count = 0;

    onMount(() => {
        dispatch('loading', true)
        getCountBusesRecorridos()
            .then(data => count = data.count)
            .finally(() => dispatch('loading', false))
    })
</script>

<div class="card">
    <div class="card-body">
        <div class="row">
            <div class="col mt-0">
                <h5 class="card-title">Buses en recorrido</h5>
            </div>

            <div class="col-auto">
                <div class="stat text-primary">
                    <i class="bi bi-speedometer2 fs-4"></i>
                </div>
            </div>
        </div>
        <h1 class="mt-1 mb-3">{count}</h1>
    </div>
</div>