@php
$sites = $merchandising->sites;
$photosBySite = [];
$validatedBySite = [];
$photoCount = 0;
$validatedCount = 0;
foreach ($sites as $site) {
$photosBySite[$site->sit_id] = $merchandising->photos
->where('sit_id', $site->sit_id)
->count();
$validatedBySite[$site->sit_id] = $merchandising->photos
->where('sit_id', $site->sit_id)
->where('merSta_id', 3)
->count();
$photoCount += $photosBySite[$site->sit_id];
$validatedCount += $validatedBySite[$site->sit_id];
}
@endphp
|
{!! $merchandising->mer_title !!}
{!! $merchandising->mer_description !!}
|
{{ __("Du") }} {!! date_en_fr($merchandising->mer_startDate) !!}
{{ __("au") }} {!! date_en_fr($merchandising->mer_endDate) !!}
|
@foreach($merchandising->sites as $site)
{{$site->sit_name}}
@if(($validatedBySite[$site->sit_id] ?? 0) > 0)
{{ __('Validé') }}
@elseif(($photosBySite[$site->sit_id] ?? 0) > 0)
{{ __('En attente') }}
@elseif(now() > $merchandising->mer_endDate)
{{ __('En retard') }}
@else
{{ __('À faire') }}
@endif
{{ $photosBySite[$site->sit_id] ?? 0 }} {{ __('photo(s)') }}
@if(($validatedBySite[$site->sit_id] ?? 0) > 0)
{{ $validatedBySite[$site->sit_id] }} {{ __('validée(s)') }}
@endif
@if(!$loop->last) @endif
@endforeach
|
{{ $photoCount }} {{ __('photo(s)') }}
@if($validatedCount > 0)
{{ $validatedCount }} {{ __('validée(s)') }}
@endif
|
|
@endforeach