@extends('layouts.main.main') @section('content')
@can('éditer une fiche client') Modifier @endcan @can('créer un client') Nouveau client @endcan

{{ $customer->name }}

@if($customer->address) {!! nl2br($customer->address) !!}
@endif @if($customer->zip_code || $customer->city) {{ trim($customer->zip_code.' '.$customer->city) }}
@endif @if($customer->country_id) {{ $customer->country->name_fr }} @endif

Téléphone : {!! ($customer->phone) ? ''.$customer->phone.'' : '-' !!}
E-mail : {!! ($customer->email) ? ''.$customer->email.'' : '-' !!}

@can('créer un projet') @endcan Projets

@if($customer->projects->count() > 0)
@if($customer->projects->where('active',1)->count() > 0)
@foreach ($customer->projects->where('active','1') as $project) @endforeach
Référence Date Lieu
{{ $project->projectref }} {{ date('d/m/Y', strtotime($project->event_date_n_time)) }} {{ $project->place->name }}
@else Ce client n'a aucun projet actif @endif
@if($customer->projects->where('active',0)->count() > 0)
@foreach ($customer->projects->where('active','0') as $project) @endforeach
Référence Date Lieu
{{ $project->projectref }} {{ date('d/m/Y', strtotime($project->event_date_n_time)) }} {{ $project->place->name }}
@else Ce client n'a aucun projet archivé @endif
@else Aucun projet n'est enregistré pour ce client pour l'instant. @endif

Gestionnaire(s) de projets

@if($customer->contacts->where('kind_of_contact','PRJ')->count() > 0)
@if($customer->contacts->where('active',1)->where('kind_of_contact','PRJ')->count() > 0)
@foreach($customer->contacts->where('active',1)->where('kind_of_contact','PRJ') as $contact) @endforeach
{{ $contact->full_name }} {{ ($contact->occupation) ? $contact->occupation : '-' }} {!! ($contact->phone) ? '' : '-' !!} {!! ($contact->email) ? '' : '-' !!}
@else Ce client n'a aucun gestionnaire de projet actif @endif
@if($customer->contacts->where('active',0)->where('kind_of_contact','PRJ')->count() > 0)
@foreach($customer->contacts->where('active',0)->where('kind_of_contact','PRJ') as $contact) @endforeach
{{ $contact->full_name }} {{ ($contact->occupation) ? $contact->occupation : '-' }} {!! ($contact->phone) ? '' : '-' !!} {!! ($contact->email) ? '' : '-' !!}
@else Ce client n'a aucun gestionnaire de projet archivé @endif
@else Aucun gestionnaire de projet n'est enregistré pour ce client. @endif

Comptable(s) de projets

@if($customer->contacts->where('kind_of_contact','CPT')->count() > 0)
@if($customer->contacts->where('active',1)->where('kind_of_contact','CPT')->count() > 0)
@foreach($customer->contacts->where('active',1)->where('kind_of_contact','CPT') as $contact) @endforeach
{{ $contact->full_name }} {{ ($contact->occupation) ? $contact->occupation : '-' }} {!! ($contact->phone) ? '' : '-' !!} {!! ($contact->email) ? '' : '-' !!}
@else Ce client n'a aucun comptable actif @endif
@if($customer->contacts->where('active',0)->where('kind_of_contact','CPT')->count() > 0)
@foreach($customer->contacts->where('active',0)->where('kind_of_contact','CPT') as $contact) @endforeach
{{ $contact->full_name }} {{ ($contact->occupation) ? $contact->occupation : '-' }} {!! ($contact->phone) ? '' : '-' !!} {!! ($contact->email) ? '' : '-' !!}
@else Ce client n'a aucun comptable archivé @endif
@else Aucun gestionnaire de projet n'est enregistré pour ce client. @endif
@endsection