Neues Design: Tailwind + shadcn-vue statt Vuetify/Material 3
Some checks failed
CI / PHP 8.4 / mariadb:10.6 (pull_request) Failing after 1m3s
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m7s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Failing after 1m16s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Failing after 1m20s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 1m29s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 1m33s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 1m28s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 1m33s
CI / Build-Artefakte aktuell (pull_request) Failing after 52s
Some checks failed
CI / PHP 8.4 / mariadb:10.6 (pull_request) Failing after 1m3s
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m7s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Failing after 1m16s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Failing after 1m20s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 1m29s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 1m33s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 1m28s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 1m33s
CI / Build-Artefakte aktuell (pull_request) Failing after 52s
- Nüchterne, professionelle Optik: neutrale Flächen, Markenfarbe nur als Akzent, Inter-Schrift (lokal) - Zweizeiliger Header mit Suche, Hauptnavigation und Avatar-Menü - Startseite mit Begrüßungskarte, Schnellzugriffen und „Neu im Team“ - Personenverzeichnis mit Suche, Abteilungsfilter und Seitenaufteilung - Markenfarbe exakt übernommen, Abstufungen serverseitig in OKLCH (ColorPalette) – gemeinsam für Portal und Admin, keine Farbberechnung im Browser - Schnellzugriffe im Admin pflegbar - Filament-Avatare lokal statt über ui-avatars.com (DSGVO) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
9c0f8de791
commit
5a3f1f34c7
141 changed files with 3873 additions and 974 deletions
39
app/Filament/AvatarProviders/InitialsAvatarProvider.php
Normal file
39
app/Filament/AvatarProviders/InitialsAvatarProvider.php
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
namespace App\Filament\AvatarProviders;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Support\Branding;
|
||||
use Filament\AvatarProviders\Contracts\AvatarProvider;
|
||||
use Filament\Facades\Filament;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Initialen-Avatar als eingebettetes SVG. Ersetzt Filaments Standard, der die
|
||||
* Bilder von ui-avatars.com lädt – personenbezogene Daten gehen so nicht an Dritte.
|
||||
*/
|
||||
class InitialsAvatarProvider implements AvatarProvider
|
||||
{
|
||||
public function __construct(private readonly Branding $branding) {}
|
||||
|
||||
public function get(Model $record): string
|
||||
{
|
||||
$initials = $record instanceof User
|
||||
? $record->initials
|
||||
: mb_strtoupper(mb_substr(Filament::getNameForDefaultAvatar($record), 0, 1));
|
||||
|
||||
$palette = $this->branding->palette();
|
||||
$background = $palette[100];
|
||||
$foreground = $palette[800];
|
||||
|
||||
$svg = sprintf(
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><rect width="64" height="64" fill="%s"/>'
|
||||
.'<text x="50%%" y="50%%" dy=".35em" text-anchor="middle" font-family="Inter, system-ui, sans-serif" font-size="26" font-weight="600" fill="%s">%s</text></svg>',
|
||||
$background,
|
||||
$foreground,
|
||||
htmlspecialchars($initials, ENT_XML1),
|
||||
);
|
||||
|
||||
return 'data:image/svg+xml;base64,'.base64_encode($svg);
|
||||
}
|
||||
}
|
||||
|
|
@ -22,11 +22,11 @@ use UnitEnum;
|
|||
*/
|
||||
class Appearance extends Page
|
||||
{
|
||||
protected string $view = 'filament.pages.appearance';
|
||||
protected string $view = 'filament.pages.settings-form';
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedPaintBrush;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'System';
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Portal';
|
||||
|
||||
protected static ?string $navigationLabel = 'Erscheinungsbild';
|
||||
|
||||
|
|
|
|||
94
app/Filament/Pages/QuickLinksSettings.php
Normal file
94
app/Filament/Pages/QuickLinksSettings.php
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
<?php
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use App\Support\QuickLinks;
|
||||
use App\Support\Settings;
|
||||
use BackedEnum;
|
||||
use Filament\Forms\Components\Repeater;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Pages\Page;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use UnitEnum;
|
||||
|
||||
class QuickLinksSettings extends Page
|
||||
{
|
||||
protected string $view = 'filament.pages.settings-form';
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedSquares2x2;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Portal';
|
||||
|
||||
protected static ?string $navigationLabel = 'Schnellzugriffe';
|
||||
|
||||
protected static ?string $title = 'Schnellzugriffe';
|
||||
|
||||
protected static ?string $slug = 'schnellzugriffe';
|
||||
|
||||
/** @var array<string, mixed>|null */
|
||||
public ?array $data = [];
|
||||
|
||||
public function mount(QuickLinks $quickLinks): void
|
||||
{
|
||||
$this->form->fill(['links' => $quickLinks->all()]);
|
||||
}
|
||||
|
||||
public function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
Section::make('Schnellzugriffe auf der Startseite')
|
||||
->description('Häufig genutzte Anwendungen und Seiten – z. B. Zeiterfassung, Urlaubsantrag oder IT-Support. Die Reihenfolge lässt sich per Ziehen ändern.')
|
||||
->schema([
|
||||
Repeater::make('links')
|
||||
->hiddenLabel()
|
||||
->columns(4)
|
||||
->reorderable()
|
||||
->collapsible()
|
||||
->itemLabel(fn (array $state) => $state['label'] ?? null)
|
||||
->addActionLabel('Schnellzugriff hinzufügen')
|
||||
->maxItems(24)
|
||||
->schema([
|
||||
TextInput::make('label')
|
||||
->label('Bezeichnung')
|
||||
->required()
|
||||
->maxLength(40),
|
||||
TextInput::make('url')
|
||||
->label('Adresse')
|
||||
->placeholder('https://… oder /personen')
|
||||
->required()
|
||||
->maxLength(500)
|
||||
->regex('#^(https?://|/)#i')
|
||||
->validationMessages(['regex' => 'Bitte eine Adresse angeben, die mit https://, http:// oder / beginnt.'])
|
||||
->columnSpan(2),
|
||||
Select::make('icon')
|
||||
->label('Symbol')
|
||||
->options(QuickLinks::ICONS)
|
||||
->default('link')
|
||||
->required(),
|
||||
Toggle::make('new_tab')
|
||||
->label('In neuem Tab öffnen')
|
||||
->columnSpanFull(),
|
||||
]),
|
||||
]),
|
||||
])
|
||||
->statePath('data');
|
||||
}
|
||||
|
||||
public function save(Settings $settings): void
|
||||
{
|
||||
$links = array_values($this->form->getState()['links'] ?? []);
|
||||
|
||||
$settings->set('portal.quick_links', $links);
|
||||
|
||||
Notification::make()
|
||||
->success()
|
||||
->title('Schnellzugriffe gespeichert')
|
||||
->send();
|
||||
}
|
||||
}
|
||||
|
|
@ -2,14 +2,37 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Resources\PersonResource;
|
||||
use App\Models\User;
|
||||
use App\Support\QuickLinks;
|
||||
use Illuminate\Http\Request;
|
||||
use Inertia\Inertia;
|
||||
use Inertia\Response;
|
||||
|
||||
class DashboardController extends Controller
|
||||
{
|
||||
public function __invoke(Request $request): Response
|
||||
public function __invoke(Request $request, QuickLinks $quickLinks): Response
|
||||
{
|
||||
return Inertia::render('Dashboard');
|
||||
$user = $request->user();
|
||||
|
||||
return Inertia::render('Dashboard', [
|
||||
'profile' => [
|
||||
'job_title' => $user->job_title,
|
||||
'department' => $user->department,
|
||||
'location' => $user->location,
|
||||
'avatar_url' => $user->avatarUrl(256),
|
||||
],
|
||||
'quickLinks' => $quickLinks->all(),
|
||||
'newColleagues' => PersonResource::collection(
|
||||
User::query()
|
||||
->active()
|
||||
->whereKeyNot($user->getKey())
|
||||
->where('created_at', '>=', now()->subDays(90))
|
||||
->latest()
|
||||
->limit(6)
|
||||
->get()
|
||||
),
|
||||
'peopleCount' => User::query()->active()->count(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,12 +2,58 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Resources\PersonResource;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Inertia\Inertia;
|
||||
use Inertia\Response;
|
||||
|
||||
class PeopleController extends Controller
|
||||
{
|
||||
public function index(Request $request): Response
|
||||
{
|
||||
$filters = $request->validate([
|
||||
'q' => ['nullable', 'string', 'max:100'],
|
||||
'abteilung' => ['nullable', 'string', 'max:150'],
|
||||
]);
|
||||
|
||||
$search = trim($filters['q'] ?? '');
|
||||
$department = $filters['abteilung'] ?? null;
|
||||
|
||||
$people = User::query()
|
||||
->active()
|
||||
->when($search !== '', function (Builder $query) use ($search) {
|
||||
$like = '%'.str_replace(['\\', '%', '_'], ['\\\\', '\\%', '\\_'], $search).'%';
|
||||
|
||||
$query->where(fn (Builder $q) => $q
|
||||
->where('name', 'like', $like)
|
||||
->orWhere('email', 'like', $like)
|
||||
->orWhere('job_title', 'like', $like)
|
||||
->orWhere('department', 'like', $like)
|
||||
->orWhere('location', 'like', $like));
|
||||
})
|
||||
->when($department, fn (Builder $query) => $query->where('department', $department))
|
||||
->orderBy('last_name')
|
||||
->orderBy('first_name')
|
||||
->orderBy('name')
|
||||
->paginate(24)
|
||||
->withQueryString();
|
||||
|
||||
return Inertia::render('People/Index', [
|
||||
'people' => PersonResource::collection($people),
|
||||
'filters' => ['q' => $search, 'abteilung' => $department],
|
||||
'departments' => Cache::remember('people.departments', 300, fn () => User::query()
|
||||
->active()
|
||||
->whereNotNull('department')
|
||||
->distinct()
|
||||
->orderBy('department')
|
||||
->pluck('department')
|
||||
->all()),
|
||||
]);
|
||||
}
|
||||
|
||||
public function show(User $user): Response
|
||||
{
|
||||
abort_unless($user->is_active, 404);
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Support\Branding;
|
||||
use App\Support\Navigation;
|
||||
use Illuminate\Http\Request;
|
||||
use Inertia\Middleware;
|
||||
|
||||
|
|
@ -10,7 +11,10 @@ class HandleInertiaRequests extends Middleware
|
|||
{
|
||||
protected $rootView = 'app';
|
||||
|
||||
public function __construct(private readonly Branding $branding) {}
|
||||
public function __construct(
|
||||
private readonly Branding $branding,
|
||||
private readonly Navigation $navigation,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
|
|
@ -34,6 +38,7 @@ class HandleInertiaRequests extends Middleware
|
|||
'is_admin' => $user->is_admin,
|
||||
] : null,
|
||||
],
|
||||
'navigation' => fn () => $user ? $this->navigation->items($request) : [],
|
||||
'flash' => [
|
||||
'status' => fn () => $request->session()->get('status'),
|
||||
],
|
||||
|
|
|
|||
33
app/Http/Resources/PersonResource.php
Normal file
33
app/Http/Resources/PersonResource.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/**
|
||||
* Kompakte Darstellung einer Person für Listen und Kacheln.
|
||||
*
|
||||
* @mixin User
|
||||
*/
|
||||
class PersonResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => $this->name,
|
||||
'initials' => $this->initials,
|
||||
'job_title' => $this->job_title,
|
||||
'department' => $this->department,
|
||||
'location' => $this->location,
|
||||
'email' => $this->email,
|
||||
'phone' => $this->phone,
|
||||
'avatar_url' => $this->avatarUrl(96),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -4,6 +4,8 @@ namespace App\Providers;
|
|||
|
||||
use App\Support\Avatars;
|
||||
use App\Support\Branding;
|
||||
use App\Support\Navigation;
|
||||
use App\Support\QuickLinks;
|
||||
use App\Support\Settings;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
|
@ -16,6 +18,8 @@ class AppServiceProvider extends ServiceProvider
|
|||
$this->app->singleton(Settings::class);
|
||||
$this->app->singleton(Branding::class);
|
||||
$this->app->singleton(Avatars::class);
|
||||
$this->app->singleton(Navigation::class);
|
||||
$this->app->singleton(QuickLinks::class);
|
||||
}
|
||||
|
||||
public function boot(): void
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Providers\Filament;
|
||||
|
||||
use App\Filament\AvatarProviders\InitialsAvatarProvider;
|
||||
use App\Support\Branding;
|
||||
use Filament\Http\Middleware\Authenticate;
|
||||
use Filament\Http\Middleware\AuthenticateSession;
|
||||
|
|
@ -11,7 +12,6 @@ use Filament\Navigation\NavigationItem;
|
|||
use Filament\Pages\Dashboard;
|
||||
use Filament\Panel;
|
||||
use Filament\PanelProvider;
|
||||
use Filament\Support\Colors\Color;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Widgets\AccountWidget;
|
||||
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
|
||||
|
|
@ -31,10 +31,11 @@ class AdminPanelProvider extends PanelProvider
|
|||
->default()
|
||||
->id('admin')
|
||||
->path('admin')
|
||||
->defaultAvatarProvider(InitialsAvatarProvider::class)
|
||||
->brandName(fn () => app(Branding::class)->portalName())
|
||||
->brandLogo(fn () => app(Branding::class)->logoUrl())
|
||||
->colors(fn () => [
|
||||
'primary' => Color::hex(app(Branding::class)->primaryColor()),
|
||||
'primary' => app(Branding::class)->palette(),
|
||||
])
|
||||
->navigationItems([
|
||||
NavigationItem::make('Zum Portal')
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ class Branding
|
|||
{
|
||||
public const DEFAULT_NAME = 'Inhaus';
|
||||
|
||||
public const DEFAULT_PRIMARY_COLOR = '#2E6B5E';
|
||||
public const DEFAULT_PRIMARY_COLOR = '#0F4C5C';
|
||||
|
||||
public function __construct(private readonly Settings $settings) {}
|
||||
|
||||
|
|
@ -42,6 +42,33 @@ class Branding
|
|||
return $path ? Storage::disk('uploads')->url($path) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<int, string>
|
||||
*/
|
||||
public function palette(): array
|
||||
{
|
||||
return ColorPalette::fromHex($this->primaryColor());
|
||||
}
|
||||
|
||||
/**
|
||||
* CSS-Variablen für das Portal. Werden serverseitig in die Seite geschrieben –
|
||||
* ohne Build und ohne Farbberechnung im Browser.
|
||||
*/
|
||||
public function cssVariables(): string
|
||||
{
|
||||
$color = $this->primaryColor();
|
||||
$variables = [
|
||||
'--brand' => $color,
|
||||
'--brand-foreground' => ColorPalette::foregroundFor($color),
|
||||
];
|
||||
|
||||
foreach ($this->palette() as $shade => $hex) {
|
||||
$variables["--brand-{$shade}"] = $hex;
|
||||
}
|
||||
|
||||
return collect($variables)->map(fn (string $value, string $name) => "{$name}:{$value}")->implode(';');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{portal_name: string, primary_color: string, logo_url: string|null}
|
||||
*/
|
||||
|
|
|
|||
166
app/Support/ColorPalette.php
Normal file
166
app/Support/ColorPalette.php
Normal file
|
|
@ -0,0 +1,166 @@
|
|||
<?php
|
||||
|
||||
namespace App\Support;
|
||||
|
||||
use InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* Leitet aus einer Markenfarbe eine Farbskala 50–950 ab (im OKLCH-Farbraum,
|
||||
* damit die Abstufungen gleichmäßig wirken). Die Markenfarbe selbst bleibt
|
||||
* unverändert und liegt auf Stufe 600 – dort, wo Portal und Admin-Backend
|
||||
* ihre Primär-Buttons einfärben.
|
||||
*/
|
||||
final class ColorPalette
|
||||
{
|
||||
/** Ziel-Helligkeiten einer „normalen“ Skala; wird an die Markenfarbe angepasst. */
|
||||
private const LIGHTNESS = [
|
||||
50 => 0.975, 100 => 0.945, 200 => 0.89, 300 => 0.81, 400 => 0.71,
|
||||
500 => 0.62, 600 => 0.54, 700 => 0.47, 800 => 0.40, 900 => 0.34, 950 => 0.26,
|
||||
];
|
||||
|
||||
/** Anteil der Sättigung je Stufe – helle und sehr dunkle Töne werden ruhiger. */
|
||||
private const CHROMA = [
|
||||
50 => 0.12, 100 => 0.22, 200 => 0.42, 300 => 0.65, 400 => 0.88,
|
||||
500 => 1.0, 600 => 1.0, 700 => 0.92, 800 => 0.82, 900 => 0.72, 950 => 0.6,
|
||||
];
|
||||
|
||||
/**
|
||||
* @return array<int, string> Stufe => Hex-Farbe
|
||||
*/
|
||||
public static function fromHex(string $hex): array
|
||||
{
|
||||
[$l, $c, $h] = self::hexToOklch($hex);
|
||||
|
||||
// Helligkeiten so verschieben, dass Stufe 600 genau der Markenfarbe entspricht,
|
||||
// die Skala aber monoton bleibt.
|
||||
$anchor = self::LIGHTNESS[600];
|
||||
$palette = [];
|
||||
|
||||
foreach (self::LIGHTNESS as $shade => $target) {
|
||||
if ($shade === 600) {
|
||||
$palette[$shade] = strtoupper($hex);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$lightness = $target > $anchor
|
||||
? $l + ($target - $anchor) / (1 - $anchor) * (0.985 - $l)
|
||||
: $l * ($target / $anchor);
|
||||
|
||||
$palette[$shade] = self::oklchToHex(
|
||||
max(0.12, min(0.985, $lightness)),
|
||||
$c * self::CHROMA[$shade],
|
||||
$h,
|
||||
);
|
||||
}
|
||||
|
||||
return $palette;
|
||||
}
|
||||
|
||||
/**
|
||||
* Schwarz oder Weiß – je nachdem, was auf der Farbe besser lesbar ist.
|
||||
*/
|
||||
public static function foregroundFor(string $hex): string
|
||||
{
|
||||
return self::contrast($hex, '#FFFFFF') >= self::contrast($hex, '#111111') ? '#FFFFFF' : '#111111';
|
||||
}
|
||||
|
||||
/**
|
||||
* Kontrastverhältnis nach WCAG 2.
|
||||
*/
|
||||
public static function contrast(string $a, string $b): float
|
||||
{
|
||||
$la = self::relativeLuminance($a);
|
||||
$lb = self::relativeLuminance($b);
|
||||
|
||||
return (max($la, $lb) + 0.05) / (min($la, $lb) + 0.05);
|
||||
}
|
||||
|
||||
private static function relativeLuminance(string $hex): float
|
||||
{
|
||||
[$r, $g, $b] = array_map(
|
||||
fn (float $v) => $v <= 0.04045 ? $v / 12.92 : (($v + 0.055) / 1.055) ** 2.4,
|
||||
self::hexToRgb($hex),
|
||||
);
|
||||
|
||||
return 0.2126 * $r + 0.7152 * $g + 0.0722 * $b;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{float, float, float} sRGB 0..1
|
||||
*/
|
||||
private static function hexToRgb(string $hex): array
|
||||
{
|
||||
if (! preg_match('/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i', $hex, $m)) {
|
||||
throw new InvalidArgumentException("Ungültige Farbe: {$hex}");
|
||||
}
|
||||
|
||||
return [hexdec($m[1]) / 255, hexdec($m[2]) / 255, hexdec($m[3]) / 255];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{float, float, float} L, C, h
|
||||
*/
|
||||
private static function hexToOklch(string $hex): array
|
||||
{
|
||||
[$r, $g, $b] = array_map(
|
||||
fn (float $v) => $v <= 0.04045 ? $v / 12.92 : (($v + 0.055) / 1.055) ** 2.4,
|
||||
self::hexToRgb($hex),
|
||||
);
|
||||
|
||||
$l = 0.4122214708 * $r + 0.5363325363 * $g + 0.0514459929 * $b;
|
||||
$m = 0.2119034982 * $r + 0.6806995451 * $g + 0.1073969566 * $b;
|
||||
$s = 0.0883024619 * $r + 0.2817188376 * $g + 0.6299787005 * $b;
|
||||
|
||||
[$l, $m, $s] = [$l ** (1 / 3), $m ** (1 / 3), $s ** (1 / 3)];
|
||||
|
||||
$L = 0.2104542553 * $l + 0.7936177850 * $m - 0.0040720468 * $s;
|
||||
$A = 1.9779984951 * $l - 2.4285922050 * $m + 0.4505937099 * $s;
|
||||
$B = 0.0259040371 * $l + 0.7827717662 * $m - 0.8086757660 * $s;
|
||||
|
||||
return [$L, sqrt($A * $A + $B * $B), atan2($B, $A)];
|
||||
}
|
||||
|
||||
private static function oklchToHex(float $L, float $C, float $h): string
|
||||
{
|
||||
// Sättigung reduzieren, bis die Farbe im sRGB-Farbraum darstellbar ist.
|
||||
for ($i = 0; $i < 40; $i++) {
|
||||
$rgb = self::oklchToLinearRgb($L, $C, $h);
|
||||
|
||||
if (min($rgb) >= -0.0005 && max($rgb) <= 1.0005) {
|
||||
break;
|
||||
}
|
||||
|
||||
$C *= 0.92;
|
||||
}
|
||||
|
||||
$hex = '#';
|
||||
|
||||
foreach ($rgb as $v) {
|
||||
$v = max(0.0, min(1.0, $v));
|
||||
$v = $v <= 0.0031308 ? 12.92 * $v : 1.055 * $v ** (1 / 2.4) - 0.055;
|
||||
$hex .= str_pad(strtoupper(dechex((int) round($v * 255))), 2, '0', STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
return $hex;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{float, float, float}
|
||||
*/
|
||||
private static function oklchToLinearRgb(float $L, float $C, float $h): array
|
||||
{
|
||||
$A = $C * cos($h);
|
||||
$B = $C * sin($h);
|
||||
|
||||
$l = ($L + 0.3963377774 * $A + 0.2158037573 * $B) ** 3;
|
||||
$m = ($L - 0.1055613458 * $A - 0.0638541728 * $B) ** 3;
|
||||
$s = ($L - 0.0894841694 * $A - 1.2914855480 * $B) ** 3;
|
||||
|
||||
return [
|
||||
4.0767416621 * $l - 3.3077115913 * $m + 0.2309699292 * $s,
|
||||
-1.2684380046 * $l + 2.6097574011 * $m - 0.3413193965 * $s,
|
||||
-0.0041960863 * $l - 0.7034186168 * $m + 1.7076147010 * $s,
|
||||
];
|
||||
}
|
||||
}
|
||||
23
app/Support/Navigation.php
Normal file
23
app/Support/Navigation.php
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
namespace App\Support;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
* Hauptnavigation des Portals. Wird ab Phase 2 zu einer Registry, in die
|
||||
* Plugins eigene Einträge eintragen.
|
||||
*/
|
||||
class Navigation
|
||||
{
|
||||
/**
|
||||
* @return list<array{label: string, href: string, active: bool}>
|
||||
*/
|
||||
public function items(Request $request): array
|
||||
{
|
||||
return [
|
||||
['label' => 'Startseite', 'href' => '/', 'active' => $request->routeIs('dashboard')],
|
||||
['label' => 'Personen', 'href' => '/personen', 'active' => $request->routeIs('people.*')],
|
||||
];
|
||||
}
|
||||
}
|
||||
72
app/Support/QuickLinks.php
Normal file
72
app/Support/QuickLinks.php
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
<?php
|
||||
|
||||
namespace App\Support;
|
||||
|
||||
/**
|
||||
* Schnellzugriffe auf der Startseite (App-Launcher), gepflegt im Admin-Bereich.
|
||||
*/
|
||||
class QuickLinks
|
||||
{
|
||||
/**
|
||||
* Auswahl an Symbolen (Lucide-Namen). Das Portal bündelt genau diese Symbole,
|
||||
* deshalb ist die Liste bewusst begrenzt.
|
||||
*/
|
||||
public const ICONS = [
|
||||
'link' => 'Link',
|
||||
'clock' => 'Uhr / Zeiterfassung',
|
||||
'calendar-days' => 'Kalender / Dienstplan',
|
||||
'plane' => 'Urlaub',
|
||||
'receipt' => 'Reisekosten / Belege',
|
||||
'graduation-cap' => 'Fortbildung',
|
||||
'headset' => 'IT-Support',
|
||||
'utensils' => 'Speiseplan',
|
||||
'car' => 'Fahrdienst',
|
||||
'file-text' => 'Formulare / Dokumente',
|
||||
'book-open' => 'Handbuch / Richtlinien',
|
||||
'users' => 'Personen / Teams',
|
||||
'mail' => 'E-Mail',
|
||||
'message-square' => 'Chat / Feedback',
|
||||
'lightbulb' => 'Ideen',
|
||||
'shield-check' => 'Datenschutz / Sicherheit',
|
||||
'heart-handshake' => 'Soziales / MAV',
|
||||
'building-2' => 'Standorte',
|
||||
'wrench' => 'Technik / Hausmeister',
|
||||
'monitor' => 'Anwendung',
|
||||
'folder' => 'Ablage',
|
||||
'phone' => 'Telefonbuch',
|
||||
'megaphone' => 'Ankündigungen',
|
||||
'briefcase' => 'Stellenangebote',
|
||||
];
|
||||
|
||||
public function __construct(private readonly Settings $settings) {}
|
||||
|
||||
/**
|
||||
* @return list<array{label: string, url: string, icon: string, new_tab: bool}>
|
||||
*/
|
||||
public function all(): array
|
||||
{
|
||||
$links = $this->settings->get('portal.quick_links');
|
||||
|
||||
if (! is_array($links)) {
|
||||
return $this->defaults();
|
||||
}
|
||||
|
||||
return array_values(array_map(fn (array $link) => [
|
||||
'label' => (string) ($link['label'] ?? ''),
|
||||
'url' => preg_match('#^(https?://|/)#i', (string) ($link['url'] ?? '')) ? (string) $link['url'] : '#',
|
||||
'icon' => array_key_exists($link['icon'] ?? '', self::ICONS) ? $link['icon'] : 'link',
|
||||
'new_tab' => (bool) ($link['new_tab'] ?? false),
|
||||
], $links));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<array{label: string, url: string, icon: string, new_tab: bool}>
|
||||
*/
|
||||
public function defaults(): array
|
||||
{
|
||||
return [
|
||||
['label' => 'Personen', 'url' => '/personen', 'icon' => 'users', 'new_tab' => false],
|
||||
['label' => 'Mein Profil', 'url' => '/profil/bearbeiten', 'icon' => 'file-text', 'new_tab' => false],
|
||||
];
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue