Organigramm und Dokumente kompakter
All checks were successful
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 2m31s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 2m26s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 3m9s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 3m16s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 4m3s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 4m1s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 4m16s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 4m21s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m26s
All checks were successful
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 2m31s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 2m26s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 3m9s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 3m16s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 4m3s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 4m1s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 4m16s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 4m21s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m26s
- Organigramm: zwei Ebenen offen, Fläche so hoch wie der Inhalt, kleinere Abstände; Fokus-Ansicht in voller Breite mit Seitenspalte und Team-Vorschau - Dokumente: dichtere Zeilen, Unterordner in den Bereichen, Infospalte „Über diesen Ordner“ mit den pflegenden Rollen - Etwas weniger Randabstand im Seitenlayout Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
ab0384ceb1
commit
33862183bf
80 changed files with 475 additions and 352 deletions
|
|
@ -52,15 +52,46 @@ class OrganigramController extends Controller
|
|||
if (! $roots->contains('id', $path[0])) {
|
||||
$roots = $roots->push(...$this->nodes(User::query()->whereKey($path[0])))->values();
|
||||
}
|
||||
} elseif ($roots->count() === 1) {
|
||||
// Nur eine Spitze (z. B. die Geschäftsführung): erste Ebene gleich zeigen.
|
||||
$path = [$roots[0]['id']];
|
||||
$teams[$path[0]] = $this->nodes(User::query()->active()->where('manager_id', $path[0]));
|
||||
}
|
||||
|
||||
// Aufgeklappt: der Weg zur gesuchten Person – sonst die obersten zwei Ebenen,
|
||||
// damit das Organigramm gleich etwas zeigt.
|
||||
$open = array_values(array_filter($path, fn ($id) => $id !== $focus?->id));
|
||||
|
||||
if (! $focus && $roots->count() <= 3) {
|
||||
foreach ($roots as $root) {
|
||||
$teams[$root['id']] = $this->nodes(User::query()->active()->where('manager_id', $root['id']));
|
||||
$open[] = $root['id'];
|
||||
}
|
||||
|
||||
$leaders = collect($teams)->flatten(1)->where('reports', '>', 0)->pluck('id')->take(12)->all();
|
||||
|
||||
if ($leaders !== []) {
|
||||
$this->nodes(User::query()->active()->whereIn('manager_id', $leaders))
|
||||
->groupBy('manager_id')
|
||||
->each(function ($team, $managerId) use (&$teams) {
|
||||
$teams[$managerId] = $team->values();
|
||||
});
|
||||
$open = [...$open, ...$leaders];
|
||||
}
|
||||
}
|
||||
|
||||
// Fokus: auch die Teams der direkt Unterstellten – für die Vorschau im Fokus.
|
||||
if ($focus && $view === 'fokus') {
|
||||
$leads = collect($teams[$focus->id] ?? [])->where('reports', '>', 0)->pluck('id')->take(24)->all();
|
||||
|
||||
if ($leads !== []) {
|
||||
$this->nodes(User::query()->active()->whereIn('manager_id', $leads))->groupBy('manager_id')
|
||||
->each(function ($team, $managerId) use (&$teams) {
|
||||
$teams[$managerId] = $team->values();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return Inertia::render('People/Organigram', [
|
||||
'roots' => $roots,
|
||||
'path' => $path,
|
||||
'open' => array_values(array_unique($open)),
|
||||
'teams' => (object) $teams,
|
||||
'focus' => $focus?->id,
|
||||
'details' => $focus ? [
|
||||
|
|
@ -110,6 +141,7 @@ class OrganigramController extends Controller
|
|||
'location' => $u->location,
|
||||
'avatar_url' => $u->avatarUrl(96),
|
||||
'reports' => $u->reports_count,
|
||||
'manager_id' => $u->manager_id,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue