@extends('admin.layouts.main') @section('title') Kua Customer Detail @endsection @section('content')
@include("admin.common.sidebar")
{{-- @dd($clientUserDetail) --}}

{{ $clientUserDetail->full_name ?? $clientUserDetail->registered_company_name ?? '-' }} - {{ ucfirst($clientUserDetail->customer_type ?? '-') }}

{{-- Common fields --}}
{{-- actions if needed --}}

{{ @trans('kua_customer.details') }}

{{ $clientUserDetail->customer_type ? ucfirst($clientUserDetail->customer_type) : '-' }}

{{ $clientUserDetail->full_name ?? $clientUserDetail->registered_company_name }}

@if($clientUserDetail->customer_type === 'individual')

{{ $clientUserDetail->email ?: '-' }}

{{ $clientUserDetail->phone_number ?: '-' }}

@endif {{--

{{ optional($clientUserDetail->kuaClient)->name ? ucfirst($clientUserDetail->kuaClient->name) : '-' }}

{{ optional($clientUserDetail->kuaProduct)->product_name ? ucfirst($clientUserDetail->kuaProduct->product_name) : '-' }}

--}}
{{-- Type-specific sections --}} @if($clientUserDetail->customer_type === 'individual')

{{ @trans('kua_customer.personal_details') }}

{{ $clientUserDetail->tin ?: '-' }}

{{ optional( $clientUserDetail->kuaNationalIdType)->title ?: '-' }}

{{ $clientUserDetail->national_id_number ?: '-' }}

{{ $clientUserDetail->gender ?: '-' }}

{{ $clientUserDetail->age_group ?: '-' }}

{{ $clientUserDetail->occupation ?: '-' }}

{{ $clientUserDetail->physical_address ?: '-' }}

{{ $clientUserDetail->geolocation ?: '-' }}

@php $idDocumentRow = optional( $clientUserDetail->kuaCustomerDocuments)->firstWhere('type', 'id_document'); $idDocumentUrl = $idDocumentRow ? $idDocumentRow->getKuaDocumentUrlAttribute() : null; $idDocumentUrl = $idDocumentUrl ?: ( $clientUserDetail->id_document ? asset('storage/'. $clientUserDetail->id_document) : null); @endphp @if($idDocumentUrl) file_download @else

-

@endif
@elseif($clientUserDetail->customer_type === 'business')

{{ @trans('kua_customer.business_details') }}

{{ $clientUserDetail->tin ?: '-' }}

{{ $clientUserDetail->registered_company_name ?: '-' }}

{{ $clientUserDetail->trading_name ?: '-' }}

{{ $clientUserDetail->business_registration_number ?: '-' }}

{{ optional( $clientUserDetail->kuaBusinessType)->title ?: '-' }}

{{ optional( $clientUserDetail->kuaIndustry)->name ?: '-' }}

{{ optional( $clientUserDetail->kuaBusinessSegment)->title ?: '-' }}

{{ $clientUserDetail->number_of_employees ?: '-' }}

{{ $clientUserDetail->monthly_revenue ?: '-' }}

{{ $clientUserDetail->business_age ?: '-' }}

{{ $clientUserDetail->part_of_group ? 'Yes' : 'No' }}

{{ $clientUserDetail->multiple_branches ? 'Yes' : 'No' }}

{{ $clientUserDetail->number_of_outlets ?: '-' }}

{{ optional( $clientUserDetail->kuaRegion)->region_name ?: '-' }}

{{ $clientUserDetail->registered_address ?: '-' }}

{{ $clientUserDetail->business_geolocation ?: '-' }}

{{-- Documents --}} @php $doc = function ($type, $fallback) use ( $clientUserDetail) { $row = optional( $clientUserDetail->kuaCustomerDocuments)->firstWhere('type', $type); $url = $row ? $row->getKuaDocumentUrlAttribute() : null; if (!$url && !empty($fallback)) { $url = asset('storage/' . $fallback); } return $url; }; @endphp
@if($url = $doc('certificate_incorporation', $clientUserDetail->certificate_incorporation)) file_download @else

-

@endif
@if($url = $doc('business_license', $clientUserDetail->business_license)) file_download @else

-

@endif
@if($url = $doc('company_profile', $clientUserDetail->company_profile)) file_download @else

-

@endif
@endif {{-- Key Contacts (business only) --}} @if(optional( $clientUserDetail->kuaCustomerContact)->count() > 0)

{{ @trans('kua_customer.business_key_contact_detail') }}

@foreach( $clientUserDetail->kuaCustomerContact as $contact)

{{ $contact->full_name ?: '-' }}

{{ $contact->position ?: '-' }}

{{ $contact->phone_number ?: '-' }}

{{ $contact->email ?: '-' }}

{{ $contact->is_primary ? 'Yes' : 'No' }}

@php $row = optional($contact->kuaCustomerContactDocuments)->firstWhere('type', 'id_document'); $url = $row ? $row->getKuaDocumentUrlAttribute() : null; $url = $url ?: ($contact->id_document ? asset('storage/'.$contact->id_document) : null); @endphp @if($url) file_download @else

-

@endif
@endforeach
@endif
@endsection