{{-- Müşteri kartı → Dökümanlar sekmesi. Sürükle-bırak yükleme + klasik tablo düzeninde belge listesi. Operasyonda üretilen yolcu belgeleri ayrı tabloda listelenir. Beklenen: $customer, $documentTypes --}} @include('agency.partials.qv-table') @php $docs = $customer->customerDocuments->sortByDesc('created_at'); $today = \Carbon\Carbon::today(); $fmtSize = function ($bytes) { $bytes = (int) $bytes; if ($bytes <= 0) return '—'; $u = ['B', 'KB', 'MB', 'GB']; $i = (int) floor(log($bytes, 1024)); $i = min($i, count($u) - 1); return round($bytes / (1024 ** $i), $i ? 1 : 0) . ' ' . $u[$i]; }; $iconFor = function ($mime, $name) { $ext = strtolower(pathinfo((string) $name, PATHINFO_EXTENSION)); return match (true) { str_contains((string) $mime, 'pdf') || $ext === 'pdf' => ['fa-file-pdf', '#dc2626'], str_contains((string) $mime, 'image') || in_array($ext, ['jpg','jpeg','png','webp','gif']) => ['fa-file-image', '#0ea5e9'], in_array($ext, ['xls','xlsx','csv']) => ['fa-file-excel', '#16a34a'], in_array($ext, ['doc','docx']) => ['fa-file-word', '#2563eb'], in_array($ext, ['zip','rar','7z']) => ['fa-file-zipper', '#a855f7'], default => ['fa-file-lines', '#64748b'], }; }; @endphp
{{-- ══ YÜKLEME ══ --}}
@csrf
Dosyayı buraya sürükleyin ya da
{{-- ══ OPERASYONDA ÜRETİLEN BELGELER ══ --}} {{-- Kaynak passenger_documents; kopyalanmaz, operasyonda düzenlenince burası da güncellenir. --}} @php $opDocs = $customer->passengerDocuments->sortByDesc('created_at'); @endphp @if($opDocs->count())
Operasyondan üretilenler ({{ $opDocs->count() }})
@foreach($opDocs as $od) @php // departure_type FQCN saklar (ör. Tour\TourDate) → operasyon URL tip anahtarına çevrilir $odOpKey = $od->departure_type ? (\App\Services\Operation\OperationService::TYPE_META[$od->departure_type]['key'] ?? null) : null; @endphp @endforeach
Belge Tür Yolcu Satış Tarih Durum
{{ $od->title }} {{ $od->kind_label }} {{ $od->passenger?->full_name ?: '—' }} @if($od->sale) #{{ $od->sale->sale_code }} @endif @if($odOpKey && $od->departure_id) @endif @if(!$od->sale && !($odOpKey && $od->departure_id))@endif {{ $od->created_at->format('d.m.Y') }} {{ $od->status_label }}
Bu belgeler operasyon yolcu listesinden üretildi. Düzenleme ilgili kalkışın operasyon kartından yapılır.
@endif {{-- ══ YÜKLENEN BELGELER ══ --}}
{{ $docs->count() }} yüklenen belge @if($docs->count()) · {{ $fmtSize($docs->sum('file_size')) }} toplam @endif
@forelse($docs as $doc) @php [$icon, $color] = $iconFor($doc->mime_type, $doc->file_name); $exp = $doc->expiry_date ? \Carbon\Carbon::parse($doc->expiry_date) : null; $expState = !$exp ? null : ($exp->lt($today) ? 'expired' : ($exp->lte($today->copy()->addMonth()) ? 'soon' : null)); $fileUrl = asset('storage/' . $doc->file_path); @endphp @empty @endforelse
Dosya Tip Boyut Yüklendi Geçerlilik Not
{{ $doc->file_name }} {{ $doc->type?->name ?: 'Diğer' }} {{ $fmtSize($doc->file_size) }} {{ $doc->created_at->format('d.m.Y') }} @if($exp) @if($expState)@endif {{ $exp->format('d.m.Y') }} @else @endif {{ $doc->notes ?: '—' }}
Henüz belge yüklenmemiş Pasaport, kimlik, vize, sözleşme gibi belgeleri buraya yükleyin.