@php $data = $crfData->firstWhere('ws_code', $worksheet->ws_code); $indentation = str_repeat(' ', $level * 6); // Adjust multiplier (4) for desired indentation width @endphp @if ($worksheet->children->isNotEmpty() && !$data) {!! $indentation !!}{{ $worksheet->ws_code }}. {{ $worksheet->ws_title }} @foreach ($worksheet->children as $child) @include('reports.crf.row', ['worksheet' => $child, 'level' => $level + 1]) @endforeach @else @if ($data) {!! $indentation !!}{{ $worksheet->ws_code }}. {{ $worksheet->ws_title }} {{ $isExport ? $data->co2 : getFormattedValue($data->co2, 2) }} {{ $isExport ? $data->ch4 : getFormattedValue($data->ch4, 2) }} {{ $isExport ? $data->n2o : getFormattedValue($data->n2o, 2) }} {{ $isExport ? $data->co2eq : getFormattedValue($data->co2eq, 2) }} @endif @endif