b2in/app/Livewire/Cabinet/QuickStatus.php
Kevin Adametz 6c6d683b9a Display CMS Optimierungen 29-05-2026
- Mediathek: Video-Vorschaubilder statt Icons (FFmpeg-Thumbnails + Backfill-Command), Kategorie "Sonstiges"
- B2in Media-Picker zeigt alle Medientypen, Typ wird automatisch erkannt; Thumbnail-Preview vor allen Medien-URL-Feldern
- B2in Marke/Footer: Footer ein/aus, Logo+Claim frei positionierbar (Ecken) mit Constraints, separate Anzeige-Schalter
- Angebote-Modul dynamisch: kein Slide-Typ mehr, einheitliches Detail-Layout mit ein-/ausblendbaren Bloecken, Logo/Brand pro Slide, Streichpreis-Option
- Player: leere Module stoppen Endlosschleife, dynamische Layout-Anpassung bei verstecktem Footer/Header
- Fix: Script-Ladereihenfolge (Livewire vor Flux), entfernte stale public/flux/flux.js, Modal-Crash beim Aktualisieren behoben

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-29 15:57:33 +00:00

116 lines
3.2 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace App\Livewire\Cabinet;
use App\Models\CabinetTabletSetting;
use Livewire\Component;
class QuickStatus extends Component
{
public bool $authorized = false;
public string $storeStatus = 'auto';
public string $noticeHeadline = '';
public string $noticeSubtext = '';
public bool $saved = false;
/** @var array<string, array{label: string, color: string, icon: string, description: string}> */
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');
}
}