@extends('layouts.app') @section('content')
{{ $currentBusiness->name }} People
{{ $totalStaff }} Total Staff
{{ $deptCount }} Departments
{{ $currentBusiness->currency_symbol }}{{ number_format($monthlyPayroll) }} Monthly Payroll
{{ $activeCount }} Active

Set a staff member's manager in Staff > Edit to build the hierarchy.

{{ $activeStaff->count() }} of {{ $totalStaff }} staff
@foreach($departmentTrees as $dept => $tree) @if(!$filterDept || $filterDept == $dept)

{{ $dept ?? 'No Department' }}

{{ $tree['count'] }} people {{ $currentBusiness->currency_symbol }}{{ number_format($tree['payroll']) }}/mo
@foreach($tree['topLevel'] as $leader) @include('dashboard.org-chart._person-tree', ['person' => $leader, 'allStaff' => $tree['members'], 'color' => $tree['color'], 'level' => 0]) @endforeach {{-- Staff with no manager and not top level --}} @php $orphans = $tree['members']->filter(function($m) use ($tree) { return !$tree['topLevel']->contains('id', $m->id) && !$tree['members']->contains('id', $m->manager_id); })->diff($tree['topLevel']); @endphp @if($orphans->count() > 0)
@foreach($orphans as $orphan) @include('dashboard.org-chart._person-card', ['person' => $orphan, 'color' => $tree['color']]) @endforeach
@endif
@endif @endforeach
@if($fullTreeTopLevel->count() > 0)
@foreach($fullTreeTopLevel as $topPerson) @include('dashboard.org-chart._full-tree-node', ['person' => $topPerson, 'allStaff' => $activeStaff, 'deptColors' => $deptColors, 'level' => 0]) @endforeach
@else

No hierarchy data yet. Set manager relationships in Staff > Edit.

@endif
@if($activeStaff->isEmpty())

No staff data

Add staff with reporting relationships to build the org chart.

@endif
@endsection