Wohnungsumschalter im Verwaltungsmenue und wohnungsbezogene Listen

Oben im Seitenmenue waehlt man die Wohnung; Listen, neue Eintraege, Belegungsplan
und Preise & Angebote folgen ihr. Ein geoeffneter Eintrag einer anderen Wohnung
schaltet auf diese um. Galerie und Ersatz-Titelbild der Website zeigen nur Fotos
der Wohnung des Bausteins und Fotos ohne Wohnung.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Opus 5.5 committed 2026-10-29 18:40:13 +01:00
1 parent e74033a958
commit 8bcda9a4bc
37 files changed
+520 -35

No files matched your search

+7 -1
View File
@@ -6,6 +6,7 @@
use App\Filament\Concerns\FollowsAdminMode;
use App\Models\Booking;
use App\Models\Property;
use App\Support\CurrentProperty;
use BackedEnum;
use Carbon\CarbonImmutable;
use Filament\Pages\Page;
@@ -45,10 +46,15 @@ public static function canAccess(): bool
return Gate::allows('viewAny', Booking::class);
}
public function getSubheading(): ?string
{
return app(CurrentProperty::class)->hasChoice() ? Property::query()->find($this->propertyId)?->name : null;
}
public function mount(): void
{
$this->month = $this->month ?: now()->format('Y-m');
$this->propertyId ??= Property::query()->where('is_active', true)->value('id') ?? Property::query()->value('id');
$this->propertyId = app(CurrentProperty::class)->followUrl($this->propertyId);
}
#[Computed]
+7 -8
View File
@@ -9,8 +9,8 @@
use App\Filament\Resources\Properties\RelationManagers\SeasonsRelationManager;
use App\Filament\Resources\Properties\RelationManagers\SpecialOffersRelationManager;
use App\Models\Property;
use App\Support\CurrentProperty;
use BackedEnum;
use Filament\Forms\Components\Select;
use Filament\Pages\Page;
use Filament\Schemas\Components\Livewire;
use Filament\Schemas\Components\Tabs;
@@ -49,9 +49,14 @@ public static function canAccess(): bool
return (bool) auth()->user()?->hasRole(UserRole::Admin, UserRole::Rentals);
}
public function getSubheading(): ?string
{
return app(CurrentProperty::class)->hasChoice() ? Property::query()->find($this->propertyId)?->name : null;
}
public function mount(): void
{
$this->propertyId ??= Property::query()->where('is_active', true)->value('id') ?? Property::query()->value('id');
$this->propertyId = app(CurrentProperty::class)->followUrl($this->propertyId);
}
public function content(Schema $schema): Schema
@@ -64,12 +69,6 @@ public function content(Schema $schema): Schema
$context = ['ownerRecord' => $property, 'pageClass' => EditProperty::class];
return $schema->components([
Select::make('propertyId')
->label('Wohnung')
->options(fn (): array => Property::query()->orderBy('name')->pluck('name', 'id')->all())
->live()
->afterStateUpdated(fn () => $this->redirect(static::getUrl(['wohnung' => $this->propertyId])))
->visible(fn (): bool => Property::query()->count() > 1),
Tabs::make('prices')
->persistTabInQueryString()
->tabs([