<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é miesto
            </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($miesta as $miesto)
                <a class="list-group-item" href="{{ route($editPath, $miesto) }}">
                    <div class="media item-align-center">
                        <div class="media-body">
                            <div class="d-flex justify-content-between">
                                <div>
                                    <h3 class="h4 text-truncate">
                                        {{ $miesto->nazov }}
                                        <small class="text-muted lead">{{ $miesto->ulica }}, {{ $miesto->obec }}, {{ $miesto->psc }}, {{ $miesto->krajina }}</small>
                                    </h3>
                                </div>
                                <div>
                                @if($miesto->trashed())
                                    <div class="badge badge-danger">ZNEPLATNENÉ</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: {{ $miesto->vytvoril->cele_meno }}
                                        </li>
                                        <li class="list-inline-item">
                                            <span class="icon-calendar"></span>
                                            Vytvorená: {{ $miesto->created_at->longRelativeDiffForHumans() }}
                                        </li>
                                        <li class="list-inline-item">
                                            <span class="icon-calendar"></span>
                                            Aktualizovaná: {{ $miesto->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 miesta sa nenašli...</span>
                </div>
            @endforelse
        </div>
    </div>

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