<div>
    <div class="card-header">
        <div class="d-flex justify-content-between align-items-center">
            <strong>Sertifikalar</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 class="input-group w-100 position-relative">
                    <select class="form-select" wire:model.live="type">
                        <option value="">Seçiniz</option>
                        @foreach(\App\Enums\CertificateTypes::cases() as $type)
                            <option value="{{ $type->value }}">{{ $type->getText() }} ({{ $type->getFileType() }})</option>
                        @endforeach
                    </select>
                </div>

                <div class="input-group w-100 position-relative">
                    <input type="text" class="form-control" placeholder="Code" 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">#</th>
                                <th scope="col">Başlık</th>
                                <th scope="col">İşlem</th>
                            </tr>
                        </thead>
                        <tbody>
                            @foreach ($this->certificates as $crt)
                                <tr wire:key="item-{{ $crt->id }}">
                                    <td>
                                        <span class="badge bg-light text-dark">{{ $crt->id }}</span>
                                    </td>
                                    <td style="cursor:move;">
                                        {{ $crt->title }}
                                    </td>
                                    <td>
                                        <a href="{{ URL::to($crt->file_path) }}" class="btn btn-sm btn-outline-secondary text-secondary" target="_blank">
                                            <span class="cil-cloud-download"></span>
                                        </a>

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