<div>
    @if ($posts->count() == 0)
        <div class="text-center py-5">Нет данных для отображения</div>
    @else
        <div class="fs-5 bg-light p-0 m-0 border border-1 rounded-4 py-3">
            <table class="table m-0">
                <thead>
                    <tr scope="col">
                        <th>Название
                        <th>Дата создания
                        <th>Дата изменения
                        <th>
                    </tr>
                </thead>
                <tbody class=" ">
                    @foreach ($posts as $post)
                        <tr scope="row">
                            <td class="align-middle">
                                {{ $post->name }}
                                <br>{{ $post->city }}
                            </td>
                            <td>
                                {{ $post->created_at->diffForHumans() }}
                            </td>
                            <td>
                                @if ($post->created_at != $post->updated_at)
                                    {{ $post->updated_at->diffForHumans() }}
                                @else
                                    &mdash;
                                @endif
                            </td>
                            <td>
                                <div class="dropdown" style="">
                                    <button class="btn btn-light" type="button" id="dropdownMenuButton"
                                        data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                        <i class="bi bi-three-dots-vertical"></i>
                                    </button>
                                    <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
                                        <a class="dropdown-item" wire:click="open({{ $post->id }})"
                                            target="_blank">Открыть</a>
                                        <a class="dropdown-item"
                                            href="{{ route('admin.posts.edit', ['post' => $post]) }}">Редактировать</a>
                                        <form method="post"
                                            action="{{ route('admin.posts.delete', ['post' => $post]) }}">
                                            @csrf
                                            <button class="dropdown-item" type="submit">Удалить</button>
                                        </form>
                                    </div>
                                </div>
                            </td>
                        </tr>
                    @endforeach
                </tbody>
            </table>
        </div>
    @endif
    @livewire('post.card')
</div>
