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>
101 lines
3.6 KiB
PHP
101 lines
3.6 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Pages;
|
|
|
|
use App\Support\Branding;
|
|
use App\Support\Settings;
|
|
use BackedEnum;
|
|
use Filament\Forms\Components\ColorPicker;
|
|
use Filament\Forms\Components\FileUpload;
|
|
use Filament\Forms\Components\TextInput;
|
|
use Filament\Notifications\Notification;
|
|
use Filament\Pages\Page;
|
|
use Filament\Schemas\Components\Section;
|
|
use Filament\Schemas\Schema;
|
|
use Filament\Support\Icons\Heroicon;
|
|
use Illuminate\Support\Facades\Storage;
|
|
use UnitEnum;
|
|
|
|
/**
|
|
* Basis-Branding (Phase 0). Die vollständige Seite „Erscheinungsbild“ mit
|
|
* Logo-Varianten, Schriften, Vorschau usw. folgt in Phase 5.
|
|
*/
|
|
class Appearance extends Page
|
|
{
|
|
protected string $view = 'filament.pages.settings-form';
|
|
|
|
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedPaintBrush;
|
|
|
|
protected static string|UnitEnum|null $navigationGroup = 'Portal';
|
|
|
|
protected static ?string $navigationLabel = 'Erscheinungsbild';
|
|
|
|
protected static ?string $title = 'Erscheinungsbild';
|
|
|
|
protected static ?string $slug = 'erscheinungsbild';
|
|
|
|
/** @var array<string, mixed>|null */
|
|
public ?array $data = [];
|
|
|
|
public function mount(Branding $branding): void
|
|
{
|
|
$this->form->fill([
|
|
'portal_name' => $branding->portalName(),
|
|
'primary_color' => $branding->primaryColor(),
|
|
'logo_path' => $branding->logoPath(),
|
|
]);
|
|
}
|
|
|
|
public function form(Schema $schema): Schema
|
|
{
|
|
return $schema
|
|
->components([
|
|
Section::make('Portal')
|
|
->description('Name und Logo erscheinen im Kopfbereich, auf der Anmeldeseite und im Browser-Tab.')
|
|
->schema([
|
|
TextInput::make('portal_name')
|
|
->label('Name des Portals')
|
|
->placeholder(Branding::DEFAULT_NAME)
|
|
->maxLength(60),
|
|
FileUpload::make('logo_path')
|
|
->label('Logo')
|
|
->helperText('SVG, PNG oder WebP, am besten mit transparentem Hintergrund.')
|
|
->disk('uploads')
|
|
->directory('branding')
|
|
->visibility('public')
|
|
->acceptedFileTypes(['image/svg+xml', 'image/png', 'image/webp'])
|
|
->maxSize(2048),
|
|
]),
|
|
Section::make('Farben')
|
|
->description('Aus der Primärfarbe wird die komplette Farbpalette für den hellen und den dunklen Modus berechnet.')
|
|
->schema([
|
|
ColorPicker::make('primary_color')
|
|
->label('Primärfarbe')
|
|
->regex('/^#[0-9a-fA-F]{6}$/')
|
|
->required(),
|
|
]),
|
|
])
|
|
->statePath('data');
|
|
}
|
|
|
|
public function save(Settings $settings, Branding $branding): void
|
|
{
|
|
$data = $this->form->getState();
|
|
$previousLogo = $branding->logoPath();
|
|
|
|
$settings->setMany([
|
|
'branding.portal_name' => filled($data['portal_name']) ? trim($data['portal_name']) : null,
|
|
'branding.primary_color' => strtoupper($data['primary_color']),
|
|
'branding.logo_path' => $data['logo_path'] ?: null,
|
|
]);
|
|
|
|
if ($previousLogo && $previousLogo !== $data['logo_path']) {
|
|
Storage::disk('uploads')->delete($previousLogo);
|
|
}
|
|
|
|
Notification::make()
|
|
->success()
|
|
->title('Erscheinungsbild gespeichert')
|
|
->send();
|
|
}
|
|
}
|