@php $currencySymbols = [ 'TRY' => '₺', 'USD' => '$', 'EUR' => '€' ]; $saleSymbol = $currencySymbols[$sale->currency] ?? '₺'; $statusSteps = [ 'potential' => ['label' => 'Potansiyel'], 'offer_sent' => ['label' => 'Teklif Verildi'], 'revised' => ['label' => 'Revize Edildi'], 'confirmed' => ['label' => 'Satış Tamamlandı'], 'in_progress' => ['label' => 'Devam Ediyor'], 'completed' => ['label' => 'Kapanan'], ]; $currentStatus = $sale->status; $statusKeys = array_keys($statusSteps); $statusIndex = array_search($currentStatus, $statusKeys); if ($statusIndex === false) $statusIndex = -1; $isCancelled = in_array($currentStatus, ['cancelled', 'refunded']); @endphp {{-- ═══ HEADER ═══ --}}

{{ $sale->title ?? $sale->sale_code }}

{{ $sale->sale_code }} {{ $sale->customer->full_name }} {{ $sale->start_date->translatedFormat('d M Y') }} @if($sale->end_date && $sale->end_date->ne($sale->start_date)) → {{ $sale->end_date->translatedFormat('d M Y') }} @endif
@if($sale->customer->phone) @endif @if($sale->customer->emails) @endif
{{-- ═══ PIPELINE (Bitrix Style) ═══ --}}
@if($isCancelled)
Bu satış {{ $sale->status_label }} durumundadır.@if($sale->cancellation_reason)— {{ $sale->cancellation_reason }}@endif
@else
@foreach($statusSteps as $key => $step) @php $stepIdx = array_search($key, $statusKeys); $isCompleted = $stepIdx < $statusIndex; $isCurrent = $key === $currentStatus; $cls = $isCurrent ? 'current' : ($isCompleted ? 'done' : 'future'); @endphp
{{ $step['label'] }}
@endforeach
@endif
{{-- ═══ METRICS ═══ --}}
TOPLAM{{ $saleSymbol }}{{ number_format($sale->total_amount, 2, ',', '.') }}
ÖDENEN{{ $saleSymbol }}{{ number_format($sale->paid_amount, 2, ',', '.') }}
KALAN{{ $saleSymbol }}{{ number_format($sale->remaining_amount, 2, ',', '.') }}
KİŞİ{{ $sale->adult_count + $sale->child_count + $sale->infant_count }}
ÖDEME{{ $sale->payment_status_label }}
{{-- ═══ TABS ═══ --}} {{-- ═══ CONTENT ═══ --}} {{-- TAB: GENEL --}}
{{-- LEFT COLUMN: DEAL & SERVICE INFO --}}
{{-- ANLAŞMA HAKKINDA --}}
Anlaşma Hakkında
{{ $saleSymbol }}{{ number_format($sale->total_amount, 2, ',', '.') }}
{{ $sale->id }}
{{ $sale->sale_code }}
{{ $sale->status_label }}
{{ $sale->start_date->format('Y-m-d') }}
{{ $sale->end_date ? $sale->end_date->format('Y-m-d') : '—' }}
{{ $sale->assignedAgent->full_name ?? 'Atanmamış' }}
{{-- TUR BİLGİLERİ --}}
Tur / Hizmet Bilgileri
{{ $sale->productType->name ?? '—' }}
{{ $sale->product->name ?? ($sale->reservable->name ?? '—') }}
{{ $sale->adult_count }} Yetişkin @if($sale->child_count > 0) , {{ $sale->child_count }} Çocuk @endif @if($sale->infant_count > 0) , {{ $sale->infant_count }} Bebek @endif
{{ $sale->payment_status_label }}
{{-- ÖZEL ALANLAR --}}
Özel Alanlar
@forelse($customFieldDefinitions as $definition) @php $valRecord = $sale->customFields->where('field_definition_id', $definition->id)->first(); $val = $valRecord ? $valRecord->value : ''; $opts = []; if ($definition->field_type === 'select' && is_array($definition->options)) { foreach ($definition->options as $opt) { $opts[] = ['value' => $opt, 'label' => $opt]; } } @endphp
{{ $val ?: '—' }}
@empty
Tanımlı özel alan bulunmuyor.
@endforelse
{{-- NOTLAR --}}
Dahili ve Müşteri Notları
{{ $sale->customer_note ?? 'Not bulunmuyor...' }}

{{ $sale->internal_note ?? 'Sadece çalışanlar görebilir...' }}
{{-- RIGHT COLUMN: ACTIVITY COMPOSER & TIMELINE --}}
{{-- Composer Tabbed Card --}}
{{-- Composer Sub-Tabs --}} {{-- Composer Input Form --}}
@csrf {{-- Dynamic Subject Input --}}
{{-- Dynamic Due Date Input --}}
Bitiş Tarihi:
{{-- Body TextArea --}}
{{-- Attachment Preview Card --}}
{{-- Footer Actions Bar --}}
{{-- File Upload Label/Button --}} {{-- Important Flag Button --}}
{{-- Scrollable Activities Feed --}}
@include('agency.sales.partials.activities-feed', ['sale' => $sale])
{{-- TAB: ÜRÜNLER --}}
Ürün Kataloğu & Satış Kalemleri

Adı direkt yazın · veya Katalog butonuyla kayıtlı ürünlerinizden seçin

@forelse($sale->items as $item) @empty @endforelse
Ürün / Hizmet Adı Adet Birim Fiyat KDV KDV Tutarı Toplam
{{ $currencySymbols[$item->currency] ?? '₺' }}{{ number_format($item->tax_amount, 2, ',', '.') }} {{ $currencySymbols[$item->currency] ?? '₺' }}{{ number_format($item->total_price, 2, ',', '.') }}
{{-- Summary Block --}}
Kalemleri düzenledikten sonra sağ üstteki Kaydet butonuna basın.
Ara Toplam: {{ $saleSymbol }}{{ number_format($sale->subtotal, 2, ',', '.') }}
KDV Toplamı: {{ $saleSymbol }}{{ number_format($sale->tax_amount, 2, ',', '.') }}
Genel Toplam: {{ $saleSymbol }}{{ number_format($sale->total_amount, 2, ',', '.') }}
{{-- PRODUCT CATALOG MODAL --}} {{-- TAB: GEÇMİŞ --}}
@include('agency.sales.partials.activities-feed', ['sale' => $sale])
{{-- TAB: BELGELER --}}
{{-- LEFT: Upload Form --}}
Belge Yükle
Dosyayı sürükleyin veya tıklayın
En fazla: 10MB
{{-- RIGHT: Document List --}}
Kayıtlı Belgeler ({{ $sale->documents->count() }})
@forelse($sale->documents as $doc) @php $ext = pathinfo($doc->file_name, PATHINFO_EXTENSION); $icon = match(strtolower($ext)) { 'pdf' => 'fa-file-pdf text-danger', 'jpg', 'jpeg', 'png', 'gif' => 'fa-file-image text-success', 'doc', 'docx' => 'fa-file-word text-primary', 'xls', 'xlsx' => 'fa-file-excel text-success', 'zip', 'rar' => 'fa-file-archive text-warning', default => 'fa-file-alt text-secondary' }; @endphp @empty @endforelse
Belge Adı Boyut Ekleyen İşlemler
{{ $doc->file_name }}
@if($doc->notes)
{{ $doc->notes }}
@endif
{{ $doc->formatted_size }} {{ $doc->creator->full_name ?? 'Sistem' }}
{{ $doc->created_at->format('d.m.Y H:i') }}
@php $isImageOrPdf = in_array(strtolower($ext), ['pdf', 'jpg', 'jpeg', 'png', 'gif', 'webp', 'svg']); @endphp @if($isImageOrPdf) @endif
Kayıtlı belge bulunmuyor.
{{-- MODAL --}} {{-- CUSTOM FIELD MODAL --}} {{-- DOCUMENT PREVIEW MODAL --}} {{-- FOOTER --}}
{{ $sale->created_at->format('d.m.Y H:i') }} — {{ $sale->creator->full_name ?? 'Sistem' }}