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

            <div class="d-flex align-items-center gap-2">
                <div class="input-group w-50 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 class="input-group w-100 position-relative">
                    <input type="text" class="form-control" placeholder="Ara..." wire:model.live.debounce.150ms="search">
                    <div class="position-relative top-0 end-0 mt-1 me-2" wire:loading>
                        <div class="spinner-border" role="status" style="margin-left:10px;">
                            <span class="visually-hidden">Yükleniyor...</span>
                        </div>
                    </div>
                </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">Dil</th>
                                <th scope="col">Link</th>
                                @can('language.update')
                                    <th scope="col">Durum</th>
                                    <th scope="col">Varsayılan</th>
                                    <th scope="col">İşlem</th>
                                @endcan
                            </tr>
                        </thead>
                        <tbody wire:sortable="updateOrder">
                            @foreach($getLanguages as $language)
                                <tr wire:sortable.item="{{ $language->id }}" wire:key="item-{{ $language->id }}">
                                    <td wire:sortable.handle style="cursor:move;">
                                        @if(file_exists(public_path('admin/vendors/@coreui/icons/svg/flag/cif-'.$language->short.'.svg')))
                                            <i class="icon icon-lg cif-{{ $language->short }}"></i>
                                        @else
                                            <i class="icon icon-lg cil-image-broken"></i>
                                        @endif

                                        <span class="mx-2">{{ $language->title }}</span>
                                    </td>

                                    <td> {{ $language->short }} </td>

                                    @can('language.update')
                                        <td>
                                            <div class="form-check form-switch form-switch-xl">
                                                <input
                                                    class="form-check-input"
                                                    id="flexSwitchCheckDefaultXlStatus_{{ $language->id }}"
                                                    type="checkbox"
                                                    wire:change="changeStatus({{ $language->id }})"
                                                    wire:loading.attr="disabled"
                                                    @if ($language->status == 1) checked @endif
                                                >
                                            </div>
                                        </td>

                                        <td>
                                            <div class="form-check form-switch form-switch-xl">
                                                <input
                                                    class="form-check-input"
                                                    id="flexSwitchCheckDefaultXlDefault_{{ $language->id }}"
                                                    type="checkbox"
                                                    wire:change="changeDefault({{ $language->id }})"
                                                    wire:loading.attr="disabled"
                                                    @if ($language->default == 1) checked @endif
                                                >
                                            </div>
                                        </td>

                                        <td>
                                            <a href="{{ route('admin.languages.variables', $language->id) }}" class="btn btn-sm btn-outline-primary">
                                                <i class="cil-language"></i>
                                            </a>
                                        </td>
                                    @endcan
                                </tr>
                            @endforeach
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <div class="px-4">
        {{ $getLanguages->links() }}
    </div>
</div>
