{{-- Müşteri kartı → Yolcular sekmesi. Yolcular klasik tablo düzeninde listelenir: her satır bir yolcu, hücrelerin sağındaki simgeyle değer kopyalanır, satır sonundaki simgeyle yolcunun tüm bilgileri tek seferde alınır. Satırın "Detay" düğmesi altındaki gizli satırı açar; oradaki alanlar Özet sekmesindeki künye paneliyle (.pfx) aynı "defter satırı" dilinde çalışır — yerinde düzenleme ve kaydetme mantığı aynı bileşenden gelir. Beklenen: $customer Kaydetme: PATCH agency.customers.passengers.update-field {field, value} --}} @include('agency.partials.qv-table') @php $today = \Carbon\Carbon::today(); $genderOpts = [['value' => '', 'label' => '—'], ['value' => 'male', 'label' => 'Erkek'], ['value' => 'female', 'label' => 'Kadın'], ['value' => 'other', 'label' => 'Diğer']]; $genderLabel = fn ($v) => collect($genderOpts)->firstWhere('value', (string) $v)['label'] ?? ''; $dmy = fn ($d) => $d ? \Carbon\Carbon::parse($d)->format('d.m.Y') : ''; $iso = fn ($d) => $d ? \Carbon\Carbon::parse($d)->format('Y-m-d') : ''; /** Yolcu satırı: [etiket, alan, ham değer, görünen metin, seçenekler] */ $prow = fn (string $label, ?string $field, $value, ?string $text = null, array $o = []) => [ 'label' => $label, 'field' => $field, 'type' => $o['type'] ?? 'text', 'value' => $value === null ? '' : (string) $value, 'text' => $text === null ? (string) ($value ?? '') : $text, 'options' => $o['options'] ?? null, 'mono' => $o['mono'] ?? false, 'ph' => $o['ph'] ?? null, 'state' => $o['state'] ?? null, ]; @endphp
{{-- ══ ÜST ÇUBUK ══ --}}
{{ $customer->passengers->count() }} yolcu @php $missingId = $customer->passengers->filter(fn($p) => !$p->national_id && !$p->passport_number)->count(); $expiring = $customer->passengers->filter(function ($p) use ($today) { $d = $p->passport_expiry ? \Carbon\Carbon::parse($p->passport_expiry) : null; return $d && $d->lte($today->copy()->addMonths(6)); })->count(); @endphp @if($missingId) {{ $missingId }} kimliksiz @endif @if($expiring) {{ $expiring }} pasaport uyarısı @endif
@if($customer->passengers->count() > 3) @endif
{{-- ══ YENİ YOLCU FORMU ══ --}} {{-- ══ YOLCU TABLOSU ══ --}}
@forelse($customer->passengers as $p) @php $url = route('agency.customers.passengers.update-field', [$customer, $p]); $birth = $p->birth_date ? \Carbon\Carbon::parse($p->birth_date) : null; // Carbon 3'te diffInYears ondalıklı döner (17.55 gibi) $age = $birth ? (int) $birth->diffInYears($today) : null; $ppExpiry = $p->passport_expiry ? \Carbon\Carbon::parse($p->passport_expiry) : null; $ppState = !$ppExpiry ? null : ($ppExpiry->lt($today) ? 'expired' : ($ppExpiry->lte($today->copy()->addMonths(6)) ? 'soon' : null)); $vsExpiry = $p->visa_expiry ? \Carbon\Carbon::parse($p->visa_expiry) : null; $vsState = !$vsExpiry ? null : ($vsExpiry->lt($today) ? 'expired' : ($vsExpiry->lte($today->copy()->addMonth()) ? 'soon' : null)); $pSections = [ ['title' => 'Kimlik', 'icon' => 'fa-id-badge', 'rows' => [ $prow('Ad', 'first_name', $p->first_name), $prow('Soyad', 'last_name', $p->last_name), $prow('T.C. Kimlik No', 'national_id', $p->national_id, null, ['mono' => true, 'ph' => '11 hane']), $prow('Doğum Tarihi', 'birth_date', $iso($p->birth_date), $dmy($p->birth_date), ['type' => 'date', 'mono' => true]), $prow('Cinsiyet', 'gender', $p->gender, $genderLabel($p->gender), ['type' => 'select', 'options' => $genderOpts]), $prow('Yakınlık', 'relationship', $p->relationship, null, ['ph' => 'Eş, çocuk, arkadaş…']), ]], ['title' => 'Seyahat Belgeleri', 'icon' => 'fa-passport', 'rows' => [ $prow('Pasaport No', 'passport_number', $p->passport_number, null, ['mono' => true]), $prow('Pasaport Geçerlilik', 'passport_expiry', $iso($p->passport_expiry), $dmy($p->passport_expiry), ['type' => 'date', 'mono' => true, 'state' => $ppState]), $prow('Vize Durumu', 'visa_status', $p->visa_status, null, ['ph' => 'Örn: Schengen']), $prow('Vize Bitiş', 'visa_expiry', $iso($p->visa_expiry), $dmy($p->visa_expiry), ['type' => 'date', 'mono' => true, 'state' => $vsState]), ]], ['title' => 'İletişim', 'icon' => 'fa-address-book', 'rows' => [ $prow('Telefon', 'phone', $p->phone, null, ['mono' => true, 'ph' => '05xx xxx xx xx']), $prow('E-posta', 'email', $p->email, null, ['type' => 'email', 'ph' => 'ornek@eposta.com']), ]], ]; $pEmpty = collect($pSections)->flatMap(fn ($s) => $s['rows'])->filter(fn ($r) => blank($r['text']))->count(); // Satır sonundaki "tümünü kopyala": dolu alanlar "Etiket: değer" olarak $copyAll = collect($pSections) ->flatMap(fn ($s) => $s['rows']) ->filter(fn ($r) => filled($r['text'])) ->map(fn ($r) => $r['label'] . ': ' . $r['text']) ->implode("\n"); @endphp {{-- Detay satırı: alanlar defter dilinde, yerinde düzenlenir. show-empty açık başlar; başlıktaki düğme boşları gizler. --}} @empty @endforelse
Yolcu Yakınlık Doğum Cinsiyet T.C. Kimlik Pasaport Geçerlilik Telefon E-posta
{{ $p->initials }} {{ $p->full_name ?: 'İsimsiz yolcu' }} @if($ppState === 'expired') @elseif($ppState === 'soon')@endif @if($vsState === 'expired')vize@endif {{ $p->relationship ?: '—' }} @if($birth){{ $dmy($p->birth_date) }} ({{ $age }})@else@endif {{ $genderLabel($p->gender) ?: '—' }} @if($p->national_id){{ $p->national_id }}@else@endif @if($p->passport_number){{ $p->passport_number }}@else@endif @if($ppExpiry) {{ $ppExpiry->format('d.m.Y') }} @else @endif @if($p->phone){{ $p->phone }}@else@endif @if($p->email){{ $p->email }}@else@endif
Henüz yolcu kaydı yok Bu müşteriye bağlı kişileri ekleyin — satışlarda ve operasyon yolcu listesinde hazır gelir.
Bir değerin üzerine gelip sağdaki simgeyle kopyalayın. Detay düğmesiyle açılan alanlar yerinde düzenlenir.