@extends('layouts.default')
@section('content')
<div class="container-fluid">
    <div class="row mb-3">
        <div class="col-md-8">
            <h3>{{ $page_title }}</h3>
            <p class="text-muted mb-0">{{ $page_description }}</p>
        </div>
        <div class="col-md-4 text-md-end"><a href="{{ route('admin.brand-kits.create') }}" class="btn btn-primary">Yeni Marka Kiti</a></div>
    </div>

    <div class="card">
        <div class="card-body">
            <form method="GET" class="row g-2 mb-4">
                <div class="col-md-4"><input type="text" name="q" class="form-control" placeholder="Marka kiti ara" value="{{ request('q') }}"></div>
                <div class="col-md-3"><select name="client_id" class="form-control default-select"><option value="">Tüm müşteriler</option>@foreach($clients as $client)<option value="{{ $client->id }}" @selected(request('client_id')==$client->id)>{{ $client->company_name }}</option>@endforeach</select></div>
                <div class="col-md-2"><select name="status" class="form-control default-select"><option value="">Durum</option><option value="active" @selected(request('status')==='active')>Aktif</option><option value="passive" @selected(request('status')==='passive')>Pasif</option></select></div>
                <div class="col-md-3"><button class="btn btn-dark me-2">Filtrele</button><a href="{{ route('admin.brand-kits.index') }}" class="btn btn-light">Temizle</a></div>
            </form>

            <div class="table-responsive">
                <table class="table table-hover align-middle">
                    <thead><tr><th>Marka Kiti</th><th>Kapsam</th><th>Renkler</th><th>Kapak</th><th>Şablon</th><th>Durum</th><th class="text-end">İşlem</th></tr></thead>
                    <tbody>
                    @forelse($brandKits as $brandKit)
                        <tr>
                            <td><a class="font-w600 text-black" href="{{ route('admin.brand-kits.show', $brandKit) }}">{{ $brandKit->name }}</a><br><small class="text-muted">{{ Str::limit($brandKit->description, 80) }}</small></td>
                            <td>{{ $brandKit->client?->company_name ?: 'Genel' }}</td>
                            <td><span class="badge" style="background:{{ $brandKit->primary_color }}">Ana</span> <span class="badge" style="background:{{ $brandKit->accent_color }}">Vurgu</span></td>
                            <td>{{ ucfirst($brandKit->cover_style) }}</td>
                            <td>{{ $brandKit->report_templates_count }}</td>
                            <td>@if($brandKit->is_active)<span class="badge badge-success">Aktif</span>@else<span class="badge badge-secondary">Pasif</span>@endif @if($brandKit->is_default)<span class="badge badge-primary">Varsayılan</span>@endif</td>
                            <td class="text-end"><a href="{{ route('admin.brand-kits.edit', $brandKit) }}" class="btn btn-sm btn-outline-primary">Düzenle</a></td>
                        </tr>
                    @empty
                        <tr><td colspan="7" class="text-center text-muted py-5">Henüz marka kiti yok.</td></tr>
                    @endforelse
                    </tbody>
                </table>
            </div>
            {{ $brandKits->links() }}
        </div>
    </div>
</div>
@endsection
