Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m30s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 1m28s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 1m31s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 1m36s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 1m45s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 1m44s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 1m35s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 1m38s
CI / Build-Artefakte aktuell (pull_request) Successful in 54s
- Rollen mit globalen Rechten und Rechten für einzelne Objekte (z. B. „Beiträge schreiben in Kategorie MAV-Info“); Rollen sind additiv, Zuweisungen merken sich ihre Herkunft (manuell oder später Identity-Provider-Gruppe) - Systemrolle „Administration“ ersetzt users.is_admin (Migration übernimmt bestehende Administratoren); nicht löschbar, man kann sie sich nicht selbst entziehen - Rechte je Person vorberechnet und gecacht, Versionszähler invalidiert bei Änderungen - Gate-Anbindung: registrierte Rechte entscheidet das Rechtesystem, Objektregeln die Policies; Admin-Seiten und Plugin-Ressourcen hinter passenden Rechten - Redaktion nach Kategorie: Schreiben und Veröffentlichen getrennt, Liste im Admin auf eigene Kategorien beschränkt, ohne Veröffentlichungsrecht bleibt ein Beitrag Entwurf - Zielgruppen (Rolle/Abteilung/Standort) für Kategorien und Termine als indizierte SQL-Bedingung in Listen, Detailseiten, Kacheln und .ics-Export - Admin: Rollen-Verwaltung, „Rechte prüfen“, Redaktion und Sichtbarkeit direkt an Kategorie bzw. Termin - Kern-Ressourcen explizit registriert, damit nach Updates liegengebliebene alte Dateien nicht doppelt geladen werden - docs/PLUGINS.md für Plugin-Entwicklung; Demo-Rolle „MAV“ Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
106 lines
3.7 KiB
PHP
106 lines
3.7 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';
|
|
|
|
public static function canAccess(): bool
|
|
{
|
|
return auth()->user()?->can('appearance.manage') ?? false;
|
|
}
|
|
|
|
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();
|
|
}
|
|
}
|