Ein Eingang fuer alle Kanaele (Paket 4, Prozessarchitektur v0.10)
Portalbuchungen und -anfragen aus Kalender und Mail werden ueber PortalIntake zum Vorgang (nur bei sicherer Erkennung), Dubletten ueber Buchungsnummer, gleiches Portal mit gleichen Naechten und Spiegelung; Unsicheres wird geklaert. Portalstorno und -aenderung als Aufgabe am Vorgang ohne stille Stornierung. Schalter je Kanal (Aus als Standard, Beobachten, Anlegen, Anlegen + weiter), Eingangsprotokoll, Bestandsuebernahme mit Vorschau/Bericht/Ruecknahme, Sperrnachweis in drei Stufen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
cf11c8a474
commit
ac9d20b812
29 files changed
+1952
-16
No files matched your search
@@ -9,7 +9,9 @@
|
||||
use App\Enums\ProcessingMode;
|
||||
use App\Enums\ProcessSetting;
|
||||
use App\Enums\Responsibility;
|
||||
use App\Models\BlockedPeriod;
|
||||
use App\Models\Booking;
|
||||
use App\Models\IntakeObservation;
|
||||
use App\Models\User;
|
||||
use App\Process\CaseActivities;
|
||||
use App\Process\CaseAutomation;
|
||||
@@ -123,6 +125,7 @@ public static function configure(Schema $schema): Schema
|
||||
TextEntry::make('status')->label('Status')->badge(),
|
||||
TextEntry::make('case_type')->label('Vorgangsart')->state(fn (Booking $record): string => strtoupper($record->caseType()->value).' – '.$record->caseType()->getLabel()),
|
||||
TextEntry::make('intake')->label('Eingangsart')->state(fn (Booking $record): string => $record->intake?->getLabel() ?? '–'),
|
||||
TextEntry::make('sources')->label('Quellen und Kalenderdarstellungen')->state(fn (Booking $record): HtmlString => self::sources($record))->html()->columnSpanFull(),
|
||||
TextEntry::make('profile')->label('Abwicklungsprofil (eingefroren)')->state(fn (Booking $record): HtmlString => self::profile($record))->html()->columnSpanFull(),
|
||||
TextEntry::make('hold_expires_at')->label('Reserviert bis')->dateTime('d.m.Y, H:i')->placeholder('–'),
|
||||
TextEntry::make('offer_hash')->label('Angebot (Prüfsumme)')->state(fn (Booking $record): ?string => $record->offer_version > 0 ? 'Version '.$record->offer_version.' · '.substr((string) $record->offer_hash, 0, 16) : null)->placeholder('–'),
|
||||
@@ -161,6 +164,22 @@ private static function nextStep(Booking $booking): HtmlString
|
||||
.'<div style="margin-top:.5rem;color:#6b7280;font-size:.9rem">'.$mode.'</div>');
|
||||
}
|
||||
|
||||
/**
|
||||
* Every portal entry (calendar or e-mail) that belongs to the case, and what the intake recorded about it.
|
||||
*/
|
||||
private static function sources(Booking $booking): HtmlString
|
||||
{
|
||||
$lines = BlockedPeriod::query()->withTrashed()->with('channel')->where('linked_booking_id', $booking->id)->orderBy('id')->get()
|
||||
->map(fn (BlockedPeriod $entry): string => e(($entry->source === 'email' ? 'E-Mail' : 'Kalender').' von '.($entry->channel?->name ?? '–').': '.$entry->starts_on->format('d.m.').'–'.$entry->ends_on->format('d.m.Y')
|
||||
.($entry->trashed() ? ' · nicht mehr im Kalender' : '').($entry->starts_on->equalTo($booking->arrival) && $entry->ends_on->equalTo($booking->departure) ? '' : ' · abweichende Termine').' · Kennung '.$entry->external_uid));
|
||||
$observations = IntakeObservation::query()->with('channel')->where('booking_id', $booking->id)->orderBy('occurred_at')->get()
|
||||
->map(fn (IntakeObservation $observation): string => e($observation->occurred_at->format('d.m.Y H:i').' · '.$observation->sourceLabel().' '.$observation->channel?->name.' · '.$observation->outcome->getLabel().($observation->applied ? '' : ' (nur protokolliert)')));
|
||||
|
||||
$html = $lines->isEmpty() ? 'Keine Portaleinträge zugeordnet.' : $lines->implode('<br>');
|
||||
|
||||
return new HtmlString($observations->isEmpty() ? $html : $html.'<br><span style="color:#6b7280">Eingang: '.$observations->implode('<br>').'</span>');
|
||||
}
|
||||
|
||||
/**
|
||||
* The documents made for the case, as recorded when they were created (kind, template, date).
|
||||
*/
|
||||
|
||||
@@ -2,9 +2,13 @@
|
||||
|
||||
namespace App\Filament\Resources\ChannelTasks\Tables;
|
||||
|
||||
use App\Enums\ChannelTaskAction;
|
||||
use App\Enums\ChannelTaskProof;
|
||||
use App\Enums\ChannelTaskStatus;
|
||||
use App\Models\ChannelTask;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Forms\Components\Radio;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
@@ -24,6 +28,8 @@ public static function configure(Table $table): Table
|
||||
TextColumn::make('reason')->label('Anlass')->wrap(),
|
||||
TextColumn::make('status')->label('Status')->badge()
|
||||
->description(fn (ChannelTask $record): ?string => $record->completed_by ? "{$record->completed_by}, {$record->completed_at?->format('d.m. H:i')}" : null),
|
||||
TextColumn::make('proof')->label('Nachweis')->state(fn (ChannelTask $record): string => $record->proofLabel())
|
||||
->description(fn (ChannelTask $record): ?string => $record->proof_by ? "{$record->proof_by}, {$record->proof_at?->format('d.m. H:i')}" : null)->wrap(),
|
||||
TextColumn::make('created_at')->label('Seit')->since(),
|
||||
TextColumn::make('automation_error')->label('Automatisierung')->placeholder('–')->limit(40)->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
@@ -45,7 +51,26 @@ public static function configure(Table $table): Table
|
||||
->icon(Heroicon::OutlinedCheck)
|
||||
->color('success')
|
||||
->visible(fn (ChannelTask $record): bool => $record->status === ChannelTaskStatus::Open)
|
||||
->action(fn (ChannelTask $record) => $record->complete(auth()->user()->name)),
|
||||
->modalHeading(fn (ChannelTask $record): string => ($record->action === ChannelTaskAction::Block ? 'Sperre in ' : 'Freigabe in ').$record->channel->name.' erledigt')
|
||||
->modalDescription('Was können Sie sagen? Ein bereitgestellter Kalender beweist nicht, dass das Portal ihn schon übernommen hat.')
|
||||
->fillForm(['proof' => ChannelTaskProof::Initiated->value])
|
||||
->schema(fn (ChannelTask $record): array => [
|
||||
Radio::make('proof')->hiddenLabel()->required()
|
||||
->options(collect(ChannelTaskProof::cases())->mapWithKeys(fn (ChannelTaskProof $proof): array => [$proof->value => $proof->question($record->action === ChannelTaskAction::Block)])->all()),
|
||||
Textarea::make('note')->label('Notiz (optional)')->placeholder('z. B. „im Vermieterkalender rot markiert“')->rows(2),
|
||||
])
|
||||
->action(fn (ChannelTask $record, array $data) => $record->complete(auth()->user()->name, ChannelTaskProof::from($data['proof']), $data['note'] ?? null)),
|
||||
Action::make('prove')
|
||||
->label('Nachweis ergänzen')
|
||||
->icon(Heroicon::OutlinedShieldCheck)
|
||||
->color('gray')
|
||||
->visible(fn (ChannelTask $record): bool => $record->status === ChannelTaskStatus::Done && $record->proof !== ChannelTaskProof::Confirmed)
|
||||
->schema(fn (ChannelTask $record): array => [
|
||||
Radio::make('proof')->hiddenLabel()->required()
|
||||
->options(collect([ChannelTaskProof::Observed, ChannelTaskProof::Confirmed])->mapWithKeys(fn (ChannelTaskProof $proof): array => [$proof->value => $proof->question($record->action === ChannelTaskAction::Block)])->all()),
|
||||
Textarea::make('note')->label('Notiz (optional)')->rows(2),
|
||||
])
|
||||
->action(fn (ChannelTask $record, array $data) => $record->prove(ChannelTaskProof::from($data['proof']), auth()->user()->name, $data['note'] ?? null)),
|
||||
Action::make('dismiss')
|
||||
->label('Verwerfen')
|
||||
->icon(Heroicon::OutlinedXMark)
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Filament\Resources\Channels\Schemas;
|
||||
|
||||
use App\Channels\ChannelRegistry;
|
||||
use App\Enums\CaseIntakeMode;
|
||||
use App\Enums\ChannelBookingModel;
|
||||
use App\Enums\ChannelEchoBehavior;
|
||||
use App\Enums\ChannelExportMode;
|
||||
@@ -55,6 +56,13 @@ public static function configure(Schema $schema, bool $selectProperty = false):
|
||||
Select::make('status')->label('Kanalstatus')->options(ChannelStatus::class)->default(ChannelStatus::Setup)->required(),
|
||||
Select::make('booking_model')->label('Was kommt über dieses Portal?')->options(ChannelBookingModel::class)->default(ChannelBookingModel::Mixed)->required()
|
||||
->helperText('„Portalbuchung“ und „Gemischt“ gelten als Sofortbuchung: automatische Angebote für diese Wohnung warten, bis das Portal unseren Kalender abgerufen hat. „Vermittlung / Anfrage“: keine Sofortbuchung.'),
|
||||
Select::make('case_intake')
|
||||
->label('Erkannte Buchungen automatisch als Vorgang übernehmen?')
|
||||
->options(CaseIntakeMode::class)
|
||||
->default(CaseIntakeMode::Off)
|
||||
->required()
|
||||
->helperText('Zuerst „Beobachten“: Dann entsteht nichts, aber das Eingangsprotokoll (Expertenansicht) zeigt, welche Vorgänge entstanden wären. Unklare Belegungen und Meldungen zu gebuchten Vorgängen erscheinen unter „Zu erledigen“. Unterlagen gehen nie ohne Ihre Freigabe hinaus.')
|
||||
->columnSpanFull(),
|
||||
...self::processSections(),
|
||||
Select::make('connector')
|
||||
->label('Kalenderanbindung')
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\IntakeObservations;
|
||||
|
||||
use App\Enums\CaseIntakeMode;
|
||||
use App\Enums\IntakeOutcome;
|
||||
use App\Filament\Concerns\FollowsAdminMode;
|
||||
use App\Filament\Resources\Bookings\BookingResource;
|
||||
use App\Filament\Resources\IntakeObservations\Pages\ListIntakeObservations;
|
||||
use App\Models\Channel;
|
||||
use App\Models\IntakeObservation;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
/**
|
||||
* The intake record (expert view): what came in over each portal, what the intake recognised, whether it acted or only
|
||||
* observed, and why. Read only – the work itself happens under "Zu erledigen" and on the case page.
|
||||
*/
|
||||
class IntakeObservationResource extends Resource
|
||||
{
|
||||
use FollowsAdminMode;
|
||||
|
||||
protected static ?string $model = IntakeObservation::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedInboxArrowDown;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'System';
|
||||
|
||||
protected static ?string $navigationLabel = 'Eingangsprotokoll';
|
||||
|
||||
protected static ?string $modelLabel = 'Eingang';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Eingangsprotokoll';
|
||||
|
||||
protected static ?int $navigationSort = 20;
|
||||
|
||||
public static function canCreate(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->description('Was über die Portale hereinkam und was daraus wurde. „Nur protokolliert“ heißt: Das Portal steht auf „Beobachten“ (oder es war nichts zu tun) – es ist nichts entstanden.')
|
||||
->defaultSort('occurred_at', 'desc')
|
||||
->modifyQueryUsing(fn ($query) => $query->with(['channel', 'booking']))
|
||||
->columns([
|
||||
TextColumn::make('occurred_at')->label('Wann')->dateTime('d.m.Y H:i')->sortable(),
|
||||
TextColumn::make('channel.name')->label('Portal')->description(fn (IntakeObservation $record): string => $record->sourceLabel()),
|
||||
TextColumn::make('period')->label('Zeitraum')->state(fn (IntakeObservation $record): ?string => $record->starts_on ? $record->starts_on->format('d.m.').'–'.$record->ends_on?->format('d.m.Y') : null)->placeholder('–'),
|
||||
TextColumn::make('outcome')->label('Ergebnis')->badge()->description(fn (IntakeObservation $record): string => implode(' ', (array) $record->reasons))->wrap(),
|
||||
TextColumn::make('case_type')->label('Art')->formatStateUsing(fn (?string $state): string => strtoupper((string) $state))->placeholder('–'),
|
||||
IconColumn::make('applied')->label('Ausgeführt')->boolean()->tooltip('Ja: Vorgang angelegt, zugeordnet, Aufgabe erstellt oder zur Klärung vorgelegt. Nein: nur protokolliert.'),
|
||||
TextColumn::make('mode')->label('Einstellung')->formatStateUsing(fn (CaseIntakeMode $state): string => match ($state) {
|
||||
CaseIntakeMode::Observe => 'Beobachten',
|
||||
CaseIntakeMode::Create => 'Anlegen',
|
||||
CaseIntakeMode::Continue => 'Anlegen + weiter',
|
||||
CaseIntakeMode::Off => 'Aus',
|
||||
})->toggleable(),
|
||||
TextColumn::make('reference')->label('Buchungsnr.')->placeholder('–')->toggleable(),
|
||||
TextColumn::make('booking.reference')->label('Vorgang')->placeholder('–')
|
||||
->url(fn (IntakeObservation $record): ?string => $record->booking ? BookingResource::getUrl('view', ['record' => $record->booking]) : null),
|
||||
TextColumn::make('missing')->label('Fehlt noch')->state(fn (IntakeObservation $record): string => implode(', ', (array) $record->missing))->placeholder('–')->wrap()->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
SelectFilter::make('channel_id')->label('Portal')->options(fn (): array => Channel::query()->orderBy('name')->pluck('name', 'id')->all()),
|
||||
SelectFilter::make('outcome')->label('Ergebnis')->options(IntakeOutcome::class),
|
||||
SelectFilter::make('applied')->label('Ausgeführt')->options(['1' => 'ja', '0' => 'nur protokolliert']),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return ['index' => ListIntakeObservations::route('/')];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\IntakeObservations\Pages;
|
||||
|
||||
use App\Filament\Resources\IntakeObservations\IntakeObservationResource;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListIntakeObservations extends ListRecords
|
||||
{
|
||||
protected static string $resource = IntakeObservationResource::class;
|
||||
}
|
||||
@@ -3,7 +3,9 @@
|
||||
namespace App\Filament\Resources\PortalOccupations\Pages;
|
||||
|
||||
use App\Filament\Resources\PortalOccupations\PortalOccupationResource;
|
||||
use Filament\Actions\ActionGroup;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
|
||||
class ViewPortalOccupation extends ViewRecord
|
||||
{
|
||||
@@ -16,6 +18,9 @@ public function getTitle(): string
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return PortalOccupationResource::occupationActions();
|
||||
$actions = PortalOccupationResource::occupationActions();
|
||||
[$primary, $more] = [array_slice($actions, 0, 3), array_slice($actions, 3)];
|
||||
|
||||
return [...$primary, ActionGroup::make($more)->label('Weitere Möglichkeiten')->icon(Heroicon::OutlinedEllipsisHorizontal)->button()->color('gray')];
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
use App\Actions\ClassifyPortalOccupation;
|
||||
use App\Actions\OpenPortalFile;
|
||||
use App\Actions\ResolveChannelOccupation;
|
||||
use App\Enums\OccupationKind;
|
||||
use App\Exceptions\ReservationException;
|
||||
use App\Filament\Actions\AssignGuestAction;
|
||||
@@ -15,11 +16,13 @@
|
||||
use App\Filament\Resources\PortalOccupations\Pages\ManagePortalOccupations;
|
||||
use App\Filament\Resources\PortalOccupations\Pages\ViewPortalOccupation;
|
||||
use App\Models\BlockedPeriod;
|
||||
use App\Models\Booking;
|
||||
use App\Models\Channel;
|
||||
use BackedEnum;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\ActionGroup;
|
||||
use Filament\Actions\ViewAction;
|
||||
use Filament\Forms\Components\Radio;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Infolists\Components\TextEntry;
|
||||
use Filament\Notifications\Notification;
|
||||
@@ -80,19 +83,85 @@ public static function table(Table $table): Table
|
||||
TextColumn::make('channel.name')->label('Importkanal'),
|
||||
TextColumn::make('property.name')->label('Wohnung')->toggleable(),
|
||||
TextColumn::make('needs_review')->label('Prüffall')->formatStateUsing(fn (bool $state): string => $state ? 'Bitte prüfen' : '–')->description(fn (BlockedPeriod $record): ?string => $record->review_note),
|
||||
])->recordActions([Action::make('fileLink')->label('Als Buchung übernehmen')->icon(Heroicon::OutlinedFolderPlus)->button()->color('primary')->visible(fn (BlockedPeriod $record): bool => static::canOpenFile($record))->url(fn (BlockedPeriod $record): string => static::getUrl('view', ['record' => $record])), static::showFileAction()->button(), ViewAction::make(), ActionGroup::make(static::occupationActions(withFile: false))->label('Weitere Aktionen')]);
|
||||
])->recordActions([Action::make('clarifyLink')->label('Klären')->icon(Heroicon::OutlinedQuestionMarkCircle)->button()->color('warning')->visible(fn (BlockedPeriod $record): bool => static::isUnclear($record))->url(fn (BlockedPeriod $record): string => static::getUrl('view', ['record' => $record])), Action::make('fileLink')->label('Als Buchung übernehmen')->icon(Heroicon::OutlinedFolderPlus)->button()->color('primary')->visible(fn (BlockedPeriod $record): bool => static::canOpenFile($record))->url(fn (BlockedPeriod $record): string => static::getUrl('view', ['record' => $record])), static::showFileAction()->button(), ViewAction::make(), ActionGroup::make(static::occupationActions(withFile: false))->label('Weitere Aktionen')]);
|
||||
}
|
||||
|
||||
public static function occupationActions(bool $withFile = true): array
|
||||
{
|
||||
return [
|
||||
...($withFile ? [static::openFileAction(), static::showFileAction()] : []),
|
||||
...($withFile ? [static::clarifyAction(), static::openFileAction(), static::showFileAction()] : []),
|
||||
AssignGuestAction::make(),
|
||||
static::classificationAction(),
|
||||
...BlockedPeriodResource::portalActions(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the entry still waits for the landlord's answer (it is listed under "Zu erledigen").
|
||||
*/
|
||||
public static function isUnclear(BlockedPeriod $record): bool
|
||||
{
|
||||
return ! $record->trashed() && BlockedPeriod::query()->unclear()->whereKey($record->id)->exists();
|
||||
}
|
||||
|
||||
/**
|
||||
* The one question for an unclear portal entry, in plain words: is it a booking (then it becomes a case), does it
|
||||
* belong to a case that already exists, or is it no booking at all? The detailed tools stay under "Weitere".
|
||||
*/
|
||||
public static function clarifyAction(): Action
|
||||
{
|
||||
return Action::make('clarify')->label('Klären: Was ist das?')->icon(Heroicon::OutlinedQuestionMarkCircle)->color('primary')
|
||||
->visible(fn (BlockedPeriod $record): bool => static::isUnclear($record) && ! $record->is_representation)
|
||||
->authorize(fn (BlockedPeriod $record): bool => auth()->user()?->can('update', $record) ?? false)
|
||||
->modalHeading(fn (BlockedPeriod $record): string => 'Belegung von '.($record->channel?->name ?? 'einem Portal').' am '.$record->starts_on->format('d.m.').'–'.$record->ends_on->format('d.m.Y'))
|
||||
->modalDescription(fn (BlockedPeriod $record): string => 'Für diesen Zeitraum wurde eine Belegung gemeldet. Bitte wählen Sie, was es ist.'.($record->review_note ? ' Hinweis: '.$record->review_note : ''))
|
||||
->modalSubmitActionLabel('Übernehmen')
|
||||
->schema(fn (BlockedPeriod $record): array => [
|
||||
Radio::make('answer')->hiddenLabel()->required()->live()->options(array_filter([
|
||||
'booking' => static::canOpenFile($record) ? 'Eine Buchung über '.($record->channel?->name ?? 'das Portal').' – als Vorgang übernehmen' : null,
|
||||
'case' => static::sameNightCases($record) !== [] ? 'Gehört zu einem Vorgang, der schon da ist' : null,
|
||||
'block' => 'Keine Buchung: Sperre, eigene Nutzung oder Spiegelung eines anderen Portals',
|
||||
])),
|
||||
Select::make('booking_id')->label('Vorgang')->options(fn (): array => static::sameNightCases($record))
|
||||
->visible(fn (Get $get): bool => $get('answer') === 'case')->required(fn (Get $get): bool => $get('answer') === 'case'),
|
||||
])
|
||||
->action(function (BlockedPeriod $record, array $data, OpenPortalFile $open, ResolveChannelOccupation $resolve, ClassifyPortalOccupation $classify) {
|
||||
try {
|
||||
if ($data['answer'] === 'booking') {
|
||||
$booking = $open->handle($record);
|
||||
Notification::make()->title('Als Buchung übernommen')->success()->send();
|
||||
|
||||
return redirect(BookingResource::getUrl('view', ['record' => $booking]));
|
||||
}
|
||||
if ($data['answer'] === 'case') {
|
||||
$resolve->handle($record, 'booking', (int) $data['booking_id']);
|
||||
Notification::make()->title('Dem Vorgang zugeordnet')->success()->send();
|
||||
|
||||
return null;
|
||||
}
|
||||
$classify->handle($record, OccupationKind::Block);
|
||||
$record->refresh()->forceFill(['needs_review' => false, 'reviewed_at' => now(), 'review_note' => 'Persönlich als Sperre eingeordnet.'])->save();
|
||||
Notification::make()->title('Als Sperre eingeordnet')->success()->send();
|
||||
} catch (ReservationException $exception) {
|
||||
Notification::make()->title('Nicht möglich')->body($exception->getMessage())->danger()->send();
|
||||
}
|
||||
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Cases of the same property with exactly these nights (the only ones the entry may belong to).
|
||||
*
|
||||
* @return array<int, string>
|
||||
*/
|
||||
public static function sameNightCases(BlockedPeriod $record): array
|
||||
{
|
||||
return Booking::query()->occupying()->with('guest')->where('property_id', $record->property_id)
|
||||
->whereDate('arrival', $record->starts_on)->whereDate('departure', $record->ends_on)->get()
|
||||
->mapWithKeys(fn (Booking $booking): array => [$booking->id => $booking->reference.' · '.$booking->guestName().' · '.$booking->bookingChannelLabel()])->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes a reservation from a portal calendar over as a case (no second, manual "file").
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user