<div class="m-0 p-0">
    <div class="card card-sm shadow">
        <div class="card-header bg-secondary d-flex justify-content-between">
            <a href="{{ route($createPath) }}" class="btn btn-primary">
                <span class="icon-plus"></span>
                Vytvoriť novú kategóriu možností
            </a>
            <form class="d-flex align-items-center">
                <span class="mr-2 text-muted text-small text-nowrap">Zoradiť:</span>
                <select class="custom-select" wire:model="sort">
                    <option value="1">od najstarších</option>
                    <option value="0">od najnovších</option>
                </select>
            </form>
        </div>
        <div class="list-group list-group-flush">
            @forelse($moznostiUdalosti as $moznostUdalosti)
                <a class="list-group-item" href="{{ route($editPath, $moznostUdalosti) }}">
                    <div class="media item-align-center">
                        <div class="media-body">
                            <div class="d-flex justify-content-between">
                                <div>
                                    <h3 class="h4 text-truncate">
                                        {{ $moznostUdalosti->nazov }}
                                    </h3>
                                </div>
                                <div>
                                @if($moznostUdalosti->trashed())
                                    <div class="badge badge-danger">ZNEPLATNENÉ</div>
                                @else
                                    <div class="badge" style="background-color: {{$moznostUdalosti->stav->color()}}">{{mb_strtoupper($moznostUdalosti->stav->label)}}</div>
                                @endif
                                </div>
                            </div>
                            <div class="d-flex justify-content-between">
                                <div class="text-small">
                                    <ul class="list-inline text-muted">
                                        <li class="list-inline-item">
                                            <span class="icon-user"></span>
                                            Vytvoril: {{ $moznostUdalosti->vytvoril->cele_meno }}
                                        </li>
                                        <li class="list-inline-item">
                                            <span class="icon-calendar"></span>
                                            Vytvorená: {{ $moznostUdalosti->created_at->longRelativeDiffForHumans() }}
                                        </li>
                                        <li class="list-inline-item">
                                            <span class="icon-calendar"></span>
                                            Aktualizovaná: {{ $moznostUdalosti->updated_at->longRelativeDiffForHumans() }}
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>
                </a>
            @empty
                <div class="list-group-item bg-light d-flex justify-content-center disabled py-4">
                    <span class="text-muted h5">Žiadne možnosti udalosti sa nenašli...</span>
                </div>
            @endforelse
        </div>
    </div>

    @if($moznostiUdalosti->isNotEmpty() && $moznostiUdalosti->hasPages())
        <div class="d-flex justify-content-center">
            {{ $moznostiUdalosti->links() }}
        </div>
    @endif
</div>