{!! $print['head'] !!} @foreach ($data as $item) @php $maintenanceStatus = $item->getLog->sortByDesc('id')->first()->status ?? null; @endphp @endforeach
Item Total Type Last Maintenance Date Next Maintenance Date
{{ $item->getProduct->name_eng ?? '' }} @if ($item->getLog->whereIn('status', [2, 3])->count() > 0) {{ $item->getLog->whereIn('status', [2, 3])->count() }} @endif {{ $item->type }} @if (isset($item->getLog->where('status', 3)->sortByDesc('id')->first()->date)) {{ getDMY($item->getLog->where('status', 3)->sortByDesc('id')->first()->date) }} @endif @if ($maintenanceStatus == 1) @if (isset($item->getLog->sortByDesc('id')->first()->date)) {{ getDMY($item->getLog->sortByDesc('id')->first()->date) }} @endif @endif
{!! $print['foot'] !!}