Loheide-eu-mitarbeiterplatt.../app/Http/Controllers/DashboardController.php
Friederich Loheide b967c16b6d
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Failing after 8m49s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Failing after 8m47s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Failing after 8m40s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Failing after 9m24s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 11m32s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 12m4s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 10m37s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 45s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m12s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 10m41s
Einfache Ansicht für Klienten (0.57.0)
Rollen-Schalter simple_ui: größere Schrift, Leichte Sprache automatisch,
Startseite mit großen Kacheln; Hinweis in „Was sieht wer?“.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 16:34:14 +00:00

40 lines
1.6 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace App\Http\Controllers;
use App\Dashboard\Homepage;
use App\Dashboard\Widgets;
use App\Feed\Feed;
use App\Feed\FeedActions;
use App\Support\Branding;
use Illuminate\Http\Request;
use Inertia\Inertia;
use Inertia\Response;
class DashboardController extends Controller
{
public function __invoke(Request $request, Widgets $widgets, Homepage $homepage, Branding $branding, Feed $feed): Response
{
// Vorschau des Entwurfs für alle, die die Startseite gestalten
$preview = $request->boolean('entwurf') && $request->user()->can('appearance.manage');
// Die Mitarbeiter-App hat einen festen Aufbau aus Kacheln; die frei gestaltete
// Startseite gilt für die klassische Oberfläche (Vorschau im Editor bleibt möglich)
// Einfache Ansicht (z. B. Klienten): immer die Kacheln – groß und klar statt frei gestaltet
if ($preview || ($homepage->isBuilder() && $branding->interface() !== 'app' && ! $request->user()->usesSimpleUi())) {
return Inertia::render('Dashboard', [
'content' => $homepage->render($request->user(), draft: $preview),
'preview' => $preview,
]);
}
$isApp = $branding->interface() === 'app';
return Inertia::render('Dashboard', [
'widgets' => $widgets->resolve($request->user(), $request),
// Mitarbeiter-App: Feed in der Mitte, darüber Schnellaktionen je nach Rechten
'feed' => $isApp ? fn () => $feed->page($request->user()) : null,
'feedActions' => $isApp ? fn () => FeedActions::for($request->user()) : [],
]);
}
}