U-D/U-E/O5: Prozess-Tester im eigenen Prozess (standardmäßig gesperrt, 15 Negativtests, statischer Wächter), Szenarien und Bericht, Kanalereignisse (API-Eingang ohne Umbau von iCal/Mail), Abschluss nach finanzieller Klärung, Löschfrist 30 Tage
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c255783cec
commit
0689c0a591
68 files changed
+3350
-35
No files matched your search
@@ -13,9 +13,12 @@
|
||||
use App\Enums\BookingTaskStatus;
|
||||
use App\Enums\DocumentKind;
|
||||
use App\Enums\IntakeKind;
|
||||
use App\Enums\Responsibility;
|
||||
use App\Exceptions\ReservationException;
|
||||
use App\Filament\Forms\DocumentCompositionFields;
|
||||
use App\Models\Booking;
|
||||
use App\Models\BookingTask;
|
||||
use App\Pricing\CaseMoney;
|
||||
use App\Pricing\StayRequest;
|
||||
use App\Process\CaseClosure;
|
||||
use App\Process\CaseLog;
|
||||
@@ -230,14 +233,37 @@ private function settleAction(): Action
|
||||
->visible(fn (): bool => in_array($this->record->status, [BookingStatus::Completed, BookingStatus::Cancelled], true) && $this->record->settled_at === null)
|
||||
->modalHeading('Kaufmännisch abschließen')
|
||||
->modalDescription(fn (): string => 'Noch offen: '.implode(' ', CaseClosure::commercialPoints($this->record)).' Abschließen nur, wenn das geklärt ist (z. B. kleine Differenz akzeptiert, Forderung ausgebucht).')
|
||||
->schema([Textarea::make('note')->label('Begründung')->required()->rows(2)->maxLength(500)])
|
||||
->schema([
|
||||
// Decision O5: with portal collection an open payout needs its financial clarification, not only a reason.
|
||||
Select::make('clarification')->label('Wie ist die Auszahlung geklärt?')
|
||||
->options(CaseClosure::PAYOUT_CLARIFICATIONS)
|
||||
->visible(fn (): bool => $this->payoutOpen())
|
||||
->required(fn (): bool => $this->payoutOpen())
|
||||
->helperText('Eine Meldung des Portals über die Auszahlung ist kein Nachweis des Geldeingangs. „Als offene Forderung weiterführen“ legt eine Aufgabe an; der Vorgang bleibt kaufmännisch offen.'),
|
||||
Textarea::make('note')->label('Begründung')->required()->rows(2)->maxLength(500),
|
||||
])
|
||||
->action(function (array $data): void {
|
||||
CaseClosure::settle($this->record, trim((string) $data['note']), CaseLog::actor());
|
||||
try {
|
||||
CaseClosure::settle($this->record, trim((string) $data['note']), CaseLog::actor(), $data['clarification'] ?? null);
|
||||
} catch (ReservationException $exception) {
|
||||
Notification::make()->title('Nicht abgeschlossen')->body($exception->getMessage())->danger()->send();
|
||||
|
||||
return;
|
||||
}
|
||||
$this->record->refresh();
|
||||
Notification::make()->title('Kaufmännisch abgeschlossen')->success()->send();
|
||||
Notification::make()->title($this->record->settled_at !== null ? 'Kaufmännisch abgeschlossen' : 'Als offene Forderung weitergeführt')->success()->send();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the portal's payout is open or deviating (decision O5).
|
||||
*/
|
||||
private function payoutOpen(): bool
|
||||
{
|
||||
return CaseMoney::of($this->record)->collector() === Responsibility::Portal
|
||||
&& collect(CaseClosure::commercialPoints($this->record))->contains(fn (string $point): bool => str_contains($point, 'Auszahlung'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Open tasks the landlord can settle on the page (not the ones with an action of their own).
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user