@php if( request()->get('filter') && "yesterday" == request()->get('filter') ) : $d = \Carbon\Carbon::yesterday(); $dayOfWeek = \Carbon\Carbon::yesterday()->dayOfWeek; else: $d = \Carbon\Carbon::today(); $dayOfWeek = \Carbon\Carbon::today()->dayOfWeek; endif; @endphp @foreach( weekDays($dayOfWeek, true) as $day ) @endforeach @php $grandTotal = 0; // echo '
'; print_r( $staffs ); echo '
'; @endphp @foreach( $staffs as $staff ) @php $rowTotal = 0; @endphp @foreach( weekDays($dayOfWeek, true) as $key => $day ) @php $k = (int) $d->addDays( $key )->format('Ymd'); @endphp @if( array_key_exists( $k, $staff->clock ) ) @php $clock_time = $staff->clock[$k]; @endphp @if( !empty( $clock_time ) && !empty($clock_time['total_time']) ) @else @endif @php $rowTotal += $clock_time['time']; @endphp @else @endif @endforeach @php if( $rowTotal > 60 ) { $grandTotal += $rowTotal; } @endphp @endforeach
{{ ucfirst($day) }}Total
{{ $staff->getName() ?? 'Guest' }}
{{ $d->addDays($key)->format('d') }}
{{ $clock_time['total_time'] ?? 'Inaccurate' }}
@if( in_array($k, $staff->shifts) )
{{ 'System generated' }}
@endif
{{ $d->copy()->addDays($key)->format('M d') }}
{{ 'Inaccurate' }}
@if( in_array($k, $staff->shifts) )
{{ 'System generated' }}
@endif
{{ $d->copy()->addDays($key)->format('M d') }}
{{ 'Inaccurate' }}
@if( in_array($k, $staff->shifts) )
{{ 'System generated' }}
@endif
@php $partsWeNeed = ( $rowTotal / 3600 ) > 1 ? 2 : 1; @endphp {{ $rowTotal > 60 ? \Carbon\CarbonInterval::seconds($rowTotal)->cascade() ->forHumans(['short' => true, 'join' => true, 'parts' => $partsWeNeed ]) : 0 }}
Grand Total @php $partsWeNeed = ( $grandTotal / 3600 ) > 1 ? 2 : 1; @endphp {{ $grandTotal > 60 ? \Carbon\CarbonInterval::seconds($grandTotal)->cascade() ->forHumans(['short' => true, 'join' => true, 'parts' => $partsWeNeed ]) : 0 }}