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
@@ -2,19 +2,34 @@
|
||||
|
||||
namespace App\Actions;
|
||||
|
||||
use App\Enums\BlockedPeriodPurpose;
|
||||
use App\Enums\OccupationKind;
|
||||
use App\Models\BlockedPeriod;
|
||||
use App\Models\Channel;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
|
||||
class ClassifyPortalOccupation
|
||||
{
|
||||
public function handle(BlockedPeriod $occupation, OccupationKind $kind, ?int $originId = null): void
|
||||
/** @param array{block_purpose?: BlockedPeriodPurpose|string|null, block_note?: string|null, is_private?: bool} $details */
|
||||
public function handle(BlockedPeriod $occupation, OccupationKind $kind, ?int $originId = null, array $details = []): void
|
||||
{
|
||||
Gate::authorize('update', $occupation);
|
||||
DB::transaction(function () use ($occupation, $kind, $originId): void {
|
||||
if (($details['block_purpose'] ?? null) instanceof BlockedPeriodPurpose) {
|
||||
$details['block_purpose'] = $details['block_purpose']->value;
|
||||
}
|
||||
$details = Validator::make($details, [
|
||||
'block_purpose' => ['nullable', Rule::enum(BlockedPeriodPurpose::class)],
|
||||
'block_note' => ['nullable', 'string', 'max:255'],
|
||||
'is_private' => ['sometimes', 'boolean'],
|
||||
])->validate();
|
||||
if (($details['is_private'] ?? false) && $originId !== null) {
|
||||
throw ValidationException::withMessages(['origin_channel_id' => 'Privat und ein externer Buchungskanal können nicht gleichzeitig gewählt werden.']);
|
||||
}
|
||||
DB::transaction(function () use ($occupation, $kind, $originId, $details): void {
|
||||
$record = BlockedPeriod::query()->whereKey($occupation->id)->lockForUpdate()->firstOrFail();
|
||||
if (! in_array($record->source, ['channel', 'email'], true) || $record->is_representation) {
|
||||
throw ValidationException::withMessages(['occupation_kind' => 'Nur eigenständige Portalereignisse können hier eingeordnet werden.']);
|
||||
@@ -22,7 +37,13 @@ public function handle(BlockedPeriod $occupation, OccupationKind $kind, ?int $or
|
||||
if ($originId !== null && ! Channel::query()->where('property_id', $record->property_id)->whereKey($originId)->exists()) {
|
||||
throw ValidationException::withMessages(['origin_channel_id' => 'Der Ursprungskanal muss zur selben Wohnung gehören.']);
|
||||
}
|
||||
$record->forceFill(['occupation_kind' => $kind, 'origin_channel_id' => $originId])->save();
|
||||
$record->forceFill([
|
||||
'occupation_kind' => $kind,
|
||||
'origin_channel_id' => $originId,
|
||||
'is_private' => $details['is_private'] ?? false,
|
||||
'block_purpose' => $kind === OccupationKind::Block ? (array_key_exists('block_purpose', $details) ? $details['block_purpose'] : $record->block_purpose) : null,
|
||||
'block_note' => $kind === OccupationKind::Block ? (array_key_exists('block_note', $details) ? $details['block_note'] : $record->block_note) : null,
|
||||
])->save();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ public function handle(BlockedPeriod $block, string $resolution, ?int $targetId
|
||||
throw ValidationException::withMessages(['origin_channel_id' => 'Der Ursprungskanal muss zur selben Wohnung gehören.']);
|
||||
}
|
||||
$attributes = ['is_representation' => false, 'canonical_block_id' => null, 'linked_booking_id' => null,
|
||||
'origin_channel_id' => $originId, 'export_approved' => true, 'needs_review' => false,
|
||||
'origin_channel_id' => $originId, 'is_private' => $originId === null && $block->is_private, 'export_approved' => true, 'needs_review' => false,
|
||||
'reviewed_at' => now(), 'review_note' => 'Als eigenständige Belegung persönlich bestätigt.'];
|
||||
if ($resolution !== 'independent') {
|
||||
$query = $resolution === 'booking' ? Booking::query()->occupying() : BlockedPeriod::query()->occupying()->whereKeyNot($block->id);
|
||||
|
||||
@@ -50,7 +50,7 @@ public function records(?int $propertyId = null, ?int $guestId = null, bool $inc
|
||||
'guest_url' => $booking->guest_id ? GuestResource::getUrl('edit', ['record' => $booking->guest_id]) : null,
|
||||
]);
|
||||
}
|
||||
$blocks = BlockedPeriod::query()->select(['id', 'tenant_id', 'property_id', 'guest_id', 'channel_id', 'origin_channel_id', 'starts_on', 'ends_on', 'reason', 'source', 'occupation_kind', 'ical_event_type', 'ical_interpretation', 'is_representation', 'needs_review', 'review_note', 'deleted_at'])->withTrashed()->occupying()->with(['guest', 'property', 'channel', 'originChannel'])->withCount('channelRepresentations')
|
||||
$blocks = BlockedPeriod::query()->select(['id', 'tenant_id', 'property_id', 'guest_id', 'channel_id', 'origin_channel_id', 'starts_on', 'ends_on', 'reason', 'source', 'occupation_kind', 'block_purpose', 'block_note', 'is_private', 'ical_event_type', 'ical_interpretation', 'is_representation', 'needs_review', 'review_note', 'deleted_at'])->withTrashed()->occupying()->with(['guest', 'property', 'channel', 'originChannel'])->withCount('channelRepresentations')
|
||||
->when(! $includeBlocks, fn ($query) => $query->reservations())
|
||||
->when($propertyId, fn ($query) => $query->where('property_id', $propertyId))
|
||||
->when($guestId, fn ($query) => $query->where('guest_id', $guestId)->reservations())
|
||||
@@ -68,10 +68,10 @@ public function records(?int $propertyId = null, ?int $guestId = null, bool $inc
|
||||
'nights' => (int) $block->starts_on->diffInDays($block->ends_on), 'persons' => null, 'total' => null,
|
||||
'guest_id' => $block->guest_id, 'guest' => $block->guestName() ?? 'Gastzuordnung offen',
|
||||
'guest_email' => $block->guest?->email, 'guest_assigned' => $block->guest_id !== null,
|
||||
'source' => $block->originChannel?->name ?? $block->channel?->name ?? ($block->source === 'manual' ? 'Eigene Sperre' : 'Ursprung unbekannt'),
|
||||
'source' => $block->bookingChannelLabel(),
|
||||
'status' => $block->trashed() ? 'Nicht mehr im Kalenderfeed' : ($block->needs_review ? 'Klärung erforderlich' : 'Im Kalender geführt'),
|
||||
'status_key' => $block->trashed() ? 'archived' : 'imported', 'color' => $block->needs_review ? 'warning' : $kind->getColor(),
|
||||
'occupies' => ! $block->trashed(), 'needs_review' => $block->needs_review, 'review_note' => $block->review_note, 'reason' => $block->reason,
|
||||
'occupies' => ! $block->trashed(), 'needs_review' => $block->needs_review, 'review_note' => $block->review_note, 'reason' => $block->blockDescription(),
|
||||
'archived' => $block->trashed(), 'representations' => $block->channel_representations_count,
|
||||
'url' => $block->source === 'manual' ? BlockedPeriodResource::getUrl() : PortalOccupationResource::getUrl('view', ['record' => $block->id]),
|
||||
'guest_url' => $block->guest_id ? GuestResource::getUrl('edit', ['record' => $block->guest_id]) : null,
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
use Filament\Support\Contracts\HasLabel;
|
||||
|
||||
enum BlockedPeriodPurpose: string implements HasLabel
|
||||
{
|
||||
case OwnUse = 'own_use';
|
||||
case Maintenance = 'maintenance';
|
||||
case Other = 'other';
|
||||
|
||||
public function getLabel(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::OwnUse => 'Eigenbelegung',
|
||||
self::Maintenance => 'Wartung / Renovierung',
|
||||
self::Other => 'Sonstige Sperre',
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -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'),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Components\Utilities\Get;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
@@ -83,24 +84,35 @@ public static function occupationActions(): array
|
||||
{
|
||||
return [
|
||||
AssignGuestAction::make(),
|
||||
Action::make('classify')->label('Belegungsart festlegen')
|
||||
->visible(fn (BlockedPeriod $record): bool => ! $record->is_representation && ! $record->trashed())
|
||||
->authorize(fn (BlockedPeriod $record): bool => auth()->user()?->can('update', $record) ?? false)
|
||||
->modalDescription('Nur bekannte Sachverhalte bestätigen. Die Einordnung ändert keine Termine, hebt keine Sperre auf und führt keine Ereignisse automatisch zusammen. Überschneidungen bleiben gesonderte Prüffälle.')
|
||||
->fillForm(fn (BlockedPeriod $record): array => ['occupation_kind' => $record->occupationKind()->value, 'origin_channel_id' => $record->origin_channel_id])
|
||||
->schema([
|
||||
Select::make('occupation_kind')->label('Fachliche Einordnung')->options(OccupationKind::class)->required(),
|
||||
Select::make('origin_channel_id')->label('Buchungskanal, sofern persönlich bekannt')->placeholder('Unbekannt')
|
||||
->options(fn (BlockedPeriod $record): array => Channel::query()->where('property_id', $record->property_id)->pluck('name', 'id')->all()),
|
||||
])->action(function (BlockedPeriod $record, array $data, ClassifyPortalOccupation $classify): void {
|
||||
$classify->handle($record, $data['occupation_kind'] instanceof OccupationKind ? $data['occupation_kind'] : OccupationKind::from($data['occupation_kind']), filled($data['origin_channel_id'] ?? null) ? (int) $data['origin_channel_id'] : null);
|
||||
$record->refresh();
|
||||
Notification::make()->title('Belegungsart gespeichert')->success()->send();
|
||||
}),
|
||||
static::classificationAction(),
|
||||
...BlockedPeriodResource::portalActions(),
|
||||
];
|
||||
}
|
||||
|
||||
public static function classificationAction(): Action
|
||||
{
|
||||
return Action::make('classify')->label('Belegungsart / Zweck bearbeiten')
|
||||
->visible(fn (BlockedPeriod $record): bool => in_array($record->source, ['channel', 'email'], true) && ! $record->is_representation && ! $record->trashed())
|
||||
->authorize(fn (BlockedPeriod $record): bool => auth()->user()?->can('update', $record) ?? false)
|
||||
->modalDescription('Nur bekannte Sachverhalte bestätigen. Die Einordnung ändert keine Termine, hebt keine Sperre auf und führt keine Ereignisse automatisch zusammen. Überschneidungen bleiben gesonderte Prüffälle.')
|
||||
->fillForm(fn (BlockedPeriod $record): array => ['occupation_kind' => $record->occupationKind()->value, 'origin_channel_id' => $record->is_private ? 'private' : $record->origin_channel_id, 'block_purpose' => $record->block_purpose?->value, 'block_note' => $record->block_note])
|
||||
->schema([
|
||||
Select::make('occupation_kind')->label('Fachliche Einordnung')->options(OccupationKind::class)->required()->live(),
|
||||
Section::make('Zweck der Sperrzeit')->columns(2)->schema(BlockedPeriodResource::purposeFields())
|
||||
->visible(fn (Get $get): bool => in_array($get('occupation_kind'), [OccupationKind::Block, OccupationKind::Block->value], true)),
|
||||
Select::make('origin_channel_id')->label('Buchungskanal, sofern persönlich bekannt')->placeholder('Unbekannt')
|
||||
->helperText('Privat bezeichnet den fachlichen Ursprung. Der Importkanal bleibt als Kalenderquelle erhalten.')
|
||||
->options(fn (BlockedPeriod $record): array => ['private' => 'Privat'] + Channel::query()->where('property_id', $record->property_id)->pluck('name', 'id')->all()),
|
||||
])->action(function (BlockedPeriod $record, array $data, ClassifyPortalOccupation $classify): void {
|
||||
$private = ($data['origin_channel_id'] ?? null) === 'private';
|
||||
$classify->handle($record, $data['occupation_kind'] instanceof OccupationKind ? $data['occupation_kind'] : OccupationKind::from($data['occupation_kind']), ! $private && filled($data['origin_channel_id'] ?? null) ? (int) $data['origin_channel_id'] : null, [
|
||||
'block_purpose' => $data['block_purpose'] ?? null, 'block_note' => $data['block_note'] ?? null, 'is_private' => $private,
|
||||
]);
|
||||
$record->refresh();
|
||||
Notification::make()->title('Belegungsart gespeichert')->success()->send();
|
||||
});
|
||||
}
|
||||
|
||||
public static function infolist(Schema $schema): Schema
|
||||
{
|
||||
return $schema->components([
|
||||
@@ -109,7 +121,9 @@ public static function infolist(Schema $schema): Schema
|
||||
TextEntry::make('starts_on')->label('Anreise / Beginn')->date('d.m.Y'),
|
||||
TextEntry::make('ends_on')->label('Abreise / erster freier Tag')->date('d.m.Y'),
|
||||
TextEntry::make('kind')->label('Einordnung')->state(fn (BlockedPeriod $record): string => $record->occupationKind()->getLabel()),
|
||||
TextEntry::make('originChannel.name')->label('Bestätigter Buchungskanal')->placeholder('Unbekannt'),
|
||||
TextEntry::make('booking_channel')->label('Buchungskanal')->state(fn (BlockedPeriod $record): string => $record->bookingChannelLabel()),
|
||||
TextEntry::make('block_description')->label('Zweck / Grund der Sperrzeit')->state(fn (BlockedPeriod $record): ?string => $record->blockDescription())
|
||||
->visible(fn (BlockedPeriod $record): bool => $record->occupationKind() === OccupationKind::Block)->placeholder('Noch nicht angegeben'),
|
||||
TextEntry::make('channel.name')->label('Importiert über'),
|
||||
TextEntry::make('guest_name')->label('Gast / Namensinformation')->state(fn (BlockedPeriod $record): ?string => $record->guestName())->placeholder('Unbekannt')
|
||||
->url(fn (BlockedPeriod $record): ?string => $record->assignedGuest() ? GuestResource::getUrl('edit', ['record' => $record->assignedGuest()->id]) : null),
|
||||
|
||||
+9
-1
@@ -2,11 +2,14 @@
|
||||
|
||||
namespace App\Filament\Resources\Properties\RelationManagers;
|
||||
|
||||
use App\Filament\Resources\BlockedPeriods\BlockedPeriodResource;
|
||||
use App\Filament\Resources\PortalOccupations\PortalOccupationResource;
|
||||
use App\Models\BlockedPeriod;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\DatePicker;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Resources\RelationManagers\RelationManager;
|
||||
use Filament\Schemas\Schema;
|
||||
@@ -42,6 +45,9 @@ public function form(Schema $schema): Schema
|
||||
->placeholder('z. B. Eigennutzung, Renovierung')
|
||||
->maxLength(255)
|
||||
->columnSpanFull(),
|
||||
...BlockedPeriodResource::purposeFields(),
|
||||
Select::make('is_private')->label('Buchungskanal')->options([0 => 'Nicht angegeben', 1 => 'Privat'])
|
||||
->default(0)->formatStateUsing(fn (mixed $state): int => (int) $state)->required(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -55,7 +61,8 @@ public function table(Table $table): Table
|
||||
->columns([
|
||||
TextColumn::make('starts_on')->label('Von')->date('D, d.m.Y'),
|
||||
TextColumn::make('ends_on')->label('Bis')->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('source')->label('Quelle'),
|
||||
])
|
||||
->filters([
|
||||
@@ -69,6 +76,7 @@ public function table(Table $table): Table
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make()->visible(fn (BlockedPeriod $record): bool => $record->source === 'manual'),
|
||||
PortalOccupationResource::classificationAction(),
|
||||
DeleteAction::make()->visible(fn (BlockedPeriod $record): bool => $record->source === 'manual'),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\BlockedPeriodPurpose;
|
||||
use App\Enums\OccupationKind;
|
||||
use App\Models\Concerns\BelongsToTenant;
|
||||
use App\Models\Concerns\HasChannelProvenance;
|
||||
@@ -25,7 +26,7 @@
|
||||
*/
|
||||
#[ObservedBy(BlockedPeriodObserver::class)]
|
||||
#[Hidden(['ical_properties', 'ical_raw', 'ical_interpretation'])]
|
||||
#[Fillable(['property_id', 'channel_id', 'origin_channel_id', 'guest_id', 'occupation_kind', 'starts_on', 'ends_on', 'reason', 'source', 'external_uid', 'needs_review', 'review_note', 'missing_imports', 'is_representation', 'canonical_block_id', 'linked_booking_id', 'export_approved', 'reviewed_at'])]
|
||||
#[Fillable(['property_id', 'channel_id', 'origin_channel_id', 'guest_id', 'occupation_kind', 'block_purpose', 'block_note', 'is_private', 'starts_on', 'ends_on', 'reason', 'source', 'external_uid', 'needs_review', 'review_note', 'missing_imports', 'is_representation', 'canonical_block_id', 'linked_booking_id', 'export_approved', 'reviewed_at'])]
|
||||
class BlockedPeriod extends Model
|
||||
{
|
||||
/** @use HasFactory<BlockedPeriodFactory> */
|
||||
@@ -41,6 +42,8 @@ class BlockedPeriod extends Model
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'block_purpose' => BlockedPeriodPurpose::class,
|
||||
'is_private' => 'boolean',
|
||||
'occupation_kind' => OccupationKind::class,
|
||||
'starts_on' => 'immutable_date',
|
||||
'ends_on' => 'immutable_date',
|
||||
@@ -114,6 +117,20 @@ public function guestName(): ?string
|
||||
return $this->guest?->full_name ?? ($this->ical_interpretation['fields']['guest_full_name'] ?? $this->ical_interpretation['fields']['guest_first_name'] ?? null);
|
||||
}
|
||||
|
||||
public function bookingChannelLabel(): string
|
||||
{
|
||||
return $this->is_private ? 'Privat' : ($this->originChannel?->name ?? $this->channel?->name ?? ($this->source === 'manual' ? 'Eigene Sperre' : 'Ursprung unbekannt'));
|
||||
}
|
||||
|
||||
public function blockDescription(): ?string
|
||||
{
|
||||
if ($this->occupationKind() !== OccupationKind::Block) {
|
||||
return $this->reason;
|
||||
}
|
||||
|
||||
return collect([$this->block_purpose?->getLabel(), $this->block_note])->filter()->implode(' · ') ?: $this->reason;
|
||||
}
|
||||
|
||||
public function assignedGuest(): ?Guest
|
||||
{
|
||||
return $this->is_representation ? ($this->linkedBooking?->guest ?? $this->canonicalBlock?->assignedGuest()) : $this->guest;
|
||||
|
||||
Reference in new issue
Block a user