@extends('global.app') @section('title', trans('brokers.title.one')) @section('page_stylesheets') @endsection @section('extra_stylesheets') @endsection @section('profile_bar')
@if ($broker->profile_image_filename === 'default-profile.jpg')
{{ strtoupper($broker->first_name[0] . (isset($broker->last_name) ? $broker->last_name[0] : '')) }}
@else {{ $broker->first_name . ' ' . $broker->last_name }} @endif

{{ $broker->first_name . ' ' . $broker->last_name }}

@if ($broker->status) {{ trans('brokers.status.active') }} @else {{ trans('brokers.status.inactive') }} @endif
{{ trans('brokers.label.total_sales') }} @if($broker->inviteePolicies->sum('premium') > $broker->inviteePayments->sum('amount;'))

@else

@endif {{ $broker->currency_symbol }}{{ $broker->inviteePolicies->sum('premium') }}

{{ trans('brokers.label.total_commission') }} @if($broker->inviteePolicies->sum('premium') > $broker->inviteePayments->sum('amount;'))

@else

@endif {{ $broker->currency_symbol }}{{ ($broker->commission_rate / 100) * $broker->inviteePolicies->sum('premium') }}

{{ trans('brokers.label.email') }}

{{ $broker->email }}

{{ trans('brokers.label.phone') }}

{{ $broker->phone or '(---) ---- --- ---' }}

{{ trans('brokers.label.birthday') }}

{{ is_null($broker->birthday) ? '---------- --, ----' : date('jS F Y', strtotime($broker->birthday)) }}

{{ trans('brokers.label.address') }}

{{ $broker->address or '. . .' }}

@endsection @section('content') @parent
@include('global.status')

{{ trans('brokers.table.title.clients') }}

@forelse ($clients as $key => $client) @empty @endforelse
{{ trans('brokers.table.header.number') }} {{ trans('brokers.table.header.name') }} {{ trans('brokers.table.header.email') }} {{ trans('brokers.table.header.policies') }} {{ trans('brokers.table.header.due') }} {{ trans('brokers.table.header.action') }}
{{ $key + 1 }} {{ $client->first_name . ' ' . $client->last_name }} {{ $client->email }} {{ $client->policies->count() }} {{ $broker->currency_symbol }}{{ $client->policies->sum('premium') - $client->payments->sum('amount') }} {{ trans('brokers.table.data.action.view') }}
{{ $broker->first_name }}{{ trans('brokers.table.message.empty.clients') }}

{{ trans('brokers.table.title.policies') }}

@forelse ($policies as $policy) @empty @endforelse
{{ trans('brokers.table.header.ref_no') }} {{ trans('brokers.table.header.product') }} {{ trans('brokers.table.header.premium') }} {{ trans('brokers.table.header.commission') }} ({{ $broker->commission_rate }}%) {{ trans('brokers.table.header.status') }} {{ trans('brokers.table.header.action') }}
{{ $policy->ref_no }} {{ $policy->product->name }} {{ $broker->currency_symbol }}{{ $policy->premium + 0 }} {{ $broker->currency_symbol }}{{ $policy->premium * $broker->commission_rate / 100 }} @if ($policy->premium <= $policy->paid && $policy->paid > 0)
{{ trans('brokers.table.data.status.paid') }}
@elseif ($policy->premium > $policy->paid && $policy->paid > 0)
{{ trans('brokers.table.data.status.partial') }}
@elseif ($policy->premium == $policy->paid && $policy->paid === 0)
{{ trans('brokers.table.data.status.free') }}
@else ($policy->premium > 0 && $policy->paid === 0)
{{ trans('brokers.table.data.status.unpaid') }}
@endif
{{ trans('brokers.table.data.action.view') }}
{{ $broker->first_name }}{{ trans('brokers.table.message.empty.policies') }}
{{ trans('brokers.table.header.total') }} {{ $broker->currency_symbol }}{{ $policies->sum('premium') }} {{ $broker->currency_symbol }}{{ $policies->sum('premium') * $broker->commission_rate / 100 }}
@endsection @section('modals') @yield('broker_modals') @endsection @section('page_scripts') @endsection