Dokumentenzusammenstellung und Vorlagensteuerung (Paket 3, Prozessarchitektur v0.10)
Deploy FeWo mit PipelineManager / deploy (push) Successful in 3m59s

Eine Zusammenstellung vor jedem Dokument (Angebot, Bestaetigung, Buchungsunterlagen
extern), Dokumentart je Vorgangsart, Freigaben fuer Vorlagen und Dokumentarten,
Schutz vor unvereinbarten Bedingungen bei Portalbuchungen (E-004), kein doppelter
Versand, Absicherung Hold 0 bis Paket 7, A6-Aufenthaltsbestaetigung vorbereitet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Opus 5.5 committed 2026-11-01 19:44:52 +01:00
1 parent 64248c09fa
commit cf11c8a474
45 files changed
+2385 -144

No files matched your search

@@ -5,6 +5,7 @@
use App\Documents\OfferTerms;
use App\Enums\ActivityState;
use App\Enums\AdminMode;
use App\Enums\DocumentKind;
use App\Enums\ProcessingMode;
use App\Enums\ProcessSetting;
use App\Enums\Responsibility;
@@ -102,12 +103,9 @@ public static function configure(Schema $schema): Schema
]),
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'])
TextEntry::make('documents')->hiddenLabel()->html()->state(fn (Booking $record): HtmlString => self::documents($record)),
TextEntry::make('document_kind')->label('Vorgesehen')->state(fn (Booking $record): string => DocumentKind::forCase($record)?->getLabel() ?? 'Unterlagen schickt das Portal'),
TextEntry::make('template')->label('Vorlage')->state(fn (Booking $record): string => isset($record->offer_terms['template']) && ($record->contract_path !== null || $record->offer_path !== null)
? $record->offer_terms['template']['name'].' (Version '.$record->offer_terms['template']['version'].', festgeschrieben)'
: (OfferTerms::templateFor($record)?->label() ?? 'Texte der Webseite').' (vorgesehen)'),
]),
@@ -163,6 +161,26 @@ private static function nextStep(Booking $booking): HtmlString
.'<div style="margin-top:.5rem;color:#6b7280;font-size:.9rem">'.$mode.'</div>');
}
/**
* The documents made for the case, as recorded when they were created (kind, template, date).
*/
private static function documents(Booking $booking): HtmlString
{
$lines = $booking->events()->where('type', 'document')->whereNotNull('data')->reorder()->orderBy('occurred_at')->orderBy('id')->get()
->filter(fn ($event): bool => isset($event->data['kind']))
->map(fn ($event): string => e($event->occurred_at->format('d.m.Y').' · '.$event->summary));
if ($lines->isEmpty()) {
$lines = collect([
$booking->offer_path ? 'Angebot Version '.$booking->offer_version : null,
$booking->contract_path ? 'Mietvertrag' : null,
$booking->confirmation_sent_at ? 'Bestätigung gesendet am '.$booking->confirmation_sent_at->format('d.m.Y') : null,
])->filter()->map(fn (string $line): string => e($line));
}
return new HtmlString($lines->isEmpty() ? 'Noch keine' : $lines->implode('<br>'));
}
/**
* @return list<string>
*/