user()?->hasRole(UserRole::Admin, UserRole::Rentals); } public function mount(): void { $this->propertyId ??= Property::query()->where('is_active', true)->value('id') ?? Property::query()->value('id'); } public function content(Schema $schema): Schema { $property = Property::find($this->propertyId); if ($property === null) { return $schema->components([Text::make('Es ist noch keine Wohnung angelegt (Expertenansicht › Wohnungen).')]); } $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([ Tab::make('Saisons & Preise')->icon(Heroicon::OutlinedCalendar)->schema([ Livewire::make(SeasonsRelationManager::class, $context)->key("seasons-{$property->id}"), ]), Tab::make('Sonderangebote & Rabattcodes')->icon(Heroicon::OutlinedSparkles)->schema([ Livewire::make(SpecialOffersRelationManager::class, $context)->key("offers-{$property->id}"), ]), Tab::make('Extras')->icon(Heroicon::OutlinedGift)->schema([ Livewire::make(ExtrasRelationManager::class, $context)->key("extras-{$property->id}"), ]), ]), ]); } }