<section>
    <div class="container">
        <div class="row justify-content-center mb-5">
            <div class="col-auto">
                <h3 class="h4">Kategórie učebných materiálov</h3>
            </div>
        </div>
        <div class="row justify-content-center">
            <div class="col-12 col-lg-10">
                <ul class="feature-list feature-list-sm row">
                    @foreach($zoznamKategorii as $kategoria)
                    <li class="col-6 col-md-4">
                        <div class="card">
                            <a href="{{ route('vzdelavanie.kniznica.kategoria.ucebnice.index', ['kategoriaId' => $kategoria->getKey()]) }}" class="card-body text-center">
                                <i class="fa {{ $kategoria->obrazok }} fa-4x p-2"></i>
                                <h6 class="title-decorative">{{ $kategoria->nazov }}</h6>
                            </a>
                            @can('vzdelavanie_kniznica')
                            <div class="card-footer d-flex justify-content-between">
                                <div></div>
                                <div class="dropdown">
                                    <div class="btn btn-sm btn-outline-primary dropdown-toggle dropdown-toggle-no-arrow" id="SidekickButton-{{$kategoria->getKey()}}" data-toggle="dropdown">
                                        <i class="icon-dots-three-horizontal"></i>
                                    </div>
                                    <div class="dropdown-menu dropdown-menu-sm" aria-labelledby="SidekickButton-{{$kategoria->getKey()}}">
                                        <a class="dropdown-item" href="{{ route('vzdelavanie.kniznica.kategoria.edit', ['kategoriaId' => $kategoria->getKey()]) }}">
                                            <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->getKey() }}').submit() : null;">
                                            <i class="fa fa-trash-alt"></i> Odstrániť
                                        </a>
                                        <form id="form-delete-{{ $kategoria->getKey() }}" action="{{ route('vzdelavanie.kniznica.kategoria.destroy', ['kategoriaId' => $kategoria->getKey()]) }}" method="post" class="d-inline d-inline-flex" style="display: none !important;">
                                            @method('delete')
                                            @csrf
                                        </form>
                                    </div>
                                </div>
                            </div>
                            @endcan
                        </div>
                    </li>
                    @endforeach

                    @can('vzdelavanie_kniznica')
                    <li class="col-6 col-md-4">
                        <a href="{{ route('vzdelavanie.kniznica.kategoria.create') }}" class="card text-center border-dark border-1">
                            <span class="card-body bg-success text-white">
                                <i class="fa fa-plus fa-4x p-2"></i>
                                <h6 class="title-decorative">Nová kategória</h6>
                            </span>
                        </a>
                    </li>
                    @endcan
                </ul>
            </div>
            @if($zoznamKategorii->isEmpty())
            <div class="alert alert-info">
                <span>Zatiaľ nebola vytvorená žiadna kategória učebného materiálu.</span>
            </div>
            @endif
        </div>
    </div>
</section>