<div>
    <div class="card-header">
        <div class="d-flex justify-content-between align-items-center">
            <strong>Navigasyon</strong>

            <div class="d-flex align-items-center gap-2">
                <div class="input-group position-relative">
                    <select class="form-select" wire:model.live="paginate" id="paginate">
                        <option value="10">10</option>
                        <option value="25">25</option>
                        <option value="50">50</option>
                        <option value="100">100</option>
                        <option value="250">250</option>
                        <option value="500">500</option>
                    </select>
                </div>
            </div>

        </div>
    </div>

    <div class="card-body">
        <div class="example">
            <div class="tab-content rounded-bottom">
                <div class="tab-pane active preview" role="tabpanel" id="preview-1005">
                    <table class="table table-hover">
                        <thead>
                            <tr>
                                <th scope="col">Başlık</th>
                                <th scope="col">Açıklama</th>
                                <th scope="col">İşlem</th>
                            </tr>
                        </thead>
                        <tbody wire:sortable="updateOrder">
                            @if(!$this->navigationMenu)
                                <tr>
                                    <td><a href="{{ route('admin.navigation.menu.index', 0) }}" class="btn btn-sm btn-link">Ana Menü</a></td>
                                    <td><i>Sadece sayfalar modülünden düzenlenebilir.</i></td>
                                    <td></td>
                                </tr>
                            @endif

                            @foreach($this->menus as $menu)
                            <tr wire:sortable.item="{{ $menu->id }}" wire:key="item-{{ $menu->id }}">
                                <td wire:sortable.handle style="cursor:move;">
                                    <a href="{{ route('admin.navigation.link.index', $menu->id) }}" class="btn btn-sm btn-link">
                                        {{ $menu->name }}
                                    </a>
                                </td>
                                <td>{{ $menu->description }}</td>
                                <td>
                                    @can('navigation.read')
                                        @if(count($menu->children) >= 1)
                                            <a href="{{ route('admin.navigation.menu.index', $menu->id) }}" class="btn btn-sm btn-outline-warning">
                                                <span class="cil-arrow-right"></span>
                                            </a>
                                        @endif
                                    @endcan

                                    @can('navigation.update')
                                        <a href="{{ route('admin.navigation.menu.edit', $menu->id) }}" class="btn btn-sm btn-outline-primary">
                                            <span class="cil-pencil"></span>
                                        </a>
                                    @endcan

                                    @can('navigation.delete')
                                        <button type="button" wire:click="deleteConfirm({{ $menu->id }})" wire:loading.attr="disabled" class="btn btn-sm btn-outline-secondary text-secondary">
                                            <span class="cil-trash"></span>
                                        </button>
                                    @endcan
                                </td>
                            </tr>
                            @endforeach
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <div class="px-4">
        {{ $this->menus->links() }}
    </div>
</div>
