Akte auch fuer Portal-Reservierungen aus dem Kalender, Ablauf mit Aktivitaeten, Verlauf, Standardprozess je Portal
Deploy FeWo mit PipelineManager / deploy (push) Successful in 3m34s

- Akte anlegen aus einer importierten Portal-Reservierung (Belegung bleibt durchgehend belegt, Kalendereintrag wird Spiegelung)
- Akte: Standardprozess (Portal/Vorlage/Storno/Anlagen), Meilensteine mit Aktivitaeten und Aktionshinweis, chronologischer Verlauf
- Kanalformular: Abschnitt Standardprozess je Buchungstyp mit Anzeige, was die Vorlage mitbringt
- Portalpreis als gemeinsame Logik (PortalPrice)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Sonnet 5.5 committed 2026-10-30 18:56:32 +01:00
1 parent 5ba9ae08ab
commit 81c025f1ee
10 files changed
+450 -75

No files matched your search

@@ -3,7 +3,9 @@
namespace App\Filament\Resources\PortalOccupations;
use App\Actions\ClassifyPortalOccupation;
use App\Actions\OpenPortalFile;
use App\Enums\OccupationKind;
use App\Exceptions\ReservationException;
use App\Filament\Actions\AssignGuestAction;
use App\Filament\Concerns\FollowsAdminMode;
use App\Filament\Concerns\SelectsRecordProperty;
@@ -78,18 +80,61 @@ 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([ViewAction::make(), ActionGroup::make(static::occupationActions())->label('Weitere Aktionen')]);
])->recordActions([Action::make('fileLink')->label('Akte anlegen')->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(): array
public static function occupationActions(bool $withFile = true): array
{
return [
...($withFile ? [static::openFileAction(), static::showFileAction()] : []),
AssignGuestAction::make(),
static::classificationAction(),
...BlockedPeriodResource::portalActions(),
];
}
/**
* Opens the booking file (workflow, contract, payments, tasks) for a reservation from a portal calendar.
*/
public static function openFileAction(): Action
{
return Action::make('openFile')->label('Akte anlegen')->icon(Heroicon::OutlinedFolderPlus)->color('primary')
->visible(fn (BlockedPeriod $record): bool => static::canOpenFile($record))
->authorize(fn (BlockedPeriod $record): bool => auth()->user()?->can('update', $record) ?? false)
->requiresConfirmation()
->modalHeading('Akte für diese Reservierung anlegen')
->modalDescription('Aus der Kalenderbelegung wird eine Buchung mit Ablauf: Kontaktdaten, Vertrag, Zahlungen, Anreise, Storno. Der Zeitraum bleibt durchgehend belegt. Gast, Personenzahl und Preis sind noch unbekannt und werden in der Akte ergänzt.')
->action(function (BlockedPeriod $record, OpenPortalFile $open) {
try {
$booking = $open->handle($record);
} catch (ReservationException $exception) {
Notification::make()->title('Nicht möglich')->body($exception->getMessage())->danger()->send();
return null;
}
Notification::make()->title('Akte angelegt')->success()->send();
return redirect(BookingResource::getUrl('view', ['record' => $booking]));
});
}
public static function showFileAction(): Action
{
return Action::make('showFile')->label('Akte öffnen')->icon(Heroicon::OutlinedFolderOpen)->color('primary')
->visible(fn (BlockedPeriod $record): bool => $record->linked_booking_id !== null)
->url(fn (BlockedPeriod $record): ?string => $record->linked_booking_id ? BookingResource::getUrl('view', ['record' => $record->linked_booking_id]) : null);
}
/**
* Whether the calendar entry is a reservation that can still get its own booking file.
*/
public static function canOpenFile(BlockedPeriod $record): bool
{
return in_array($record->source, ['channel', 'email'], true) && ! $record->trashed() && ! $record->is_representation
&& $record->channel_id !== null && $record->occupationKind() !== OccupationKind::Block;
}
public static function classificationAction(): Action
{
return Action::make('classify')->label('Einordnen: Reservierung, Sperrzeit oder unbekannt')