*/ public array $statusOptions = [ 'auto' => [ 'label' => 'Automatisch', 'color' => 'green', 'icon' => '✓', 'description' => 'Status aus Öffnungszeiten', ], 'closed' => [ 'label' => 'Geschlossen', 'color' => 'yellow', 'icon' => '–', 'description' => 'Manuell geschlossen', ], 'notice' => [ 'label' => 'Hinweis', 'color' => 'orange', 'icon' => '!', 'description' => 'Info-Nachricht anzeigen', ], 'warning' => [ 'label' => 'Warnung', 'color' => 'red', 'icon' => '!', 'description' => 'Dringende Warnung', ], ]; public function mount(?string $k = null): void { $validKey = config('domains.cabinet_status_key'); $key = $k ?? request()->query('k'); if (! $validKey || $key !== $validKey) { $this->authorized = false; return; } $this->authorized = true; $settings = CabinetTabletSetting::current(); $this->storeStatus = $settings->store_status ?? 'auto'; $this->noticeHeadline = $settings->notice_headline ?? ''; $this->noticeSubtext = $settings->notice_subtext ?? ''; } public function selectStatus(string $status): void { if (! $this->authorized) { return; } if (! array_key_exists($status, $this->statusOptions)) { return; } $this->storeStatus = $status; $this->saved = false; } public function save(): void { if (! $this->authorized) { return; } $this->validate([ 'storeStatus' => 'required|in:auto,notice,warning,closed', 'noticeHeadline' => 'nullable|string|max:40', 'noticeSubtext' => 'nullable|string|max:80', ], [ 'storeStatus.in' => 'Ungültiger Status.', 'noticeHeadline.max' => 'Headline max. 40 Zeichen.', 'noticeSubtext.max' => 'Subtext max. 80 Zeichen.', ]); $showsNotice = in_array($this->storeStatus, ['notice', 'warning'], true); if (! $showsNotice) { $this->noticeHeadline = ''; $this->noticeSubtext = ''; } CabinetTabletSetting::current()->update([ 'store_status' => $this->storeStatus, 'notice_headline' => $this->noticeHeadline ?: null, 'notice_subtext' => $this->noticeSubtext ?: null, ]); $this->saved = true; } public function render(): \Illuminate\View\View { return view('livewire.cabinet.quick-status') ->layout('layouts.cabinet-quick'); } }