Admin accounts with simple/expert mode, blocked periods list, brand assets, decisions
- 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>
This commit is contained in:
1 parent
7d0bc93abc
commit
82698f8eda
65 files changed
+1154
-5
No files matched your search
@@ -2,8 +2,12 @@
|
||||
|
||||
namespace App\Providers\Filament;
|
||||
|
||||
use App\Enums\AdminMode;
|
||||
use App\Http\Middleware\RequireTwoFactorForAdmins;
|
||||
use App\Models\User;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Auth\MultiFactor\App\AppAuthentication;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Http\Middleware\Authenticate;
|
||||
use Filament\Http\Middleware\AuthenticateSession;
|
||||
use Filament\Http\Middleware\DisableBladeIconComponents;
|
||||
@@ -12,6 +16,7 @@
|
||||
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;
|
||||
use Illuminate\Cookie\Middleware\EncryptCookies;
|
||||
@@ -22,6 +27,13 @@
|
||||
|
||||
class AdminPanelProvider extends PanelProvider
|
||||
{
|
||||
private static function currentUser(): ?User
|
||||
{
|
||||
$user = Filament::auth()->user();
|
||||
|
||||
return $user instanceof User ? $user : null;
|
||||
}
|
||||
|
||||
public function panel(Panel $panel): Panel
|
||||
{
|
||||
return $panel
|
||||
@@ -36,6 +48,17 @@ public function panel(Panel $panel): Panel
|
||||
isRequired: true,
|
||||
)
|
||||
->multiFactorAuthenticationRequiredMiddlewareName(RequireTwoFactorForAdmins::class)
|
||||
->userMenuItems([
|
||||
'admin-mode' => Action::make('switchAdminMode')
|
||||
->label(fn (): string => (self::currentUser()?->adminMode() ?? AdminMode::Expert)->other()->switchLabel())
|
||||
->icon(fn (): Heroicon => self::currentUser()?->adminMode() === AdminMode::Simple ? Heroicon::OutlinedAdjustmentsHorizontal : Heroicon::OutlinedSparkles)
|
||||
->action(function () {
|
||||
$user = self::currentUser();
|
||||
$user?->forceFill(['admin_mode' => $user->adminMode()->other()])->save();
|
||||
|
||||
return redirect(url()->previous());
|
||||
}),
|
||||
])
|
||||
->brandName('FeWo Stommer · Verwaltung')
|
||||
->navigationGroups(['Vermietung', 'Webseite', 'System'])
|
||||
->colors([
|
||||
|
||||
Reference in new issue
Block a user