Dokumentenzusammenstellung und Vorlagensteuerung (Paket 3, Prozessarchitektur v0.10)
Deploy FeWo mit PipelineManager / deploy (push) Successful in 3m59s
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:
1 parent
64248c09fa
commit
cf11c8a474
45 files changed
+2385
-144
No files matched your search
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use App\Documents\DocumentReleases;
|
||||
use App\Enums\DocumentKind;
|
||||
use App\Enums\IntakeKind;
|
||||
use App\Enums\ProcessSetting;
|
||||
use App\Enums\UserRole;
|
||||
@@ -12,7 +14,9 @@
|
||||
use App\Models\Tenant;
|
||||
use App\Support\Settings;
|
||||
use BackedEnum;
|
||||
use Carbon\CarbonImmutable;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Pages\Page;
|
||||
use Filament\Schemas\Components\Actions;
|
||||
@@ -63,7 +67,10 @@ public static function settings(): array
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
$this->form->fill(ProcessSettingFields::state((array) ($this->tenant()->process_defaults ?? [])));
|
||||
$this->form->fill([
|
||||
...ProcessSettingFields::state((array) ($this->tenant()->process_defaults ?? [])),
|
||||
'document_releases' => collect(self::releasableKinds())->mapWithKeys(fn (DocumentKind $kind): array => [$kind->value => DocumentReleases::isReleased($kind, $this->tenant())])->all(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function form(Schema $schema): Schema
|
||||
@@ -75,6 +82,17 @@ public function form(Schema $schema): Schema
|
||||
->description('Gilt für alle Wohnungen und Portale, solange dort nichts anderes eingestellt ist. Neue Einstellungen gelten für neue Vorgänge; laufende Vorgänge behalten ihre Regeln.')
|
||||
->columns(2)
|
||||
->schema(ProcessSettingFields::make('', self::settings(), fn (ProcessSetting $setting): string => 'Grundeinstellung ('.$setting->describe($setting->default()).')')),
|
||||
Section::make('Dokumente')
|
||||
->description('Welche Dokumente an Gäste gehen dürfen. Eine Arbeitsfassung wird nie automatisch versendet, von Hand nur nach ausdrücklicher Bestätigung im Vorgang. Vorlagen selbst geben Sie unter Vorlagen frei.')
|
||||
->schema([
|
||||
...array_map(fn (DocumentKind $kind): Toggle => Toggle::make('document_releases.'.$kind->value)
|
||||
->label($kind->getLabel().' – freigegeben')
|
||||
->helperText(fn (): string => $kind->description().self::decisionNote($kind)), self::releasableKinds()),
|
||||
Text::make(fn (): HtmlString => new HtmlString('<ul style="list-style:disc;padding-left:1.25rem">'.collect(DocumentKind::cases())
|
||||
->reject(fn (DocumentKind $kind): bool => in_array($kind, self::releasableKinds(), true) || ! $kind->isForGuests())
|
||||
->map(fn (DocumentKind $kind): string => '<li><strong>'.e($kind->getLabel()).'</strong>: '.e($kind->description()).' '.e($kind->isAvailable() ? '(in Verwendung; Texte unter Webseite › Texte bzw. Vorlagen)' : '(Arbeitsfassung vorbereitet, noch nicht nutzbar)').'</li>')
|
||||
->implode('').'</ul>')),
|
||||
]),
|
||||
Section::make('Abweichungen')
|
||||
->description('Wo Portale oder Wohnungen anders arbeiten. Ändern unter Portale bzw. Wohnungen (Expertenansicht).')
|
||||
->collapsed()
|
||||
@@ -94,11 +112,33 @@ public function content(Schema $schema): Schema
|
||||
|
||||
public function save(): void
|
||||
{
|
||||
$this->tenant()->update(['process_defaults' => ProcessSettingFields::values($this->form->getState(), self::settings())]);
|
||||
$state = $this->form->getState();
|
||||
$this->tenant()->update(['process_defaults' => ProcessSettingFields::values($state, self::settings())]);
|
||||
foreach (self::releasableKinds() as $kind) {
|
||||
DocumentReleases::set($kind, (bool) ($state['document_releases'][$kind->value] ?? false), (string) auth()->user()?->name, $this->tenant());
|
||||
}
|
||||
|
||||
Notification::make()->title('Gespeichert')->body('Gilt für neue Vorgänge.')->success()->send();
|
||||
}
|
||||
|
||||
/**
|
||||
* Document kinds whose texts the landlord releases here: the new kinds that can already be sent. Offer and
|
||||
* confirmation are in use since the start; the others are drafts of later packages.
|
||||
*
|
||||
* @return list<DocumentKind>
|
||||
*/
|
||||
public static function releasableKinds(): array
|
||||
{
|
||||
return array_values(array_filter(DocumentKind::cases(), fn (DocumentKind $kind): bool => $kind->isAvailable() && ! $kind->releasedByDefault()));
|
||||
}
|
||||
|
||||
private static function decisionNote(DocumentKind $kind): string
|
||||
{
|
||||
$decision = DocumentReleases::decision($kind);
|
||||
|
||||
return $decision === null || $decision['at'] === null ? ' Bisher: Arbeitsfassung.' : ' Zuletzt geändert am '.CarbonImmutable::parse($decision['at'])->format('d.m.Y').' von '.$decision['by'].'.';
|
||||
}
|
||||
|
||||
/**
|
||||
* Every deviation of a property or a channel, in plain words.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user