Tedarikçi Teklifleri
{{-- ═══ İstatistik Kartları ═══ --}}
{{-- Toplam --}}
Toplam Tedarikçi Teklifi
{{ $stats['toplam'] }}
{{-- Bekleyen --}}
Bekleyen
{{ $stats['bekliyor'] }}
{{-- Kabul Edilen --}}
Kabul Edilen
{{ $stats['kabul'] }}
{{-- Kabul Edilen Tutar --}}
Kabul Edilen Tutar
{{ number_format($stats['tutar'], 0, ',', '.') }}
₺ TL
@php // Aktif filtre sayısı $activeFilterCount = collect(request()->all()) ->filter(fn($v, $k) => $v !== null && $v !== '' && (str_starts_with($k, 'f_') || in_array($k, ['search','status']))) ->count(); // Sütun filtre tanımları $statusOptions = [ 'bekliyor' => 'Bekliyor', 'kabul' => 'Kabul Edildi', 'red' => 'Reddedildi', ]; $columnFilters = [ 'contact' => ['type' => 'text', 'placeholder' => 'firma adı...'], 'proposal_number' => ['type' => 'text', 'placeholder' => 'TKL_...'], 'proposal_title' => ['type' => 'text', 'placeholder' => 'başlık...'], 'status' => ['type' => 'select', 'options' => $statusOptions], 'total_amount_min' => ['type' => 'number', 'placeholder' => 'min ₺...'], 'created_at' => ['type' => 'date'], ]; $formId = 'sqFilterForm'; @endphp {{-- Boş form — sütun filtreleri buna submit eder --}}
{{-- Arama + aktif filtre --}} {{-- ═══ Liste ═══ --}}
@if($quotes->isEmpty())
Tedarikçi teklifi bulunamadı
Filtrelerinizi değiştirin veya yeni taşeron teklifi ekleyin.
@else {{-- Tablo başlık bilgisi --}}
{{ $quotes->total() }} taşeron teklifi @if($quotes->lastPage() > 1) ({{ $quotes->currentPage() }}/{{ $quotes->lastPage() }} sayfa) @endif
@php $statusGroups = [ null => ['bg'=>'var(--ks-tint-amber-2)','color'=>'var(--ks-on-amber-2)','label'=>'Bekliyor'], 'kabul' => ['bg'=>'var(--ks-tint-green-2)','color'=>'var(--ks-on-green-2)','label'=>'Kabul'], 'red' => ['bg'=>'var(--ks-tint-red-2)','color'=>'var(--ks-on-red-2)','label'=>'Red'], ]; $grouped = $quotes->getCollection()->groupBy('status'); @endphp @foreach($grouped as $st => $items) @php $sg = $statusGroups[$st === '' ? null : $st] ?? ['bg'=>'var(--ks-surface-3)','color'=>'var(--ks-text-secondary)','label'=>'—']; @endphp {{ $sg['label'] }}: {{ $items->count() }} @endforeach
{{-- Tablo (yatay scroll + per-column filter) --}}
@php $sqThClass = 'sq-th'; @endphp @include('partials._column_filter_th', ['col' => 'contact', 'label' => 'Tedarikçi Firma', 'thClass' => $sqThClass]) @include('partials._column_filter_th', ['col' => 'proposal_number', 'label' => 'Teklif Kodu', 'thClass' => $sqThClass]) @include('partials._column_filter_th', ['col' => 'proposal_title', 'label' => 'Teklif Başlığı', 'thClass' => $sqThClass]) @include('partials._column_filter_th', ['col' => 'total_amount_min', 'label' => 'Tutar', 'thClass' => $sqThClass, 'align' => 'right']) @include('partials._column_filter_th', ['col' => 'status', 'label' => 'Durum', 'thClass' => $sqThClass, 'align' => 'center']) @include('partials._column_filter_th', ['col' => 'created_at', 'label' => 'Tarih', 'thClass' => $sqThClass, 'align' => 'right']) @foreach($quotes as $sq) @php $sqStatus = $sq->status; $statusCfg = match($sqStatus) { 'kabul' => ['bg'=>'var(--ks-tint-green-2)','color'=>'var(--ks-on-green-2)','label'=>'Kabul'], 'red' => ['bg'=>'var(--ks-tint-red-2)','color'=>'var(--ks-on-red-2)','label'=>'Reddedildi'], default => ['bg'=>'var(--ks-tint-amber-2)','color'=>'var(--ks-on-amber-2)','label'=>'Bekliyor'], }; @endphp {{-- Tedarikçi Firma --}} {{-- Teklif Kodu --}} {{-- Teklif Başlığı --}} {{-- Kalem Sayısı --}} {{-- Tutar --}} {{-- Durum --}} {{-- Tarih --}} {{-- Detay --}} @endforeach
Kalem
{{ mb_strtoupper(mb_substr($sq->contact?->display_name ?? '?', 0, 1, 'UTF-8'), 'UTF-8') }}
{{ $sq->contact?->display_name ?? '—' }}
@if($sq->contact?->phone)
{{ $sq->contact->phone }}
@endif
@if($sq->proposal) {{ $sq->proposal->proposal_number }} @else — @endif @if($sq->proposal) {{ $sq->proposal->title }} @if($sq->proposal->contact)
Müşteri: {{ $sq->proposal->contact->display_name }}
@endif @else — @endif
@if($sq->items->count()) {{ $sq->items->count() }} @else — @endif @if($sq->total_amount)
{{ number_format($sq->total_amount, 2, ',', '.') }}
₺ TL
@else — @endif
{{ $statusCfg['label'] }}
{{ $sq->created_at->format('d.m.Y') }}
{{ $sq->created_at->diffForHumans() }}
@if($sq->proposal) Teklife Git @else — @endif
{{-- sq-table-scroll --}} {{-- Sayfalama --}} @if($quotes->hasPages())
{{ $quotes->firstItem() }}–{{ $quotes->lastItem() }} / {{ $quotes->total() }} kayıt
@if($quotes->onFirstPage()) ← Önceki @else ← Önceki @endif @foreach($quotes->getUrlRange(max(1, $quotes->currentPage()-2), min($quotes->lastPage(), $quotes->currentPage()+2)) as $page => $url) @if($page === $quotes->currentPage()) {{ $page }} @else {{ $page }} @endif @endforeach @if($quotes->hasMorePages()) Sonraki → @else Sonraki → @endif
@endif @endif