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

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

@if ($staff->status) {{ trans('staff.status.active') }} @else {{ trans('staff.status.inactive') }} @endif
{{ trans('staff.label.total_sales') }}

{{ $staff->currency_symbol }}{{ $staff->invitees->reduce(function($count, $invitee) { return $invitee->payments->sum('amount') + $count; }, 0) }}

{{ trans('staff.label.total_commission') }}

{{ $staff->currency_symbol }}{{ ($staff->commisiion_rate / 100) * $staff->inviteePolicies->sum('premium') }}

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

{{ $staff->email }}

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

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

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

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

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

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

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

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

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

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

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