Loheide-eu-mitarbeiterplatt.../app/Http/Controllers/AppearanceController.php
Friederich Loheide 4fcc41ed30
All checks were successful
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 2m41s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 2m48s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 3m15s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 3m17s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 3m48s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 3m41s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 3m33s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m26s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 3m59s
Phase 6 (Teil 2): OpenID Connect, LDAP/AD und SAML 2
- Gemeinsamer Treiber-Unterbau (App\Identity\IdentityDriver, IdentityDrivers,
  IdentityLogin, AttributeProfile); Entra ID nutzt ihn ebenfalls
- Plugins oidc, ldap und saml mit Profil- und Gruppen-Zuordnung
- Admin: Verfahren wählen, Formular je Verfahren, zuletzt empfangene Angaben
- onelogin/php-saml als neue Abhängigkeit

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-26 12:38:32 +00:00

85 lines
4.1 KiB
PHP
Raw Permalink 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\Models\IdentityProvider;
use App\Pagebuilder\Content;
use App\Support\Branding;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Inertia\Inertia;
use Inertia\Response;
/**
* Web-App-Manifest und die Vorschauseiten für „Erscheinungsbild“.
*/
class AppearanceController extends Controller
{
public function manifest(Branding $branding): JsonResponse
{
$icons = collect($branding->get('icons') ?? [])
->reject(fn ($path, $size) => (int) $size < 192)
->map(fn ($path, $size) => ['src' => $branding->url($path), 'sizes' => "{$size}x{$size}", 'type' => 'image/png', 'purpose' => 'any'])
->values();
if ($icons->isEmpty()) {
$icons = collect([['src' => $branding->faviconUrl(), 'sizes' => 'any', 'type' => 'image/svg+xml']]);
}
return response()->json([
'name' => $branding->portalName(),
'short_name' => mb_substr($branding->portalName(), 0, 12),
'start_url' => '/',
'scope' => '/',
'display' => 'standalone',
'lang' => 'de',
'theme_color' => $branding->primaryColor(),
'background_color' => '#F4F5F7',
'icons' => $icons->all(),
], 200, ['Content-Type' => 'application/manifest+json', 'Cache-Control' => 'public, max-age=3600']);
}
/**
* Anmeldeseite im aktuellen Entwurf – für die Vorschau (Formular ohne Funktion).
*/
public function loginPreview(Request $request): Response
{
return Inertia::render('Auth/Login', [
'canResetPassword' => true,
'providers' => IdentityProvider::forLogin()->map->toLoginButton()->values(),
'preview' => true,
]);
}
/**
* Beispielseite mit Boxen, Tabs, Akkordeon, Tabelle und Schaltflächen.
*/
public function sample(Request $request, Content $content): Response
{
$text = fn (string $html) => ['type' => 'text', 'data' => ['html' => $html]];
$box = fn (string $variant, string $title, string $html) => ['type' => 'box', 'data' => ['variant' => $variant, 'title' => $title, 'show_icon' => true], 'items' => [['blocks' => [$text($html)]]]];
$blocks = [
['type' => 'heading', 'data' => ['text' => 'Überschrift der Seite', 'level' => '2']],
$text('<p>Fließtext mit einem <a href="#">Link in der Akzentfarbe</a>, <strong>Hervorhebungen</strong> und einer Liste:</p><ul><li>erster Punkt</li><li>zweiter Punkt</li></ul>'),
['type' => 'columns', 'data' => ['layout' => '1-1'], 'items' => [
['blocks' => [$box('info', 'Info', '<p>Sprechstunde dienstags 14–16 Uhr.</p>'), $box('warning', 'Warnung', '<p>Bitte bis Freitag einreichen.</p>')]],
['blocks' => [$box('success', 'Erfolg', '<p>Das neue Verfahren gilt ab sofort.</p>'), $box('highlight', 'Hervorgehoben', '<p>In der Markenfarbe.</p>')]],
]],
['type' => 'tabs', 'items' => [
['title' => 'Erster Tab', 'blocks' => [$text('<p>Inhalt des ersten Tabs.</p>')]],
['title' => 'Zweiter Tab', 'blocks' => [$text('<p>Inhalt des zweiten Tabs.</p>')]],
]],
['type' => 'accordion', 'data' => ['first_open' => true], 'items' => [
['title' => 'Häufige Frage', 'blocks' => [$text('<p>Die Antwort steht hier.</p>')]],
['title' => 'Noch eine Frage', 'blocks' => [$text('<p>Noch eine Antwort.</p>')]],
]],
['type' => 'table', 'data' => ['header' => true, 'rows' => [['Bereich', 'Ansprechpartner', 'Durchwahl'], ['Personal', 'A. Beispiel', '123'], ['IT', 'B. Muster', '456']]]],
['type' => 'buttons', 'data' => ['buttons' => [['label' => 'Primäre Schaltfläche', 'url' => '#', 'variant' => 'primary'], ['label' => 'Umrandet', 'url' => '#', 'variant' => 'outline']]]],
];
return Inertia::render('Appearance/Sample', [
'content' => $content->render($content->sanitize(['blocks' => $blocks]), $request->user()),
]);
}
}