@foreach ($distributor as $row)
@php
$counts = DB::table("planalloctions")->where([
'company_id' => $data->company_id,
'zone_id' => $data->zone_id,
'unit_id' => $data->unit_id,
'project_id' => $data->project_id,
'auditor_id' => $row->id
])
->selectRaw('
COUNT(*) as totaldis,
SUM(CASE WHEN status = 1 THEN 1 ELSE 0 END) as pending,
SUM(CASE WHEN status = 2 THEN 1 ELSE 0 END) as WIP,
SUM(CASE WHEN status > 2 THEN 1 ELSE 0 END) as Complete
')
->first();
@endphp
{{ strtoupper(substr($row->name, 0, 1)) }}
-
{{ $counts->totaldis ?? 0 }}
Total Distributor
-
{{ $counts->pending ?? 0 }}
Pending Distributor
-
{{ $counts->WIP ?? 0 }}
WIP Distributor
-
{{ $counts->Complete ?? 0 }}
Complete Distributor
-
Mobile:
{{ $row->mobile }}
-
Email :
{{ $row->email }}
@endforeach
{{-- ******* Tab ******** --}}
{{-- ******** tables ********* --}}
{{-- ********** table ********* --}}
{{-- ******* Tab ******** --}}