@extends('agency.layouts.app') @section('title', $customer->full_name) @section('page_title', 'Müşteri Detayı') @push('styles') @endpush @php $statusOptions = [ ['value' => 'active', 'label' => 'Aktif'], ['value' => 'inactive', 'label' => 'Pasif'], ['value' => 'blocked', 'label' => 'Engelli'], ['value' => 'potential', 'label' => 'Potansiyel'], ]; $priorityOptions = [ ['value' => '1', 'label' => 'Öncelikli'], ['value' => '0', 'label' => 'Normal'], ]; $genderOptions = [ ['value' => 'male', 'label' => 'Erkek'], ['value' => 'female', 'label' => 'Kadın'], ['value' => 'other', 'label' => 'Diğer'], ]; @endphp @section('content')
{{-- Breadcrumb row --}}
Müşteriler {{ $customer->full_name }}
{{-- Blacklist warning --}} @if($customer->blacklisted)
Bu müşteri kara listede!
{{ $customer->blacklist_reason }}
@csrf
@endif
{{-- Left Card --}}
{{-- Identity --}}
{{ $customer->first_name }} {{ $customer->last_name }}
@if($customer->national_id)
TC: {{ $customer->national_id }}
@endif @if($customer->company_name)
{{ $customer->company_name }}
@endif
{!! $customer->customer_type === 'corporate' ? ' Şirket' : ' Kişi' !!}
{{ $customer->status_label }} {{ $customer->priority_label }} @if($customer->blacklisted) Kara Liste @endif
{{-- Metrics strip --}}
{{ $customer->total_bookings ?? 0 }}
REZERVASYON
{{ number_format((float)($customer->total_spent ?? 0), 0, ',', '.') }}
TOPLAM (₺)
{{ $customer->loyalty_points ?? 0 }}
PUAN
{{-- Info list --}}
E-posta Adresleri
@if($customer->emails && is_array($customer->emails)) @foreach($customer->emails as $email)
{{ $email }}
@endforeach @else — @endif
Telefon
{{ $customer->phone ?: '—' }} @if($customer->phone) @endif
Alt: {{ $customer->phone_alt ?: 'Ekle' }} @if($customer->phone_alt) @endif
@if($customer->national_id)
TC / Kimlik No
{{ $customer->national_id }}
@endif @if($customer->passport_number)
Pasaport No
{{ $customer->passport_number }}
@endif @if($customer->birth_date)
Doğum Tarihi
{{ $customer->birth_date->format('d.m.Y') }} ({{ $customer->birth_date->age }} yaş)
@endif @if($customer->nationality)
Uyruk
{{ strtoupper($customer->nationality) }}
@endif @if($customer->city || true)
Konum
{{ $customer->district ?: 'İlçe' }}, {{ $customer->city ?: 'Şehir' }}
@endif @if($customer->assignedAgent)
Temsilci
{{ $customer->assignedAgent->full_name }}
@endif @if($customer->loyalty_tier)
Sadakat Seviyesi
{{ $customer->loyalty_tier_label }}
@endif
{{-- Quick actions --}}
Bilgileri Düzenle Aktivite Ekle Özel Alanları Düzenle
{{-- ════════════════ RIGHT PANEL ════════════════ --}}
{{-- Tab nav --}}
@if($customer->isCorporate()) @endif
{{-- ── TAB: OVERVIEW ── --}}
{{-- Activity stats & Communication --}}
{{-- Stats Grid --}}
@foreach([ ['label'=>'Toplam','val'=>$activityStats['total'],'icon'=>'fas fa-list','clr'=>'#6366f1','bg'=>'#eef2ff'], ['label'=>'Bekleyen','val'=>$activityStats['pending'],'icon'=>'fas fa-clock','clr'=>'#f59e0b','bg'=>'#fef3c7'], ['label'=>'Şikayet','val'=>$activityStats['complaints'],'icon'=>'fas fa-exclamation-circle','clr'=>'#ef4444','bg'=>'#fee2e2'], ['label'=>'Takip','val'=>$activityStats['follow_up'],'icon'=>'fas fa-flag','clr'=>'#8b5cf6','bg'=>'#ede9fe'], ] as $ac)
{{ $ac['val'] }}
{{ $ac['label'] }}
@endforeach
{{-- Communication Permissions --}}
İletişim İzinleri
E-posta
@if($customer->email_marketing) AKTİF @else KAPALI @endif
SMS / Mobil
@if($customer->sms_marketing) AKTİF @else KAPALI @endif
{{-- Recent activities --}}
Son Aktiviteler Tümünü Gör
@if($recentActivities->isEmpty())

Henüz aktivite yok.

İlk Aktiviteyi Ekle
@else
@foreach($recentActivities as $act) @php $dotClass = match($act->activity_type) { 'call' => 'call', 'email' => 'email', 'meeting' => 'meeting', 'booking' => 'booking', 'complaint' => 'complaint', 'note' => 'note', default => 'default' }; $dotIcon = match($act->activity_type) { 'call' => 'fas fa-phone', 'email' => 'fas fa-envelope', 'meeting' => 'fas fa-people-group', 'booking' => 'fas fa-calendar-check', 'complaint' => 'fas fa-exclamation-circle', 'note' => 'fas fa-sticky-note', default => 'fas fa-circle' }; @endphp
{{ $act->activity_type_label }} {{ $act->activity_date?->diffForHumans() }}
@if($act->subject)
{{ $act->subject }}
@endif @if($act->description)
{{ Str::limit($act->description, 120) }}
@endif
@endforeach
@endif
{{-- Notes --}}
Dahili Notlar
{{ $customer->internal_notes ?: 'Not eklemek için tıklayın...' }}
{{-- ── TAB: DETAILS ── --}}
Kişisel Bilgiler Düzenle
Cinsiyet
{{ $customer->gender ? ['male'=>'Erkek', 'female'=>'Kadın', 'other'=>'Diğer'][$customer->gender] : '—' }}
TC / Kimlik No
{{ $customer->national_id ?: '—' }} @if($customer->national_id) @endif
Pasaport No
{{ $customer->passport_number ?: '—' }} @if($customer->passport_number) @endif
Pasaport Geçerlilik
{{ $customer->passport_expiry ? $customer->passport_expiry->format('d.m.Y') : '—' }}
Adres
{{ $customer->address ?: '—' }} @if($customer->address) @endif
Posta Kodu
{{ $customer->postal_code ?: '—' }}
@if($customer->isCorporate())
Şirket Türü
@php $ctOptions = []; foreach(\App\Models\Customer\Customer::companyTypes() as $v => $l) { $ctOptions[] = ['value' => $v, 'label' => $l]; } @endphp {{ $customer->company_type_label }}
Vergi No
{{ $customer->company_tax_number ?: '—' }} @if($customer->company_tax_number) @endif
Vergi Dairesi
{{ $customer->company_tax_office ?: '—' }}
Unvan / Pozisyon
{{ $customer->company_position ?: '—' }}
@endif
Tercih İletişim
{{ $customer->preferred_contact_method ? ucfirst($customer->preferred_contact_method) : '—' }}
Referans Kaynağı
{{ $customer->referral_source ?: '—' }}
Kayıt Tarihi
{{ $customer->created_at->format('d.m.Y H:i') }}
@if($customer->tags || $customer->interests)
@if($customer->tags)
Etiketler
@foreach($customer->tags as $tag) {{ $tag }} @endforeach
@endif @if($customer->interests)
İlgi Alanları
@foreach($customer->interests as $interest) {{ $interest }} @endforeach
@endif @endif
{{-- ── TAB: CUSTOM FIELDS ── --}}
Özel Alanlar Düzenle
@php $customer->load(['customFieldValues.fieldDefinition']); $cfValues = $customer->customFieldValues->filter(fn($cfv) => $cfv->fieldDefinition?->is_active); @endphp @if($cfValues->isEmpty())

Henüz özel alan tanımlanmamış.

@else @php $typeMap = [ 'text' => 'text', 'textarea' => 'textarea', 'email' => 'email', 'phone' => 'tel', 'date' => 'date', 'number' => 'number', 'decimal' => 'number', 'select' => 'select', 'multiselect' => 'select', 'boolean' => 'select' ]; @endphp
@foreach($cfValues as $cfv) @if($cfv->fieldDefinition)
{{ $cfv->fieldDefinition->label }}
@php $fieldType = $cfv->fieldDefinition->field_type; $options = $cfv->fieldDefinition->options ?? []; if ($fieldType === 'boolean') { $options = [['value' => '1', 'label' => 'Evet'], ['value' => '0', 'label' => 'Hayır']]; } @endphp
{{ $cfv->fieldDefinition->formatValue($cfv->value) }}
@endif @endforeach
@endif
{{-- ── TAB: PASSENGERS ── --}}
Yolcular / Bağlantılı Kişiler
@if($customer->passengers->isEmpty())

Henüz yolcu eklenmemiş.

@else
@foreach($customer->passengers as $pax) @php $pUrl = route('agency.customers.passengers.update-field', [$customer, $pax]); $relOptions = [ ['value'=>'Eş','label'=>'Eş'], ['value'=>'Çocuk','label'=>'Çocuk'], ['value'=>'Baba','label'=>'Baba'], ['value'=>'Anne','label'=>'Anne'], ['value'=>'Kardeş','label'=>'Kardeş'], ['value'=>'Arkadaş','label'=>'Arkadaş'], ['value'=>'Diğer','label'=>'Diğer'] ]; @endphp @endforeach
Ad Soyad Yakınlık TC / Pasaport Vize D. İşlemler
{{ $pax->first_name }} {{ $pax->last_name }}
{{ $pax->birth_date ? $pax->birth_date->format('d.m.Y') : 'Doğum Tarihi Ekle' }} @if($pax->birth_date) ({{ $pax->birth_date->age }} yaş) @endif
{{ $pax->relationship ?: 'İlişki?' }}
{{ $pax->national_id ?: ($pax->passport_number ? '' : 'TC No Ekle') }} @if($pax->passport_number && !$pax->national_id) {{ $pax->passport_number }} @elseif(!$pax->national_id && !$pax->passport_number) / Pasaport Ekle @endif
P.Bitiş: {{ $pax->passport_expiry ? $pax->passport_expiry->format('d.m.Y') : '—' }}
{{ $pax->visa_status ?: 'Vize Durumu?' }}
Bit: {{ $pax->visa_expiry ? $pax->visa_expiry->format('d.m.Y') : '—' }}
@csrf @method('DELETE')
@endif
{{-- ── TAB: BILLING ── --}} @if($customer->isCorporate())
Fatura Bilgileri
Fatura Adresi
{{ $customer->billing_address ?: '—' }}
Fatura İli
{{ $customer->billing_city ?: '—' }}
Fatura İlçe
{{ $customer->billing_district ?: '—' }}
Fatura E-posta
{{ $customer->billing_email ?: '—' }} @if($customer->billing_email) @endif
Fatura Vergi No
{{ $customer->billing_tax_number ?: '—' }} @if($customer->billing_tax_number) @endif
Fatura Vergi Dairesi
{{ $customer->billing_tax_office ?: '—' }}
@endif {{-- ── TAB: FINANCIAL ── --}}
Finansal Özet
Toplam Harcama
₺{{ number_format((float)($customer->total_spent ?? 0), 2, ',', '.') }}
Ortalama Rezervasyon
₺{{ number_format((float)($customer->average_booking_value ?? 0), 2, ',', '.') }}
Kredi Limiti
₺{{ number_format((float)($customer->credit_limit ?? 0), 2, ',', '.') }}
Mevcut Bakiye
₺{{ number_format((float)($customer->current_balance ?? 0), 2, ',', '.') }}
İlk Rezervasyon
{{ $customer->first_booking_date?->format('d.m.Y') ?: '—' }}
Son Rezervasyon
{{ $customer->last_booking_date?->format('d.m.Y') ?: '—' }}
Ödeme Güvenilirliği
{{ $customer->payment_reliability_label }}
İptal Sayısı
{{ $customer->cancellation_count ?? 0 }}
{{-- Loyalty progress --}} @if($customer->loyalty_points !== null)
Sadakat Puanı: {{ $customer->loyalty_points }} {{ $customer->loyalty_tier_label }}
@php $tierProgress = match($customer->loyalty_tier) { 'bronze' => [$customer->loyalty_points, 2000], 'silver' => [$customer->loyalty_points - 2000, 3000], 'gold' => [$customer->loyalty_points - 5000, 5000], 'platinum' => [1, 1], default => [0, 2000] }; $pct = min(100, ($tierProgress[0] / max(1, $tierProgress[1])) * 100); @endphp
Sonraki seviyeye: {{ max(0, $tierProgress[1] - $tierProgress[0]) }} puan kaldı
@endif
{{-- ── TAB: DOCUMENTS ── --}}
Müşteri Dökümanları
Tipler
@if($customer->customerDocuments->isEmpty())

Henüz yüklenmiş bir döküman bulunmamaktadır.

@else
@foreach($customer->customerDocuments as $doc)
{{ $doc->file_name }}
{{ $doc->type->name }}
{{ $doc->created_at->format('d.m.Y') }} • {{ $doc->human_file_size }}
@endforeach
@endif
{{-- ─── MODALS ─── --}} {{-- Blacklist Modal --}} {{-- Add Passenger Modal --}} {{-- Edit Passenger Modal --}}
@endsection @push('scripts') @endpush