Vorgangskern und geführte Vorgangsbearbeitung (Pakete 1 und 2, Prozessarchitektur v0.10)
- Buchung ist der einheitliche Vorgang: Eingangsart, Vorgangsart A1–A6, eingefrorenes Abwicklungsprofil, gespeicherter Verlauf (booking_events); Gast, Personen und Beträge dürfen unbekannt sein, Platzhalter-Gäste werden migriert und nicht mehr angelegt - Einstellungen in Ebenen: Vermieterstandard (So arbeite ich), Abweichung der Wohnung (Experte), Abweichung je Portal und Eingangsart; ersetzt booking_model als Steuergröße - Ein Weg für extern verbindliche Buchungen (TakeOverExternalBooking) statt RecordPortalBooking und "Akte anlegen"; Portalpreis als belegte Gesamtposition - Startseite "Zu erledigen", neue Vorgangsseite mit nächstem Schritt, Automatik-Schalter, "Beenden" mit Storno statt Statusumschaltung; Status von Hand nur im Expertenmodus - Migration übernimmt bisheriges Verhalten unverändert (abweichende Wohnungswerte bleiben als Abweichung), Bericht: php artisan process:settings-report Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9005c12164
commit
3a728c3255
78 files changed
+4296
-1180
No files matched your search
@@ -3,8 +3,16 @@
|
||||
namespace App\Filament\Resources\Bookings\Schemas;
|
||||
|
||||
use App\Documents\OfferTerms;
|
||||
use App\Enums\ActivityState;
|
||||
use App\Enums\AdminMode;
|
||||
use App\Enums\ProcessingMode;
|
||||
use App\Enums\ProcessSetting;
|
||||
use App\Enums\Responsibility;
|
||||
use App\Models\Booking;
|
||||
use App\Support\BookingProgress;
|
||||
use App\Models\User;
|
||||
use App\Process\CaseActivities;
|
||||
use App\Process\CaseAutomation;
|
||||
use App\Process\ProcessProfile;
|
||||
use App\Support\Money;
|
||||
use Carbon\CarbonImmutable;
|
||||
use Filament\Infolists\Components\RepeatableEntry;
|
||||
@@ -15,189 +23,194 @@
|
||||
use Filament\Schemas\Schema;
|
||||
use Illuminate\Support\HtmlString;
|
||||
|
||||
/**
|
||||
* The case page: first where it stands and what is next, then the activities and the history, then the facts (guest,
|
||||
* stay, price and payments, documents). Technical details are shown in the expert view only.
|
||||
*/
|
||||
class BookingInfolist
|
||||
{
|
||||
/**
|
||||
* 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
|
||||
{
|
||||
$badge = [
|
||||
'done' => ['✓', '#16a34a', 'erledigt'],
|
||||
'current' => ['●', '#d97706', 'jetzt'],
|
||||
'todo' => ['○', '#9ca3af', 'später'],
|
||||
'skipped' => ['–', '#9ca3af', 'entfällt'],
|
||||
];
|
||||
|
||||
$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
|
||||
{
|
||||
return $schema
|
||||
->columns(3)
|
||||
->components([
|
||||
Section::make('Vorgang')
|
||||
Section::make('Als Nächstes')
|
||||
->columnSpanFull()
|
||||
->schema([
|
||||
TextEntry::make('process')->label('Art des Vorgangs')->state(fn (Booking $record): string => BookingProgress::kindLabel($record)),
|
||||
TextEntry::make('next')
|
||||
->label(fn (Booking $record): string => 'Nächster Schritt: '.BookingProgress::next($record)['title'])
|
||||
->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('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(),
|
||||
->hiddenLabel()
|
||||
->state(fn (Booking $record): HtmlString => self::nextStep($record))
|
||||
->html(),
|
||||
]),
|
||||
Grid::make(1)
|
||||
->columnSpan(2)
|
||||
->schema([
|
||||
Section::make('Vertrag')
|
||||
->columns(2)
|
||||
->schema([
|
||||
TextEntry::make('contract_template')->label('Vorlage')->state(fn (Booking $record): string => isset($record->offer_terms['template']) ? $record->offer_terms['template']['name'].' (Version '.$record->offer_terms['template']['version'].')' : ($record->offer_terms ? 'Texte der Webseite (Stand '.CarbonImmutable::parse($record->offer_terms['captured_at'])->format('d.m.Y').')' : 'Noch kein Angebot / Vertrag')),
|
||||
TextEntry::make('contract_state')->label('Dokumente')->state(fn (Booking $record): string => collect([
|
||||
$record->offer_path ? 'Angebot (PDF) Version '.$record->offer_version : null,
|
||||
$record->contract_path ? 'Mietvertrag (PDF, unveränderlich, Prüfsumme '.substr((string) $record->contract_pdf_sha256, 0, 10).')' : null,
|
||||
])->filter()->implode(' · ') ?: 'Noch kein Dokument – der Vertrag entsteht mit dem Angebot bzw. der Bestätigung'),
|
||||
TextEntry::make('contract_mail')->label('Zustellung')->state(fn (Booking $record): string => $record->confirmation_sent_at ? 'Bestätigung mit Vertrag gesendet am '.$record->confirmation_sent_at->format('d.m.Y, H:i') : ($record->confirmation_failed_at ? 'Versand fehlgeschlagen' : 'Noch nicht gesendet'))->columnSpanFull(),
|
||||
]),
|
||||
Section::make('Aufenthalt')
|
||||
->columns(3)
|
||||
->schema([
|
||||
TextEntry::make('property.name')->label('Wohnung'),
|
||||
TextEntry::make('arrival')->label('Anreise')->date('l, d.m.Y'),
|
||||
TextEntry::make('departure')->label('Abreise')->date('l, d.m.Y'),
|
||||
TextEntry::make('nights')->label('Nächte')->state(fn (Booking $record): int => $record->nights()),
|
||||
TextEntry::make('guests')->label('Personen'),
|
||||
TextEntry::make('promo_code')->label('Aktionscode')->placeholder('–'),
|
||||
]),
|
||||
Section::make('Preis')
|
||||
Section::make('Ablauf')
|
||||
->description('Was erledigt ist, was wartet und was noch kommt.')
|
||||
->schema([TextEntry::make('activities')->hiddenLabel()->state(fn (Booking $record): HtmlString => self::activities($record))->html()]),
|
||||
Section::make('Preis und Zahlungen')
|
||||
->schema([
|
||||
TextEntry::make('price_unknown')
|
||||
->hiddenLabel()
|
||||
->state('Der Gesamtpreis ist noch nicht bekannt.')
|
||||
->color('warning')
|
||||
->visible(fn (Booking $record): bool => $record->total === null),
|
||||
RepeatableEntry::make('quote.lines')
|
||||
->hiddenLabel()
|
||||
->table([
|
||||
TableColumn::make('Leistung'),
|
||||
TableColumn::make('Betrag')->alignEnd(),
|
||||
])
|
||||
->visible(fn (Booking $record): bool => filled($record->quote['lines'] ?? null))
|
||||
->table([TableColumn::make('Leistung'), TableColumn::make('Betrag')->alignEnd()])
|
||||
->schema([
|
||||
TextEntry::make('label'),
|
||||
TextEntry::make('amount')->formatStateUsing(fn (int $state): string => Money::format($state))->alignEnd(),
|
||||
]),
|
||||
Grid::make(4)->schema([
|
||||
Grid::make(4)->visible(fn (Booking $record): bool => $record->total !== null)->schema([
|
||||
TextEntry::make('total')->label('Gesamtpreis')->money('EUR', divideBy: 100, locale: 'de')->weight('bold'),
|
||||
TextEntry::make('deposit')->label('Anzahlung')->money('EUR', divideBy: 100, locale: 'de'),
|
||||
TextEntry::make('balance')->label('Restzahlung')->state(fn (Booking $record): string => Money::format($record->total - $record->deposit)),
|
||||
TextEntry::make('balance_due_on')->label('Rest fällig am')->date('d.m.Y'),
|
||||
TextEntry::make('paid')->label('Bezahlt')->state(fn (Booking $record): string => Money::format($record->paidAmount())),
|
||||
TextEntry::make('open')->label('Offen')->state(fn (Booking $record): string => Money::format($record->openAmount()))->color(fn (Booking $record): string => $record->openAmount() > 0 ? 'danger' : 'success'),
|
||||
TextEntry::make('deposit_due_on')->label('Anzahlung fällig am')->date('d.m.Y')->placeholder('–'),
|
||||
TextEntry::make('open')->label('Offen')
|
||||
->state(fn (Booking $record): string => $record->process()->payments() === Responsibility::Portal ? 'über das Portal' : Money::format($record->openAmount()))
|
||||
->color(fn (Booking $record): string => $record->process()->payments() === Responsibility::Landlord && $record->openAmount() > 0 ? 'danger' : 'success'),
|
||||
TextEntry::make('balance_due_on')->label('Rest fällig am')->date('d.m.Y')->placeholder('–'),
|
||||
]),
|
||||
]),
|
||||
Section::make('Verlauf')
|
||||
->collapsible()
|
||||
->schema([TextEntry::make('history')->hiddenLabel()->state(fn (Booking $record): HtmlString => self::history($record))->html()]),
|
||||
Section::make('Nachricht des Gastes')
|
||||
->visible(fn (Booking $record): bool => filled($record->message))
|
||||
->schema([
|
||||
TextEntry::make('message')->hiddenLabel(),
|
||||
]),
|
||||
->schema([TextEntry::make('message')->hiddenLabel()]),
|
||||
]),
|
||||
Grid::make(1)
|
||||
->columnSpan(1)
|
||||
->schema([
|
||||
Section::make('Status')
|
||||
->schema([
|
||||
TextEntry::make('status')->label('Status')->badge(),
|
||||
TextEntry::make('hold_expires_at')->label('Vorgemerkt bis')->dateTime('d.m.Y, H:i')->visible(fn (Booking $record): bool => $record->hold_expires_at !== null),
|
||||
TextEntry::make('confirmed_at')->label('Bestätigt am')->dateTime('d.m.Y, H:i')->visible(fn (Booking $record): bool => $record->confirmed_at !== null),
|
||||
TextEntry::make('created_at')->label('Eingegangen')->dateTime('d.m.Y, H:i'),
|
||||
TextEntry::make('processing')
|
||||
->label('Bearbeitung / Vorreservierung')
|
||||
->state(fn (Booking $record): string => $record->property->offer_mode->value === 'automatic' ? 'Automatisch' : 'Manuell')
|
||||
->visible(fn (Booking $record): bool => $record->isDirect()),
|
||||
TextEntry::make('offer')
|
||||
->label('Angebot')
|
||||
->state(fn (Booking $record): string => 'Version '.$record->offer_version.', gesendet '.$record->offer_sent_at?->format('d.m.Y, H:i').' · Prüfsumme '.substr((string) $record->offer_hash, 0, 12).(isset($record->offer_terms['template']) ? ' · Vorlage '.$record->offer_terms['template']['name'].' v'.$record->offer_terms['template']['version'] : ''))
|
||||
->visible(fn (Booking $record): bool => $record->offer_version > 0),
|
||||
TextEntry::make('accepted_at')->label('Angenommen am')->dateTime('d.m.Y, H:i:s')->visible(fn (Booking $record): bool => $record->accepted_at !== null),
|
||||
TextEntry::make('confirmation')
|
||||
->label('Bestätigungs-E-Mail')
|
||||
->state(fn (Booking $record): string => $record->confirmation_sent_at !== null ? 'Gesendet '.$record->confirmation_sent_at->format('d.m.Y, H:i') : 'Nicht zugestellt – bitte „Bestätigung erneut senden“')
|
||||
->color(fn (Booking $record): string => $record->confirmation_sent_at !== null ? 'success' : 'danger')
|
||||
->visible(fn (Booking $record): bool => $record->confirmation_sent_at !== null || $record->confirmation_failed_at !== null),
|
||||
TextEntry::make('source')->label('Buchungskanal / Quelle')->state(fn (Booking $record): string => $record->bookingChannelLabel()),
|
||||
TextEntry::make('referral_source')->label('Aufmerksam geworden durch')->placeholder('–'),
|
||||
TextEntry::make('utm')
|
||||
->label('Kampagne (UTM)')
|
||||
->state(fn (Booking $record): ?string => collect([$record->utm_source, $record->utm_medium, $record->utm_campaign])->filter()->implode(' / ') ?: null)
|
||||
->visible(fn (Booking $record): bool => filled($record->utm_source)),
|
||||
]),
|
||||
Section::make('Gast')
|
||||
->schema([
|
||||
TextEntry::make('guest.full_name')->label('Name'),
|
||||
TextEntry::make('guest.email')->label('E-Mail')->placeholder('Unbekannt')->copyable(),
|
||||
TextEntry::make('guest_name')->label('Name')->state(fn (Booking $record): string => $record->guestName())
|
||||
->color(fn (Booking $record): ?string => $record->guest === null ? 'warning' : null),
|
||||
TextEntry::make('guest.email')->label('E-Mail')->placeholder('noch nicht bekannt')->copyable(),
|
||||
TextEntry::make('guest.phone')->label('Telefon')->placeholder('–'),
|
||||
TextEntry::make('guest_address')
|
||||
->label('Adresse')
|
||||
->state(fn (Booking $record): ?string => collect([$record->guest->street, trim("{$record->guest->postal_code} {$record->guest->city}")])->filter()->implode(', ') ?: null)
|
||||
->state(fn (Booking $record): ?string => $record->guest === null ? null : (collect([$record->guest->street, trim("{$record->guest->postal_code} {$record->guest->city}")])->filter()->implode(', ') ?: null))
|
||||
->placeholder('–'),
|
||||
]),
|
||||
Section::make('Interne Notizen')
|
||||
Section::make('Aufenthalt')
|
||||
->schema([
|
||||
TextEntry::make('internal_notes')->hiddenLabel()->placeholder('Keine Notizen'),
|
||||
TextEntry::make('property.name')->label('Wohnung'),
|
||||
TextEntry::make('period')->label('Zeitraum')->state(fn (Booking $record): string => $record->arrival->translatedFormat('D, d.m.Y').' – '.$record->departure->translatedFormat('D, d.m.Y').' ('.$record->nights().' Nächte)'),
|
||||
TextEntry::make('guests')->label('Personen')->placeholder('noch nicht bekannt'),
|
||||
TextEntry::make('channel')->label('Über')->state(fn (Booking $record): string => $record->bookingChannelLabel().($record->portal_reference ? ' · Nr. '.$record->portal_reference : '')),
|
||||
]),
|
||||
Section::make('Dokumente')
|
||||
->schema([
|
||||
TextEntry::make('documents')->hiddenLabel()->state(fn (Booking $record): string => collect([
|
||||
$record->offer_path ? 'Angebot Version '.$record->offer_version : null,
|
||||
$record->contract_path ? 'Mietvertrag' : null,
|
||||
$record->confirmation_sent_at ? 'Bestätigung gesendet am '.$record->confirmation_sent_at->format('d.m.Y') : null,
|
||||
])->filter()->implode(' · ') ?: 'Noch keine'),
|
||||
TextEntry::make('template')->label('Vorlage')->state(fn (Booking $record): string => isset($record->offer_terms['template'])
|
||||
? $record->offer_terms['template']['name'].' (Version '.$record->offer_terms['template']['version'].', festgeschrieben)'
|
||||
: (OfferTerms::templateFor($record)?->label() ?? 'Texte der Webseite').' (vorgesehen)'),
|
||||
]),
|
||||
Section::make('Interne Notizen')
|
||||
->collapsible()
|
||||
->schema([TextEntry::make('internal_notes')->hiddenLabel()->placeholder('Keine Notizen')]),
|
||||
]),
|
||||
Section::make('Technische Angaben')
|
||||
->description('Expertenansicht')
|
||||
->columnSpanFull()
|
||||
->collapsed()
|
||||
->visible(fn (): bool => auth()->user() instanceof User && auth()->user()->adminMode() === AdminMode::Expert)
|
||||
->columns(3)
|
||||
->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('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('–'),
|
||||
TextEntry::make('contract_pdf_sha256')->label('Vertrag (Prüfsumme)')->formatStateUsing(fn (?string $state): string => substr((string) $state, 0, 16))->placeholder('–'),
|
||||
TextEntry::make('accepted_at')->label('Angenommen am')->dateTime('d.m.Y, H:i:s')->placeholder('–'),
|
||||
TextEntry::make('source')->label('Quelle'),
|
||||
TextEntry::make('referral_source')->label('Aufmerksam geworden durch')->placeholder('–'),
|
||||
TextEntry::make('utm')->label('Kampagne (UTM)')->state(fn (Booking $record): ?string => collect([$record->utm_source, $record->utm_medium, $record->utm_campaign])->filter()->implode(' / ') ?: null)->placeholder('–'),
|
||||
TextEntry::make('created_at')->label('Eingegangen')->dateTime('d.m.Y, H:i'),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* The next step in large type, with what keeps an automatic case waiting.
|
||||
*/
|
||||
private static function nextStep(Booking $booking): HtmlString
|
||||
{
|
||||
$next = CaseActivities::next($booking);
|
||||
$automatic = $booking->processingMode() === ProcessingMode::Automatic;
|
||||
$waiting = collect(CaseActivities::for($booking))->first(fn ($activity): bool => $activity->state === ActivityState::Waiting);
|
||||
|
||||
$title = match (true) {
|
||||
$next !== null => e($next->label),
|
||||
$waiting !== null => 'Nichts zu tun – es wartet: '.e($waiting->label),
|
||||
default => 'Nichts zu tun.',
|
||||
};
|
||||
$color = $next?->state === ActivityState::Problem ? '#dc2626' : ($next !== null ? '#b45309' : '#15803d');
|
||||
$detail = $next?->detail ?? $waiting?->detail;
|
||||
$mode = $automatic
|
||||
? 'Dieser Vorgang läuft automatisch weiter, sobald alle Angaben da sind.'.(($blockers = self::blockers($booking)) !== [] ? ' Es fehlt: '.e(implode(' ', $blockers)) : '')
|
||||
: 'Sie geben jeden Schritt selbst frei. Der Knopf oben rechts führt zum nächsten Schritt.';
|
||||
|
||||
return new HtmlString('<div style="font-size:1.35rem;font-weight:700;color:'.$color.'">'.$title.'</div>'
|
||||
.($detail ? '<div style="margin-top:.2rem">'.e($detail).'</div>' : '')
|
||||
.'<div style="margin-top:.5rem;color:#6b7280;font-size:.9rem">'.$mode.'</div>');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<string>
|
||||
*/
|
||||
private static function blockers(Booking $booking): array
|
||||
{
|
||||
return $booking->isBinding() && $booking->confirmation_sent_at === null && $booking->process()->documents() === Responsibility::Landlord
|
||||
? app(CaseAutomation::class)->documentBlockers($booking)
|
||||
: [];
|
||||
}
|
||||
|
||||
private static function activities(Booking $booking): HtmlString
|
||||
{
|
||||
$colors = ['success' => '#15803d', 'warning' => '#b45309', 'danger' => '#dc2626', 'info' => '#2563eb', 'gray' => '#9ca3af'];
|
||||
|
||||
$rows = collect(CaseActivities::for($booking))
|
||||
->reject(fn ($activity): bool => $activity->state === ActivityState::NotApplicable)
|
||||
->map(function ($activity) use ($colors): string {
|
||||
$color = $colors[$activity->state->getColor()];
|
||||
$strong = $activity->state->needsAction() ? 'font-weight:700' : '';
|
||||
|
||||
return '<li style="display:flex;gap:.75rem;padding:.45rem 0;border-bottom:1px solid rgba(128,128,128,.2)">'
|
||||
.'<span style="width:1.4rem;text-align:center;font-weight:700;color:'.$color.'">'.$activity->state->icon().'</span>'
|
||||
.'<span style="flex:1;'.$strong.'">'.e($activity->label)
|
||||
.($activity->detail ? ' <span style="font-weight:400;color:#6b7280">· '.e($activity->detail).'</span>' : '')
|
||||
.($activity->url && $activity->state->needsAction() ? ' <a href="'.e($activity->url).'" style="color:#2563eb;text-decoration:underline">erledigen</a>' : '')
|
||||
.'</span><span style="color:'.$color.';font-size:.85rem">'.e($activity->state->getLabel()).'</span></li>';
|
||||
})->implode('');
|
||||
|
||||
return new HtmlString('<ul style="list-style:none;margin:0;padding:0">'.$rows.'</ul>');
|
||||
}
|
||||
|
||||
private static function history(Booking $booking): HtmlString
|
||||
{
|
||||
$rows = $booking->events()->get()->map(fn ($event): string => '<li style="margin:.25rem 0"><span style="color:#6b7280">'.$event->occurred_at->format('d.m.Y H:i').'</span> · '.e($event->summary)
|
||||
.($event->actor ? ' <span style="color:#6b7280">('.e($event->actor).')</span>' : '')
|
||||
.($event->reason ? '<div style="color:#6b7280;margin-left:1rem">Grund: '.e($event->reason).'</div>' : '').'</li>')->implode('');
|
||||
|
||||
return new HtmlString($rows === '' ? 'Noch keine Einträge.' : '<ul style="list-style:none;padding:0;margin:0;font-size:.9rem">'.$rows.'</ul>');
|
||||
}
|
||||
|
||||
private static function profile(Booking $booking): HtmlString
|
||||
{
|
||||
$profile = $booking->process();
|
||||
$rows = collect(ProcessSetting::cases())
|
||||
->reject(fn (ProcessSetting $setting): bool => in_array($setting, ProcessProfile::LIVE, true))
|
||||
->map(fn (ProcessSetting $setting): string => '<li>'.e($setting->question()).' <strong>'.e($setting->describe($profile->value($setting))).'</strong> <span style="color:#6b7280">('.e(ProcessProfile::sourceLabel($profile->source($setting))).')</span></li>')
|
||||
->implode('');
|
||||
|
||||
return new HtmlString('<ul style="list-style:disc;padding-left:1.2rem">'.$rows.'</ul><div style="color:#6b7280;font-size:.85rem">Festgelegt '.e(($profile->origin === 'migration' ? 'bei der Übernahme der bisherigen Daten' : 'beim Eingang').($profile->frozenAt ? ' am '.CarbonImmutable::parse($profile->frozenAt)->format('d.m.Y H:i') : '')).($booking->processing_mode ? ' · Bearbeitung für diesen Vorgang: '.e($booking->processing_mode->getLabel()) : '').'</div>');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user