<div>
    <div class="card-header">
        <div class="d-flex justify-content-between align-items-center">
            <strong>{{ $this->selectedTaxonomyName ? $this->selectedTaxonomyName : 'Kategorizasyon' }}</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">Alt Başlık</th>
                                <th scope="col">İşlem</th>
                            </tr>
                        </thead>
                        <tbody wire:sortable="updateOrder">
                            @foreach ($this->taxonomy as $taxonomy)
                                <tr wire:sortable.item="{{ $taxonomy->id }}" wire:key="item-{{ $taxonomy->id }}">
                                    <td wire:sortable.handle style="cursor:move;">
                                        <button class="btn btn-sm btn-link"
                                            wire:click.prevent="selectCategory({{ $taxonomy->id }})">
                                            {{ $taxonomy->name }}
                                        </button>
                                    </td>
                                    <td class="text-secondary">
                                        {{ $taxonomy->childrenCount() }}
                                    </td>
                                    <td>
                                        <a href="{{ route('admin.taxonomy.edit', $taxonomy->id) }}" class="btn btn-sm btn-outline-primary">
                                            <span class="cil-pencil"></span>
                                        </a>

                                        @if($taxonomy->isDeletable)
                                            <button type="button" wire:click="deleteConfirm({{ $taxonomy->id }})" wire:loading.attr="disabled" class="btn btn-sm btn-outline-secondary text-secondary">
                                                <span class="cil-trash"></span>
                                            </button>
                                        @endif
                                    </td>
                                </tr>
                            @endforeach
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <div class="px-4">
        {{ $this->taxonomy->links() }}
    </div>
</div>
