Tedarikçi Teklifi — {{ $quote->contact->display_name }} {{-- Sayfanın satır içi sözlüğü SİLİNDİ: dört koyu gradyan başlık şeridi, gradyanlı tablo başlıkları, her düğmede onmouseover ile renk takası, 16px yuvarlatılmış mor gölgeli kartlar ve eski token kümesi (--ks-surface / --ks-tint-* / --ks-c-* / --ks-on-*). DEĞİŞMEYENLER (başka kod bunlara bağlı): `.sq-pct-saha` / `.sq-pct-lab` sınıfları yüzde toplamını DOM'dan okuyan pctChanged() için, `pct-changed` olayı, `meta[name=csrf-token]` okuması ve bütün fetch çağrıları. --}} @php /* Kategori rengi KategoriRenkleri'nden ve tema-duyarlı değişkenle; sayfa dört ayrı hex paleti taşıyordu ve koyu temada aydınlık tonda kalıyordu. */ $katDegisken = fn ($slug) => 'var(--' . \App\Support\KategoriRenkleri::degiskenAdi($slug) . ')'; $margin = null; $marginPct = null; if ($proposal->total_amount > 0 && $quote->total_amount > 0) { $margin = $proposal->total_amount - $quote->total_amount; $marginPct = ($margin / $proposal->total_amount) * 100; } @endphp
{{ $proposal->proposal_number }} {{ $quote->contact->display_name }} {{ $quote->statusLabel() }} @if($quote->status === 'bekliyor')
@csrf
@csrf
@endif
{{-- ═══════════ SOL KOLON ═══════════ --}}
{{-- Teklif Kalemleri --}}
Teklif Kalemleri {{ number_format($quote->total_amount, 2, ',', '.') }} ₺
@if($quote->items->isNotEmpty()) @php $sqGroupedItems = \App\Models\ServiceItem::sortGroupedByCategory( $quote->items->groupBy(function ($item) { return $item->serviceItem ? ($item->serviceItem->category ?? '__other__') : '__other__'; }) ); @endphp
@foreach($sqGroupedItems as $sqCategorySlug => $sqCatItems) @php $sqCategoryName = \App\Models\ServiceItem::$categoryLabels[$sqCategorySlug] ?? 'Katalog Dışı'; $sqCatRenk = $sqCategorySlug === '__other__' ? 'var(--ks-t-yazi-soluk)' : $katDegisken($sqCategorySlug); $sqCategoryTotal = $sqCatItems->sum('total_price'); @endphp @foreach($sqCatItems as $item) @php $sqIsItemSondaj = $item->sondaj_count && $item->serviceItem && $item->serviceItem->category === 'sondaj'; $sqHasMetraj = $item->serviceItem && $item->serviceItem->has_metraj; @endphp @endforeach @endforeach
Kod Hizmet Adı / Açıklama Birim Miktar Birim Fiyat Toplam
{{ $sqCategoryName }} {{ number_format($sqCategoryTotal, 2, ',', '.') }} ₺
@if($item->serviceItem) {{ $item->serviceItem->code }} @else — @endif @if($item->serviceItem)
{{ $item->serviceItem->name }}
@else
Katalog dışı
@endif @if($item->description)
{{ $item->description }}
@endif
@if($sqIsItemSondaj && $sqHasMetraj && $item->unit === 'metre') {{ $item->sondaj_count }} SK × {{ number_format($item->quantity / $item->sondaj_count, 1, ',', '.') }}m @elseif($sqIsItemSondaj && $sqHasMetraj && $item->unit === 'adet') {{ $item->sondaj_count }} SK @elseif($sqIsItemSondaj) {{ $item->sondaj_count }} kuyu @if($item->unit === 'metre') · {{ number_format($item->quantity, 1, ',', '.') }} m @endif @else {{ $item->unit ?: '—' }} @endif @if($sqIsItemSondaj && $sqHasMetraj && $item->unit === 'metre') {{ number_format($item->quantity, 1, ',', '.') }} m @elseif($sqIsItemSondaj && $item->unit === 'metre') {{ number_format($item->quantity / $item->sondaj_count, 1, ',', '.') }} m/kuyu @elseif($sqIsItemSondaj) — @else {{ number_format($item->quantity, 2, ',', '.') }} @endif {{ number_format($item->unit_price, 2, ',', '.') }} ₺ {{ number_format($item->total_price, 2, ',', '.') }} ₺
TOPLAM {{ number_format($quote->total_amount, 2, ',', '.') }} ₺
@else
Henüz kalem eklenmemiş.
@endif
{{-- Teklif Notu --}}
Teklif Notu
{{-- Tedarikçi Sorumlulukları --}}
Sorumluluklar {{ $quote->sqResponsibilities->count() }} kalem
@if($quote->sqResponsibilities->isNotEmpty()) @php $sqRespAll = $quote->sqResponsibilities; $sqRespCols = [[], [], []]; // Sıralama: yukarıdan aşağıya, soldan sağa (column-fill) $sqTotalResp = $sqRespAll->count(); $sqRowsPerCol = (int) ceil($sqTotalResp / 3); foreach ($sqRespAll as $i => $r) { $colIndex = min(2, intdiv($i, $sqRowsPerCol)); $sqRespCols[$colIndex][] = ['idx' => $i, 'resp' => $r]; } @endphp {{-- Üç sütun bilerek: 20+ satır tek sütunda sayfayı uzatıyor. `auto-fit` kendi kendine daralır, dar ekranda tek sütuna iner. --}}
@foreach($sqRespCols as $sqColIdx => $sqColItems) @continue(empty($sqColItems))
@foreach($sqColItems as $sqItem) @php $sqIdx = $sqItem['idx']; $sqResp = $sqItem['resp']; @endphp {{-- Üç seçenek birbirini dışlıyor: aynı anda yalnız biri işaretli. Renk ANLAM taşıyor (kimde sorumluluk var). --}} @endforeach
No Açıklama Yok Yük. İşv.
{{ $sqIdx + 1 }}
@endforeach
@endif
@csrf
{{-- Tedarikçi Ödeme Planı --}}
Ödeme Planı Saha % Lab/Rapor %
@foreach([['saha', 'Saha Çalışması Aşaması', 'sq-pct-saha'], ['lab', 'Laboratuvar & Rapor Aşaması', 'sq-pct-lab']] as [$faz, $fazAd, $pctSinif])
{{ $fazAd }}
@foreach($quote->paymentItems->where('phase', $faz)->values() as $i => $pi)
%
@endforeach
@csrf
@endforeach
Saha toplam % (100 olmalı) Lab/Rapor toplam % (100 olmalı)
{{-- ═══════════ SAĞ KOLON ═══════════ --}}
Teklif Özeti
@if($margin !== null) {{ $margin >= 0 ? '+' : '' }}{{ number_format($margin, 2, ',', '.') }} ₺
%{{ number_format(abs($marginPct), 1, ',', '.') }} {{ $margin >= 0 ? 'kâr' : 'zarar' }}
@endif