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

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

@if ($client->status) {{ trans('clients.status.active') }} @else {{ trans('clients.status.inactive') }} @endif
{{ trans('clients.label.email') }}

{{ $client->email }}

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

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

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

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

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

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

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

{{ trans('clients.label.details') }}

{{ trans('clients.label.name') }}

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

{{ trans('clients.label.policies') }}

{{ $client->policies->count() }}

@if ($client->policies->sum('premium') <= $client->policies->sum('paid') && $client->policies->sum('paid') > 0) {{ trans('policies.label.paid_in_full') }} @elseif ($client->policies->sum('due') > 0 && $client->policies->where('statusClass', 'warning')->count() > ($client->policies->count() / 3)) {{ trans('policies.label.due') }} - {{ $client->currency_symbol }}{{ $client->policies->sum('due') }} @elseif ($client->policies->sum('due') > 0 && $client->policies->where('statusClass', 'negative')->count() > ($client->policies->count() / 3)) {{ trans('policies.label.due') }} - {{ $client->currency_symbol }}{{ $client->policies->sum('due') }} @endif
{{ trans('clients.label.email') }}

{{ $client->email }}

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

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

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

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

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

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

@foreach ($client->customFields->all() as $custom_field)
{{ $custom_field->label }}

{{ is_object(json_decode($custom_field->value)) ? json_decode($custom_field->value)->choice : $custom_field->value }}

@endforeach

{{ trans('clients.table.title.notes', array( 'name' => $client->first_name )) }}

@forelse ($client->notes as $note) @empty @endforelse
{{ trans('clients.table.header.from') }} {{ trans('clients.table.header.message') }} {{ trans('clients.table.header.date') }} {{ trans('clients.table.header.actions') }}
{{ $note->writer->id === $user->id ? 'You': $note->writer->first_name }} {{ $note->message }} {{ date('F d, Y', strtotime($note->created_at)) }} {{ trans('clients.table.data.action.read') }}
{{ csrf_field() }} {{ method_field('DELETE') }}
{{ trans('clients.table.message.empty.notes', array( 'name' => $client->first_name )) }}

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

@forelse($client->attachments as $attachment) @empty @endforelse
{{ trans('clients.table.header.file') }} {{ trans('clients.table.header.date') }} {{ trans('clients.table.header.uploader') }} {{ trans('clients.table.header.actions') }}
{{ $attachment->name }} {{ date('F d, Y', strtotime($attachment->created_at)) }} {{ $attachment->uploader->first_name . ' ' . $attachment->uploader->last_name }} {{ trans('clients.table.data.action.view') }}
{{ csrf_field() }} {{ method_field('DELETE') }}
{{ trans('clients.table.message.empty.attachments', array( 'name' => $client->first_name )) }}

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

@forelse($policies as $policy) @empty @endforelse
{{ trans('clients.table.header.ref_no') }} {{ trans('clients.table.header.product') }} {{ trans('clients.table.header.insurer') }} {{ trans('clients.table.header.premium') }} {{ trans('clients.table.header.due') }} {{ trans('clients.table.header.status') }} {{ trans('clients.table.header.action') }}
{{ $policy->ref_no }} {{ $policy->product->name }} {{ $policy->product->insurer }} {{ $client->currency_symbol}}{{ $policy->premium + 0 }} {{ $client->currency_symbol}}{{ $policy->due }} @if ($policy->premium <= $policy->paid && $policy->paid > 0)
{{ trans('clients.table.data.status.paid') }}
@elseif ($policy->premium > $policy->paid && $policy->paid > 0)
{{ trans('clients.table.data.status.partial') }}
@elseif ($policy->premium == $policy->paid && $policy->paid === 0)
{{ trans('clients.table.data.status.free') }}
@else ($policy->premium > $policy->paid && $policy->paid === 0)
{{ trans('clients.table.data.status.unpaid') }}
@endif
{{ trans('clients.table.data.action.view') }}
{{ trans('clients.table.message.empty.policies', array( 'name' => $client->first_name )) }}
{{ trans('clients.table.header.total') }} {{ $client->currency_symbol }}{{ $policies->sum('premium') }} {{ $client->currency_symbol }}{{ $policies->sum('due') }}

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

@forelse($client->payments as $key => $payment) @empty @endforelse
{{ trans('clients.table.header.number') }} {{ trans('clients.table.header.policy') }} {{ trans('clients.table.header.amount') }} {{ trans('clients.table.header.date') }} {{ trans('clients.table.header.method') }}
{{ $key + 1 }} {{ $payment->policy->ref_no }} {{ $client->currency_symbol }}{{ $payment->amount + 0 }} {{ date('F d, Y', strtotime($payment->date)) }} {{ array( 'card' => trans('clients.table.data.method.card'), 'cash' => trans('clients.table.data.method.cash'), 'paypal' => trans('clients.table.data.method.paypal') )[$payment->method] }}
{{ trans('clients.table.message.empty.payments', array( 'name' => $client->first_name )) }}
@endsection @section('modals') @foreach($client->notes as $note) @endforeach @yield('client_modals') @endsection @section('page_scripts') @endsection