@csrf
@foreach ($formDetails as $detail) @php $unitCode = $detail->unit_code; $unitCategory = $unitsMap[$unitCode]->category ?? null; @endphp @endforeach @php $counter = 1; $years = activityYearRange($inventoryYear); @endphp @foreach ($years as $year) @foreach ($formDetails as $detail) @php $activity_value = isset($activityFormDetails[$year]) ? $activityFormDetails[$year] ->where('activity_code', $detail->activity_code) ->where('activity_unit_code', $detail->unit_code) ->first()->activity_value ?? '' : ''; @endphp @endforeach @php $counter++; @endphp @endforeach
No. Tahun {{ $detail->activity ? $detail->activity->name : 'N/A' }}

@if ($unitCategory) @else {{ $unitCode }} @endif
{{ $counter }} {{ $year }} {{-- --}}