{{-- FATURA MUHATABI — künye kartının sekmeli alt bölümü. ledger-card'a 'append' ile takılır; üst kapsamdaki $customer ve $billingProfiles değişkenlerini devralır. Muhataplar alt alta uzayıp künyeyi şişirmesin diye yalnızca seçili olanın alanları görünür. Her profil KENDİ kaydına yazar — bağlı şirket satırları o şirketin kartını günceller — bu yüzden satırlar ledger-row'a kendi 'url'ini verir; panelin data-url'i ezilir. --}} @php use Illuminate\Support\Str; @endphp
Fatura Muhatabı
@if(count($billingProfiles) > 1)
@foreach($billingProfiles as $i => $bp) @endforeach
@endif @foreach($billingProfiles as $i => $bp) @php $b = $bp['billing']; $isCompanyProfile = $bp['type'] === 'company'; $target = $isCompanyProfile && $bp['company_id'] ? \App\Models\Customer\Customer::find($bp['company_id']) : $customer; $targetUrl = $target ? route('agency.customers.update-field', $target) : null; // Şahıs profilinde vergi bilgisi yoktur; T.C. kimlik numarası kullanılır. $bpRows = $isCompanyProfile ? [ ['label' => 'Unvan', 'field' => 'company_name', 'value' => $target?->company_name ?: $b['company_name']], ['label' => 'Vergi No', 'field' => 'billing_tax_number', 'value' => $b['tax_number'], 'mono' => true, 'ph' => '10 hane'], ['label' => 'Vergi Dairesi', 'field' => 'billing_tax_office', 'value' => $b['tax_office']], ['label' => 'Adres', 'field' => 'billing_address', 'value' => $b['address'], 'type' => 'textarea'], ['label' => 'E-posta', 'field' => 'billing_email', 'value' => $b['email'], 'type' => 'email'], ['label' => 'Telefon', 'field' => 'phone', 'value' => $b['phone'], 'mono' => true], ] : [ ['label' => 'Unvan', 'field' => null, 'value' => $b['name']], ['label' => 'T.C. Kimlik No', 'field' => 'national_id', 'value' => $b['tax_number'], 'mono' => true, 'ph' => '11 hane'], ['label' => 'Adres', 'field' => 'billing_address', 'value' => $b['address'], 'type' => 'textarea'], ['label' => 'E-posta', 'field' => 'billing_email', 'value' => $b['email'], 'type' => 'email'], ['label' => 'Telefon', 'field' => 'phone', 'value' => $b['phone'], 'mono' => true], ]; $block = trim(implode("\n", array_filter(array_map( fn ($r) => filled($r['value']) ? $r['label'] . ': ' . $r['value'] : null, $bpRows )))); @endphp
@if(! $bp['complete'])
{{ $isCompanyProfile ? 'Vergi numarası girilmeden bu unvana resmi fatura kesilemez.' : 'T.C. kimlik numarası girilmemiş.' }}
@endif @foreach($bpRows as $bpRow) @include('components.quick-view.ledger-row', [ 'r' => $bpRow + ['url' => $targetUrl, 'text' => trim((string) $bpRow['value'])], ]) @endforeach
{{ $bp['sub'] }}
@endforeach