<script setup>
import { onMounted } from 'vue';
import useLoader    from '@Stores/Loader';
import { hasPermission } from '@Plugins/RolePermission';

import Layout  from '@Holos/Layout/App.vue';
import Link    from '@Holos/Skeleton/Sidebar/Link.vue';
import Section from '@Holos/Skeleton/Sidebar/Section.vue';

/** Definidores */
const loader = useLoader()

/** Propiedades */
defineProps({
    title: String,
});

/** Ciclos */
onMounted(() => {
    loader.boot()
})

</script>

<template>
    <Layout
        :title="title"
    >
    
        <template #leftSidebar>
            <Section name="Principal">
                <Link
                    icon="add_home"
                    name="Gestionar Direcciones" 
                    to="address.index"
                />
                <Link
                    icon="how_to_vote"
                    name="Gestionar Conceptos" 
                    to="concept.index"
                />
                <Link
                    icon="receipt_long"
                    name="Gestionar Multas" 
                    to="fine.index"
                />
                <Link
                    icon="car_tag"
                    name="Autorizar Descuentos" 
                    to="discount.index"
                />
                <Link
                    icon="card_membership"
                    name="Cobro de Membresía" 
                    to="membership.index"
                />
                <Link
                    icon="point_of_sale"
                    name="Entrega de caja" 
                    to="checkout.index"
                />
                <Link
                    icon="request_quote"
                    name="Solicitudes de Factura" 
                    to="invoice-request.index"
                />
            </Section>
            <Section
                v-if="hasPermission('users.index')"
                :name="$t('admin.title')"
            >
                <Link
                    v-if="hasPermission('users.index')"
                    icon="people"
                    name="users.title" 
                    to="admin.users.index"
                />
                <Link
                    v-if="hasPermission('roles.index')"
                    icon="license"
                    name="roles.title" 
                    to="admin.roles.index"
                />
                <Link
                    v-if="hasPermission('activities.index')"
                    icon="event"
                    name="history.title" 
                    to="admin.activities.index"
                />
            </Section>
        </template>
        <!-- Contenido -->
        <RouterView />
        <!-- Fin contenido -->
    </Layout>
</template>
