@extends('hms.layout') @section('title','Staff structure & heads') @section('content')

Organise departments, units and sections within each facility. Assign employees through Employee records or Staff accounts. Appointing a head does not grant system permissions.

Organisation chart

@forelse($chart as $row) @php($node=$row['node']) @empty@endforelse
Department / unit / sectionTypeFacilityHead
{{ $node->name }} {{ $node->code }}{{ ucfirst($node->kind) }}{{ $facilities->firstWhere('id',$node->facility_id)?->name }}{{ $node->head?->name ?? 'Not assigned' }}@if($node->head && !in_array($node->head->status,['active','on_leave'],true)) Reassign inactive head@endif
No departments, units or sections yet.

Add department, unit or section

@csrf

Manage structure and heads

@foreach($nodes as $node)
{{ $node->name }} · {{ ucfirst($node->kind) }}
@csrf @method('PUT')
@csrf @method('PUT')
@endforeach

Structure history

@forelse($changes as $change)

{{ $change->created_at }} · {{ str_replace(['structure.','_'],['',' '],$change->action) }} · {{ $nodes->firstWhere('id',$change->subject_id)?->name ?? 'Structure item' }}

@empty

No structure changes recorded yet.

@endforelse
@endsection