@php
    $columnSpan = 1 + (empty($columnPeriods) ? 1 : count($columnPeriods) + 1);
@endphp
<tr class="pl-report-section-header">
    <td colspan="{{ $columnSpan }}" class="fw-bold text-uppercase">{{ $group['label'] }}</td>
</tr>
@if(!empty($group['tree']))
    @include('reports.profit-loss._account-tree', ['nodes' => $group['tree'], 'level' => 0])
@else
    <tr>
        <td class="ps-4">No accounts</td>
        @if(!empty($columnPeriods))
            @foreach($columnPeriods as $period)
                <td class="text-end">—</td>
            @endforeach
            <td class="text-end">—</td>
        @else
            <td class="text-end">—</td>
        @endif
    </tr>
@endif
<tr class="pl-report-total-row">
    <td class="fw-semibold text-end">Total {{ $group['label'] }}</td>
    @include('reports.profit-loss._period-amount-cells', [
        'amounts' => !empty($columnPeriods) ? ($group['period_totals'] ?? []) : $group['total'],
        'total' => $group['total'],
        'cellClass' => 'fw-semibold',
    ])
</tr>
