@extends('layouts.vertical', ['page_title' => 'Action Plan Report']) @section('css') @endsection @section('content')
{{ $title }} Action Plan Timeline
@php // Fixed timeline & adherence columns $timelineCols = ['less_than_1_month', '1_month', '3_months', '6_months']; $adherenceCols = ['on_track', 'needs_correction', 'status_quo']; @endphp @foreach ($timelineCols as $col) @endforeach @foreach ($adherenceCols as $col) @endforeach @foreach ($response as $plan => $slugs) @foreach ($timelineCols as $col) @endforeach @foreach ($adherenceCols as $col) @endforeach @endforeach
SBM /ME Action Plan Total{{ ucfirst(str_replace('_', ' ', $col)) }}{{ ucfirst(str_replace('_', ' ', $col)) }}
{{ $plan }} {{ $slugs->total ?? 0 }}{{ $slugs->{$col} ?? 0 }}{{ $slugs->{$col} ?? 0 }}
@endsection {{-- @extends('layouts.vertical', ['page_title' => 'Action Plan Report']) @section('css') @endsection @section('content')
{{ $title }} Action Plan Timeline
@php // Assuming your API response variable is $apiResponse $reportData = $response->data->submissions ?? []; // Collect all unique timelines across all action plans $allTimelines = collect($reportData) ->flatMap(fn($item) => collect($item->timelines)->pluck('timeline')) ->unique() ->values() ->toArray(); // Priority sorting for last columns $priorityEnd = ['staus_quo', 'needs_correction', 'on_track']; $existingPriority = array_values(array_intersect($priorityEnd, $allTimelines)); $remaining = array_values(array_diff($allTimelines, $existingPriority)); $allTimelines = array_merge($remaining, $existingPriority); @endphp @if (!empty($reportData)) @foreach ($allTimelines as $timeline) @endforeach @foreach ($reportData as $row) @foreach ($allTimelines as $timeline) @php $count = collect($row->timelines) ->firstWhere('timeline', $timeline)->user_count ?? 0; @endphp @endforeach @endforeach
Action Plan Item Total Users{{ ucfirst(str_replace('_', ' ', $timeline)) }}
{{ ucfirst(str_replace('_', ' ', $row->action_plan_item)) }} {{ $row->total_user_count }}{{ $count }}
@else

No data available.

@endif
@endsection --}}