@php use Carbon\Carbon; // Fetch project from dp_project using request $project = null; $district = request('district'); $project_id = request('dp_project'); if($project_id) { $project = \App\Models\DpProject::find($project_id); } if (!$project && $district) { $project = \App\Models\DpProject::where('district', $district)->first(); } // Get the start year from the project $startYear = $project ? (Carbon::parse($project->start_date)->year ?? null) : null; // Prepare years for columns $years = []; if ($startYear) { $years = [$startYear, $startYear + 1, $startYear + 2]; } else { $years = [null, null, null]; } if($project){ $year_wise_results = \App\Helpers\ProjectHelper :: getDpConsolidatedResults($district, $project->start_date, $project->end_date, 'al_report'); } // echo '
'; print_r($year_wise_results); echo ''; die(); $project_types = ['al']; // Prepare results $results = [ ['label' => 'Decisions', 'field' => 'decisions'], ['label' => 'New Life Members', 'field' => 'new_life_members'], ['label' => 'Hope Cells', 'field' => 'hope_cells'], ['label' => 'Worship Groups', 'field' => 'worship_groups'], ]; @endphp @php $table_colors = [ 'al' => '#ffe0b2', // Soft Orange 'asc' => '#b9f6ca', // Soft Green 'ict' => '#fff9b2', // Soft Yellow 'overall' => '#e1bee7', // Soft Purple ]; @endphp @foreach($project_types as $type)
| {{ strtoupper($type) }} Year Wise Results | |||||
|---|---|---|---|---|---|
| S. No | Results | @if($years[0]) {{ $years[0] }} @else Year 1 @endif | @if($years[1]) {{ $years[1] }} @else Year 2 @endif | @if($years[2]) {{ $years[2] }} @else Year 3 @endif | Total |
| {{ $i + 1 }} | {{ $result['label'] }} | {{ $y1 }} | {{ $y2 }} | {{ $y3 }} | {{ $total }} |