@csrf @method('PUT') @if($lead->opportunities->count() > 0)

{{ $lead->opportunities?->count() }}

Opportunity

{{ number_format($lead->opportunities?->sum('premium')) }}

Monthly Premium

{{ number_format($lead->opportunities?->sum('enrollment_fee')) }}

Enrolment Fee

{{ number_format($lead->opportunities?->sum('admin_fee')) }}

Admin Fee

{{ number_format($lead->opportunities?->sum('premium') + $lead->opportunities?->sum('admin_fee')) }}

Monthly Fee

{{ number_format($lead->opportunities?->sum('premium') + $lead->opportunities?->sum('enrollment_fee') + $lead->opportunities?->sum('admin_fee'), 2) }}

Initial Fee

{{ number_format($lead->opportunityAnnualFee, 2) }}

Annualized Premium
@endif
@forelse ($lead->opportunities as $key => $opportunity)
@if ($loop->first) @else @if(!isset($opportunity->policy_id)) @endif @endif

Opportunity : {{ $opportunity->opportunity_code }}

@if ($opportunity->policy_id) Policy: {{ $opportunity->policy?->code }} @endif
@if (!isset($opportunity->policy_id)) @endif

member_count) value="{{ $opportunity->member_count }}" @endif>
previous_carrier) value="{{ $opportunity->previous_carrier }}" @endif>
previous_plan) value="{{ $opportunity->previous_plan }}" @endif>
previous_agent) value="{{ $opportunity->previous_agent }}" @endif>
previous_agent_npn) value="{{ $opportunity->previous_agent_npn }}" @endif>

@forelse ($opportunity->beneficiaries as $benificiaryKey => $benificiary)
@if($loop->first) @else @endif

Benificiary name: {{ $benificiary->beneficiary_name }}

@empty
@endforelse

Created at: {{ $opportunity->created_at ? $opportunity->created_at->format('Y-m-d H:i:s') : '' }}

Created by: {{ $opportunity->created_by ? $opportunity->createdBy->name : '' }}

Last modified: {{ $opportunity->updated_at ? $opportunity->updated_at->format('Y-m-d H:i:s') : '' }}

Last modified by: {{ $opportunity->updated_by ? $opportunity->updatedBy->name : '' }}

@include('modules.leads.includes.upload-document', [ 'linkedEntity' => 'opportunity', 'linkedEntityId' => $opportunity->id, 'key' => $key . '-' . random_int(1000, 9999), 'leadId' => $lead->id, 'documentTypes' => $documentTypes ]) @php $documents = $lead->attachments->where('linked_entity', 'opportunity')->where('linked_entity_id', $opportunity->id); @endphp
@if (count($documents) > 0) @include('modules.leads.includes.document-list', [ 'documents' => $documents ]) @endif
@empty

@endforelse