- Per-user admin mode (simple: bookings/contracts, blocked periods, guests, portal tasks, reviews; expert: everything the role allows), user menu switch, FollowsAdminMode on all resources/pages (guarded by a test); roles keep deciding permissions. - Users list shows mode and 2FA; admins can reset another user's 2FA. - New "Sperrzeiten" list for all apartments (manual blocks editable, portal blocks read-only). - styles/final: clean hand-built SVG mark, logo, favicon (dark-mode aware), 4 icons, wave divider, plus PNG/WebP for mail/PDF/touch icon; colours via --brand-* variables. - Decisions recorded in KONZEPT §6a/6b (booking path 1 via offer + guest acceptance, direct booking later; tourist tax by Ferienservice Balu); agent documents added and marked as analysis with assumptions; styles excluded from the deploy package. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
76 lines
2.2 KiB
PHP
76 lines
2.2 KiB
PHP
<?php
|
||
|
||
namespace App\Enums;
|
||
|
||
use App\Filament\Resources\BlockedPeriods\BlockedPeriodResource;
|
||
use App\Filament\Resources\Bookings\BookingResource;
|
||
use App\Filament\Resources\ChannelTasks\ChannelTaskResource;
|
||
use App\Filament\Resources\Guests\GuestResource;
|
||
use App\Filament\Resources\Reviews\ReviewResource;
|
||
use Filament\Support\Contracts\HasDescription;
|
||
use Filament\Support\Contracts\HasLabel;
|
||
|
||
/**
|
||
* How much of the admin a user sees. It only shapes the menu – what a user may do is decided by the role.
|
||
*/
|
||
enum AdminMode: string implements HasDescription, HasLabel
|
||
{
|
||
case Simple = 'simple';
|
||
case Expert = 'expert';
|
||
|
||
/**
|
||
* Menu entries of the simple mode: day-to-day work with requests, bookings, contracts and the calendar.
|
||
*
|
||
* @var list<class-string>
|
||
*/
|
||
public const SIMPLE_NAVIGATION = [
|
||
BookingResource::class,
|
||
BlockedPeriodResource::class,
|
||
GuestResource::class,
|
||
ChannelTaskResource::class,
|
||
ReviewResource::class,
|
||
];
|
||
|
||
public function getLabel(): string
|
||
{
|
||
return match ($this) {
|
||
self::Simple => 'Einfache Ansicht',
|
||
self::Expert => 'Expertenansicht',
|
||
};
|
||
}
|
||
|
||
public function getDescription(): string
|
||
{
|
||
return match ($this) {
|
||
self::Simple => 'Nur das Tägliche: Anfragen, Buchungen und Verträge, Sperrzeiten, Gäste, Portal-Aufgaben, Bewertungen',
|
||
self::Expert => 'Alle Einstellungen: Preise, Angebote, Portale, Webseite, System',
|
||
};
|
||
}
|
||
|
||
/**
|
||
* Whether a resource or page appears in the menu in this mode.
|
||
*
|
||
* @param class-string $class
|
||
*/
|
||
public function shows(string $class): bool
|
||
{
|
||
return $this === self::Expert || in_array($class, self::SIMPLE_NAVIGATION, true);
|
||
}
|
||
|
||
/**
|
||
* Label of the user menu entry that switches to this mode.
|
||
*/
|
||
public function switchLabel(): string
|
||
{
|
||
return match ($this) {
|
||
self::Simple => 'Zur einfachen Ansicht wechseln',
|
||
self::Expert => 'Zur Expertenansicht wechseln',
|
||
};
|
||
}
|
||
|
||
public function other(): self
|
||
{
|
||
return $this === self::Simple ? self::Expert : self::Simple;
|
||
}
|
||
}
|