@if(is_object($staffChecklists) && count($staffChecklists)>0) @php($colorPool= ['#e0d6eb','#dbefdc','#ccd6e3','#fff3cd','#fff3cd'])
@php($len=1) @foreach($staffChecklists as $checklist) @php($arrData = [])
@if(is_object($checklist->headers) && count($checklist->headers)>0) @foreach($checklist->headers as $heads) @php($arrItems = []) @php($itemActuals = []) @foreach($heads->items as $item) @php($aData = \App\Models\checklistData::where('staffs_id',[$staffToShow])->where('item_id',[$item->id])->where('actual','>',0)->get(DB::raw('dated,actual'))) @if(is_object($aData) && count($aData)>0) @foreach($aData as $dats) @php($itemActuals[$dats->dated][] = $dats->actual) @endforeach @endif @php($itemVar = \App\Models\checklistData::where('staffs_id',[$staffToShow])->where('item_id',[$item->id])->get(DB::raw('group_concat(dated) as dated'))) @php($arrItems[] = ['id'=>$item->id,'name'=>$item->item_name,'frequency'=>$item->frequency,'targetValue'=>$item->target_value,'checklist_id'=>$checklist->id,'actual'=>$itemActuals,'selected'=>(($itemVar && $itemVar[0]->dated!='')?explode(',',$itemVar[0]->dated):[])]) @endforeach @php($arrData[] = ['id'=>$heads->id,'name'=>$heads->header_title,'items'=>$arrItems]) @endforeach
@endif
@php($len++) @endforeach
@else
@endif