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
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Forms;
|
||||
|
||||
use App\Enums\ProcessingMode;
|
||||
use App\Enums\ProcessSetting;
|
||||
use App\Enums\Responsibility;
|
||||
use App\Models\ContractTemplate;
|
||||
use Filament\Forms\Components\Field;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
|
||||
/**
|
||||
* Form fields of the process settings, asked as plain questions. On a deviation level (property, channel) an empty
|
||||
* field means "as the level above" and the placeholder says which value that is; on the landlord level an empty field
|
||||
* means the built-in default.
|
||||
*/
|
||||
class ProcessSettingFields
|
||||
{
|
||||
/**
|
||||
* @param list<ProcessSetting> $settings
|
||||
* @param callable(ProcessSetting): string $inherited plain-words value used when the field stays empty
|
||||
* @return list<Field>
|
||||
*/
|
||||
public static function make(string $prefix, array $settings, callable $inherited): array
|
||||
{
|
||||
return array_map(fn (ProcessSetting $setting): Field => self::field($prefix.$setting->value, $setting, $inherited($setting)), $settings);
|
||||
}
|
||||
|
||||
public static function field(string $name, ProcessSetting $setting, string $inheritedLabel): Field
|
||||
{
|
||||
$placeholder = 'wie Standard: '.$inheritedLabel;
|
||||
|
||||
return (match ($setting) {
|
||||
ProcessSetting::Processing => Select::make($name)->options(ProcessingMode::class)->placeholder($placeholder)
|
||||
->helperText('Automatisch: Das System sendet Angebote bzw. Unterlagen selbst, sobald alle Angaben da sind. Sonst bereitet es alles vor und Sie geben frei.'),
|
||||
ProcessSetting::PreReservation => Select::make($name)->options(['1' => 'Ja – der Zeitraum ist bis zum Ablauf des Angebots reserviert', '0' => 'Nein – eine Anfrage reserviert nichts'])->placeholder($placeholder),
|
||||
ProcessSetting::HoldHours => TextInput::make($name)->integer()->minValue(1)->maxValue(720)->suffix('Stunden')->placeholder($placeholder),
|
||||
ProcessSetting::Documents, ProcessSetting::Payments, ProcessSetting::GuestMessages => Select::make($name)->options(Responsibility::class)->placeholder($placeholder),
|
||||
ProcessSetting::ArrivalInfoDaysBefore => TextInput::make($name)->integer()->minValue(1)->maxValue(14)->suffix('Tage vor Anreise')->placeholder($placeholder),
|
||||
ProcessSetting::ContractTemplate => Select::make($name)
|
||||
->options(fn (): array => ContractTemplate::query()->orderBy('name')->orderBy('version')->get()->mapWithKeys(fn (ContractTemplate $template): array => [$template->id => $template->label()])->all())
|
||||
->placeholder($placeholder),
|
||||
})->label($setting->question());
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalised values of submitted fields; empty fields are dropped (not set = inherit).
|
||||
*
|
||||
* @param array<string, mixed> $data
|
||||
* @param list<ProcessSetting> $settings
|
||||
* @return array<string, string|int|bool>
|
||||
*/
|
||||
public static function values(array $data, array $settings): array
|
||||
{
|
||||
$values = [];
|
||||
foreach ($settings as $setting) {
|
||||
$value = $setting->normalize($data[$setting->value] ?? null);
|
||||
if ($value !== null) {
|
||||
$values[$setting->value] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stored values as form state (booleans as the select keys).
|
||||
*
|
||||
* @param array<string, mixed> $values
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public static function state(array $values): array
|
||||
{
|
||||
return array_map(fn (mixed $value): mixed => is_bool($value) ? ($value ? '1' : '0') : $value, $values);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user