Sperrzeiten um Eigenbelegung und privaten Buchungskanal erweitern
Deploy FeWo mit PipelineManager / deploy (push) Successful in 2m49s
Deploy FeWo mit PipelineManager / deploy (push) Successful in 2m49s
This commit is contained in:
1 parent
2b2e732612
commit
4389894959
12 files changed
+305
-28
No files matched your search
@@ -4,6 +4,7 @@
|
||||
|
||||
use App\Actions\ResolveChannelOccupation;
|
||||
use App\Channels\ICal\ICalRuleEngine;
|
||||
use App\Enums\BlockedPeriodPurpose;
|
||||
use App\Filament\Concerns\FollowsAdminMode;
|
||||
use App\Filament\Resources\BlockedPeriods\Pages\ManageBlockedPeriods;
|
||||
use App\Filament\Resources\PortalOccupations\PortalOccupationResource;
|
||||
@@ -32,7 +33,7 @@
|
||||
|
||||
/**
|
||||
* Explicit blocks of all apartments. Imported reservations and unresolved periods have their own views.
|
||||
* Portal and e-mail blocks are maintained by the sync and can only be viewed here.
|
||||
* Portal dates remain maintained by the sync; business classification can be edited separately.
|
||||
*/
|
||||
class BlockedPeriodResource extends Resource
|
||||
{
|
||||
@@ -65,8 +66,11 @@ public static function form(Schema $schema): Schema
|
||||
->dehydratedWhenHidden(),
|
||||
DatePicker::make('starts_on')->label('Von (erste gesperrte Nacht)')->required(),
|
||||
DatePicker::make('ends_on')->label('Bis (erster freier Tag)')->after('starts_on')->required(),
|
||||
...static::purposeFields(),
|
||||
Select::make('is_private')->label('Buchungskanal')->options([0 => 'Nicht angegeben', 1 => 'Privat'])
|
||||
->default(0)->formatStateUsing(fn (mixed $state): int => (int) $state)->required(),
|
||||
TextInput::make('reason')
|
||||
->label('Grund')
|
||||
->label('Bisheriger Sperrgrund / zusätzliche Angabe')
|
||||
->placeholder('z. B. Eigennutzung, Renovierung')
|
||||
->maxLength(255)
|
||||
->columnSpanFull(),
|
||||
@@ -78,6 +82,15 @@ public static function getEloquentQuery(): Builder
|
||||
return parent::getEloquentQuery()->explicitBlocks()->occupying();
|
||||
}
|
||||
|
||||
/** @return array<Select|TextInput> */
|
||||
public static function purposeFields(): array
|
||||
{
|
||||
return [
|
||||
Select::make('block_purpose')->label('Zweck der Sperrzeit')->options(BlockedPeriodPurpose::class)->placeholder('Noch nicht angegeben'),
|
||||
TextInput::make('block_note')->label('Hinweis zum Zweck')->maxLength(255)->placeholder('z. B. Aufenthalt der Familie'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
@@ -86,7 +99,8 @@ public static function table(Table $table): Table
|
||||
->columns([
|
||||
TextColumn::make('starts_on')->label('Von')->date('D, d.m.Y')->sortable(),
|
||||
TextColumn::make('ends_on')->label('Bis / erster freier Tag')->date('D, d.m.Y'),
|
||||
TextColumn::make('reason')->label('Grund')->placeholder('–'),
|
||||
TextColumn::make('purpose')->label('Zweck / Grund')->state(fn (BlockedPeriod $record): ?string => $record->blockDescription())->placeholder('–'),
|
||||
TextColumn::make('booking_channel')->label('Buchungskanal')->state(fn (BlockedPeriod $record): string => $record->bookingChannelLabel()),
|
||||
TextColumn::make('property.name')->label('Wohnung'),
|
||||
TextColumn::make('channel.name')->label('Kalenderquelle')->placeholder('Eigene Sperre'),
|
||||
])
|
||||
@@ -98,6 +112,7 @@ public static function table(Table $table): Table
|
||||
Action::make('viewPortal')->label('Details')->visible(fn (BlockedPeriod $record): bool => $record->source !== 'manual')
|
||||
->url(fn (BlockedPeriod $record): string => PortalOccupationResource::getUrl('view', ['record' => $record->id])),
|
||||
EditAction::make()->visible(fn (BlockedPeriod $record): bool => $record->source === 'manual'),
|
||||
PortalOccupationResource::classificationAction(),
|
||||
DeleteAction::make()->visible(fn (BlockedPeriod $record): bool => $record->source === 'manual'),
|
||||
]);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user