<div class="card card-sm shadow">
    <div class="card-header">
        <span class="h6 title-decorative">Kategórie</span>
    </div>
    <ul class="list-group list-group-flush">
    @forelse($kategorie as $_kategoria)
        @can('vzdelavanie_kniznica')
        <li class="list-group-item d-flex justify-content-between align-items-center">
            <a href="{{ route('vzdelavanie.sprava.kniznica.kategoria.ucebnice.index', $_kategoria) }}">
                <div class="text-truncate">
                    <i class="fa {{ $_kategoria->obrazok }} mr-1"></i>
                    {{ $_kategoria->nazov }}
                </div>
            </a>
            <div class="dropdown">
                <div class="btn btn-sm btn-outline-primary dropdown-toggle dropdown-toggle-no-arrow" id="SidekickButton" data-toggle="dropdown">
                    <i class="icon-dots-three-horizontal"></i>
                </div>
                <div class="dropdown-menu dropdown-menu-sm" aria-labelledby="SidekickButton">
                    <a class="dropdown-item" href="{{ route('vzdelavanie.sprava.kniznica.kategoria.edit', $_kategoria) }}">
                        <i class="fa fa-pen"></i> Upraviť
                    </a>
                    <a class="dropdown-item" href="#" onclick="event.preventDefault();(confirm('Prajete si odstrániť kategóriu?')) ? document.getElementById('form-delete-{{ $_kategoria->hashId() }}').submit() : null;">
                        <i class="fa fa-trash-alt"></i> Odstrániť
                    </a>
                    <form id="form-delete-{{ $_kategoria->hashId() }}" action="{{ route('vzdelavanie.sprava.kniznica.kategoria.destroy', $_kategoria) }}" method="post" class="d-inline d-inline-flex" style="display: none !important;">
                        @method('delete')
                        @csrf
                    </form>
                </div>
            </div>
        </li>
        @else
        <a
                class="list-group-item list-group-item-action d-flex justify-content-between align-items-center @if(isset($kategoria) && $kategoria->id == $_kategoria->id) text-primary @endif"
                href="{{ route('vzdelavanie.kniznica.kategoria.ucebnice.index', $_kategoria) }}"
        >
            <div class="text-truncate">
                <i class="fa {{ $_kategoria->obrazok }} mr-1"></i>
                {{ $_kategoria->nazov }}
            </div>
            <div>
                <i class="icon-chevron-right"></i>
            </div>
        </a>
        @endcan
    @empty
        <li class="list-group-item">
            <h6 class="title-decorative text-center">žiadna kategória</h6>
        </li>
    @endforelse
    </ul>
    @can('vzdelavanie_kniznica')
    <div class="card-footer">
        <a href="{{ route('vzdelavanie.sprava.kniznica.kategoria.create') }}" class="btn btn-block btn-outline-primary">
            <i class="fa fa-plus"></i>
            Vytvoriť kategóriu
        </a>
    </div>
    @endcan
</div>