@extends('admin.layouts.main') @section('title') Kua Sale Detail @endsection @section('content')
@include('admin.common.sidebar')

@{{ itemData.lead_type == 'business' ? (itemData.business_name) ? itemData.business_name[0].toUpperCase() + itemData.business_name.slice(1) : '-' : (itemData.kua_customer && itemData.kua_customer.full_name != null) ? itemData.kua_customer.full_name[0].toUpperCase() + itemData.kua_customer.full_name.slice(1) : itemData.customer_name }} - @{{ itemData.kua_product ? itemData.kua_product.product_name[0].toUpperCase() + itemData.kua_product.product_name.slice(1) : '-' }}

@{{ itemData.lead_type == 'business' ? (itemData.business_name) ? itemData.business_name[0].toUpperCase() + itemData.business_name.slice(1) : '-' : (itemData.customer_name) ? itemData.customer_name[0].toUpperCase() + itemData.customer_name.slice(1) : '-' }} - @{{ itemData.kua_product ? itemData.kua_product.product_name[0].toUpperCase() + itemData.kua_product.product_name.slice(1) : '-' }}

Lead Information of the Sale

@{{ itemData.lead_type == 'business' ? (itemData.business_name) ? itemData.business_name[0].toUpperCase() + itemData.business_name.slice(1) : '-' : (itemData.kua_customer && itemData.kua_customer.full_name) ? itemData.kua_customer.full_name[0].toUpperCase() + itemData.kua_customer.full_name.slice(1) : itemData.customer_name }}

@{{ itemData.lead_type == 'business' ? (itemData.business_name) ? itemData.business_name[0].toUpperCase() + itemData.business_name.slice(1) : '-' : (itemData.customer_name) ? itemData.customer_name[0].toUpperCase() + itemData.customer_name.slice(1) : '-' }}

@{{ itemData.kua_customer && itemData.kua_customer.phone_number ? itemData.kua_customer.phone_number : '-' }}

@{{ itemData.kua_customer ? itemData.kua_customer.customer_type[0].toUpperCase() + itemData.kua_customer.customer_type.slice(1) : '-' }}

@{{ itemData.lead_type ? itemData.lead_type[0].toUpperCase() + itemData.lead_type.slice(1) : '-' }}

@{{ itemData.kua_region ? itemData.kua_region.region_name : '-' }}

@{{ itemData.kua_agent ? itemData.kua_agent.full_name[0].toUpperCase() + itemData.kua_agent.full_name.slice(1) : '-' }}

@{{ itemData.formatted_created_at ? itemData.formatted_created_at : '-' }}

@{{ itemData.formatted_expected_closure_date ? itemData.formatted_expected_closure_date : '-' }}

Product Information

@{{ itemData.kua_company ? itemData.kua_company.name[0].toUpperCase() + itemData.kua_company.name.slice(1) : '-' }}

@{{ itemData.kua_product ? itemData.kua_product.product_name[0].toUpperCase() + itemData.kua_product.product_name.slice(1) : '-' }}

@{{ getReferenceNumber() }}

@{{ getSaleDate() }}

@{{ getStartDate() }}

@{{ getEndDate() }}

@{{ getAssetNumber() }}

@{{ itemData.sales_amount ? itemData.sales_amount : 0 }}

Customer Information

@{{ itemData.kua_customer ? itemData.kua_customer.tin : '-' }}

@{{ (itemData.kua_customer && itemData.kua_customer.national_id_type != null && itemData.kua_customer.kua_national_id_type) ? itemData.kua_customer.kua_national_id_type.title : '-' }}

@{{ (itemData.kua_customer && itemData.kua_customer.national_id_number != null) ? itemData.kua_customer.national_id_number : '-' }}

Attachments

@if($saleData->kuaCustomer->customer_type == 'individual')

@php $idDocumentUrl = ''; if($saleData->kuaCustomer->customer_type == 'individual') { $idDocumentUrl = $saleData->kuaCustomer->kuaCustomerDocuments->firstWhere('type', 'id_document'); $idDocumentUrl = $idDocumentUrl ? $idDocumentUrl->getKuaDocumentUrlAttribute() : null; } $idDocumentUrl = $idDocumentUrl ? $idDocumentUrl : 'javascript:void(0)'; @endphp {{ $saleData->kuaCustomer->customer_type == 'individual' && $saleData->kuaCustomer->id_document ? $saleData->kuaCustomer->id_document : '-' }}

@if($idDocumentUrl != 'javascript:void(0)') @endif
@endif

@php $proofOfPaymentDoc = collect($saleData->kuaSaleCompletion ?? []) ->first(function ($doc) { return isset($doc->question) && strtolower($doc->question) === 'proof of payment'; }); if ($proofOfPaymentDoc) { $proofOfPayment = $proofOfPaymentDoc->kuaSalesQuestionDocuments('type', 'question_document'); $proofOfPayment = $proofOfPayment->first() ?? null; $proofOfPayment = $proofOfPayment ? $proofOfPayment->getKuaDocumentUrlAttribute() : null; } else { $proofOfPayment = null; } $proofOfPayment = $proofOfPayment ? $proofOfPayment : 'javascript:void(0)'; @endphp {{ $proofOfPaymentDoc && $proofOfPaymentDoc->answer ? $proofOfPaymentDoc->answer : '-' }}

@if($proofOfPayment != 'javascript:void(0)') @endif

@php $productFormDoc = collect($saleData->kuaSaleCompletion ?? []) ->first(function ($doc) { return isset($doc->question) && strtolower($doc->question) === 'product form'; }); if ($productFormDoc) { $productFormUrl = $productFormDoc->kuaSalesQuestionDocuments('type', 'question_document'); $productFormUrl = $productFormUrl->first() ?? null; $productFormUrl = $productFormUrl ? $productFormUrl->getKuaDocumentUrlAttribute() : null; } else { $productFormUrl = null; } $productFormUrl = $productFormUrl ? $productFormUrl : 'javascript:void(0)'; @endphp {{ $productFormDoc && $productFormDoc->answer ? $productFormDoc->answer : '-' }}

@if($productFormUrl != 'javascript:void(0)') @endif

@php $proofOfBrandingDoc = collect($saleData->kuaSaleCompletion ?? []) ->first(function ($doc) { return isset($doc->question) && strtolower($doc->question) === 'proof of branding'; }); if ($proofOfBrandingDoc) { $proofOfBrandingUrl = $proofOfBrandingDoc->kuaSalesQuestionDocuments('type', 'question_document'); $proofOfBrandingUrl = $proofOfBrandingUrl->first() ?? null; $proofOfBrandingUrl = $proofOfBrandingUrl ? $proofOfBrandingUrl->getKuaDocumentUrlAttribute() : null; } else { $proofOfBrandingUrl = null; } $proofOfBrandingUrl = $proofOfBrandingUrl ? $proofOfBrandingUrl : 'javascript:void(0)'; @endphp {{ $proofOfBrandingDoc && $proofOfBrandingDoc->answer ? $proofOfBrandingDoc->answer : '-' }}

@if($proofOfBrandingUrl != 'javascript:void(0)') @endif
@if($saleData->kuaCustomer->customer_type == 'business')

@php $businessLicenceUrl = 'javascript:void(0)'; if($saleData->kuaCustomer->type == 'business') { $businessLicenceDoc = $saleData->kuaCustomer->kuaCustomerDocuments->firstWhere('type', 'business_licence'); $businessLicenceUrl = $businessLicenceDoc ? $businessLicenceDoc->getKuaDocumentUrlAttribute() : null; $businessLicenceUrl = $businessLicenceUrl ? $businessLicenceUrl : 'javascript:void(0)'; } @endphp {{ $saleData->kuaCustomer->business_licence ?? '-' }}

@if($businessLicenceUrl != 'javascript:void(0)') @endif
@endif

Branch Information

@{{ getBranchReceivedDate() }}

@{{ getBranchReceivedBy() }}

@{{ itemData.branch_status ? itemData.branch_status : '-' }}

@{{ getDispatchHQDate() }}

@{{ getBranchRejectionNote() }}

@if($panel == 'hq')

Headquarter Information

@{{ getDispatchHQBy() }}

@{{ getHQReceivedDate() }}

@{{ getHQReceivedBy() }}

@{{ itemData.hq_status ? itemData.hq_status : '-' }}

@{{ getHqRejectionNote() }}

@endif
@endsection @push('pageJs') @endpush