{{-- صف واحد في شجرة الحسابات + أبناءه (recursive) --}} @foreach (($byParent[$pid] ?? []) as $a) @php $kids = $byParent[$a->id] ?? []; $hasK = count($kids) > 0; [$d, $c] = $totals[$a->id] ?? [0, 0]; $net = round($d - $c, 2); $tId = $rootType ?? $a->account_type; $tColor = $typeColors[$tId] ?? '#475569'; $tName = isset($types[$a->account_type]) ? ($ar ? $types[$a->account_type]->name_ar : ($types[$a->account_type]->name_en ?: $types[$a->account_type]->name_ar)) : ''; $isFolder = $hasK || $a->is_parent; @endphp
@if ($hasK) @else @endif {{ $a->account_number }} {{ $a->name }} @if ($lvl == 0 && $tName)({{ $tName }})@endif @if ($hasK){{ count($kids) }}@endif
{{ number_format($d, 2) }}
{{ number_format($c, 2) }}
{{ number_format(abs($net), 2) }} @if ($net != 0){{ $net > 0 ? 'م' : 'د' }}@endif
@if ($isFolder) @endif
@if ($hasK && $lvl < 15) @include('acountes._tree_node', ['pid' => $a->id, 'lvl' => $lvl + 1, 'rootType' => $tId]) @endif @endforeach