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

@@ -2,6 +2,7 @@
namespace App\Filament\Resources\Bookings\Schemas;
use App\Documents\OfferTerms;
use App\Models\Booking;
use App\Support\BookingProgress;
use App\Support\Money;
@@ -17,19 +18,59 @@
class BookingInfolist
{
/**
* The steps of the process as a row of chips.
* The process as a checklist: every milestone with its state and the activities that belong to it. Open
* activities name the action on this page that does them.
*/
private static function timeline(Booking $booking): HtmlString
{
$style = [
'done' => 'background:#dcfce7;color:#14532d',
'current' => 'background:#fef3c7;color:#78350f;font-weight:700',
'todo' => 'background:#f3f4f6;color:#4b5563',
'skipped' => 'background:#f3f4f6;color:#9ca3af;text-decoration:line-through',
$badge = [
'done' => ['✓', '#16a34a', 'erledigt'],
'current' => ['●', '#d97706', 'jetzt'],
'todo' => ['○', '#9ca3af', 'später'],
'skipped' => ['–', '#9ca3af', 'entfällt'],
];
$icon = ['done' => '✓ ', 'current' => '● ', 'todo' => '', 'skipped' => ''];
return new HtmlString('<div style="display:flex;flex-wrap:wrap;gap:.4rem">'.collect(BookingProgress::steps($booking))->map(fn (array $step): string => '<span style="padding:.25rem .6rem;border-radius:999px;font-size:.8rem;'.$style[$step['state']].'">'.$icon[$step['state']].e($step['label']).($step['detail'] ? ' · '.e($step['detail']) : '').'</span>')->implode('').'</div>');
$rows = collect(BookingProgress::steps($booking))->map(function (array $step) use ($badge): string {
[$icon, $color, $word] = $badge[$step['state']];
$activities = collect($step['activities'])->map(fn (array $activity): string => '<li style="margin:.15rem 0;'.($activity['done'] ? 'color:#15803d' : '').'">'.($activity['done'] ? '✓ ' : '○ ').e($activity['label']).($activity['action'] && $step['state'] !== 'skipped' ? ' <span style="color:#b45309">→ Aktion „'.e($activity['action']).'“</span>' : '').'</li>')->implode('');
return '<div style="display:flex;gap:.75rem;padding:.55rem 0;border-bottom:1px solid rgba(128,128,128,.25)">'
.'<div style="width:1.6rem;text-align:center;font-weight:700;color:'.$color.'" title="'.$word.'">'.$icon.'</div>'
.'<div style="flex:1"><div style="'.($step['state'] === 'current' ? 'font-weight:700' : '').($step['state'] === 'skipped' ? ';color:#9ca3af' : '').'">'.e($step['label']).($step['detail'] ? ' <span style="font-weight:400;color:#6b7280">· '.e($step['detail']).'</span>' : '').'</div>'
.($activities !== '' ? '<ul style="list-style:none;padding:0;margin:.2rem 0 0;font-size:.85rem">'.$activities.'</ul>' : '').'</div></div>';
})->implode('');
return new HtmlString('<div>'.$rows.'</div>');
}
/**
* What has happened so far, oldest first.
*/
private static function chronicle(Booking $booking): HtmlString
{
$rows = collect(BookingProgress::history($booking))->map(fn (array $event): string => '<li style="margin:.2rem 0"><span style="color:#6b7280">'.$event['at']->format('d.m.Y H:i').'</span> · '.e($event['label']).'</li>')->implode('');
return new HtmlString('<ul style="list-style:none;padding:0;margin:0;font-size:.9rem">'.$rows.'</ul>');
}
/**
* The standard process that applies to this booking: which template (with cancellation rule and annexes) comes from
* the portal and booking type, and whether payments become tasks.
*/
private static function setup(Booking $booking): string
{
$channel = $booking->importChannel ?? $booking->originChannel;
$template = OfferTerms::templateFor($booking);
$policy = $template?->cancellationPolicy;
$annexes = $template?->annexesFor($booking)->map(fn ($annex) => $annex->name)->implode(', ');
return collect([
$channel ? 'Portal: '.$channel->name : 'Eigene Buchung (Webseite / manuell)',
'Vertragsvorlage: '.($template ? $template->label() : 'Texte der Webseite'),
'Stornoregel: '.($policy ? $policy->name : 'keine hinterlegt'),
'Anlagen: '.($annexes ?: 'keine'),
'Zahlungsaufgaben: '.($booking->wantsPaymentTasks() ? 'ja' : 'nein (läuft über das Portal)'),
])->implode(' · ');
}
public static function configure(Schema $schema): Schema
@@ -46,11 +87,20 @@ public static function configure(Schema $schema): Schema
->state(fn (Booking $record): string => BookingProgress::next($record)['text'])
->color(fn (Booking $record): string => BookingProgress::next($record)['color'])
->weight('bold'),
TextEntry::make('setup')
->label('Standardprozess (aus Portal und Buchungstyp)')
->state(fn (Booking $record): string => self::setup($record))
->columnSpanFull(),
TextEntry::make('steps')
->label('Verlauf')
->label('Ablauf: Meilensteine und Aktivitäten')
->state(fn (Booking $record): HtmlString => self::timeline($record))
->html()
->columnSpanFull(),
TextEntry::make('chronicle')
->label('Bisheriger Verlauf')
->state(fn (Booking $record): HtmlString => self::chronicle($record))
->html()
->columnSpanFull(),
]),
Grid::make(1)
->columnSpan(2)
@@ -102,6 +102,6 @@ public static function configure(Table $table, ?int $guestId = null): Table
Filter::make('without_guest')->label('Gastzuordnung offen'),
])
->recordUrl(fn (array $record): string => $record['url'])
->recordActions([Action::make('view')->label(fn (array $record): string => $record['record_type'] === 'booking' ? 'Akte öffnen' : 'Details')->icon('heroicon-o-folder-open')->button()->color('primary')->url(fn (array $record): string => $record['url'])]);
->recordActions([Action::make('view')->label(fn (array $record): string => $record['record_type'] === 'booking' ? 'Akte öffnen' : ($record['kind'] === 'block' ? 'Details' : 'Akte anlegen'))->icon('heroicon-o-folder-open')->button()->color('primary')->url(fn (array $record): string => $record['url'])]);
}
}