V2.1: nichtlineare Prozessansicht, Begründung der Pflichtschritte, Bedienelemente der neuen Einstellungen
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f8561fe0e5
commit
fdf226535b
8 files changed
+77
-8
No files matched your search
@@ -4,6 +4,7 @@
|
||||
|
||||
use App\Actions\ConfigureChannelProcess;
|
||||
use App\Enums\AdminMode;
|
||||
use App\Enums\Execution;
|
||||
use App\Enums\IntakeKind;
|
||||
use App\Enums\ProcessSetting;
|
||||
use App\Filament\Resources\Channels\ChannelResource;
|
||||
@@ -175,13 +176,26 @@ public function steps(): array
|
||||
$profile = $this->profile();
|
||||
$draft = $this->drafts[$this->intake];
|
||||
|
||||
return array_map(function (array $row) use ($configuration, $catalogue, $model, $profile): array {
|
||||
$rows = $configuration->preview($this->record, IntakeKind::from($this->intake), $this->draft());
|
||||
$labels = collect($rows)->mapWithKeys(fn (array $row): array => [$row['module'] => $row['label']]);
|
||||
$active = collect($rows)->where('on', true)->pluck('module')->all();
|
||||
|
||||
return array_map(function (array $row) use ($configuration, $catalogue, $model, $profile, $labels, $active): array {
|
||||
$definition = $catalogue->modules()[$row['module']]::definition();
|
||||
// The view of the order is derived from the same definitions the runner uses: only dependencies present in the plan count.
|
||||
$needs = collect($definition->requires)->filter(fn ($dependency): bool => $dependency->hard && in_array($dependency->module, $active, true))->map(fn ($dependency): string => $labels[$dependency->module])->values()->all();
|
||||
$after = collect($definition->requires)->filter(fn ($dependency): bool => ! $dependency->hard && in_array($dependency->module, $active, true))->map(fn ($dependency): string => $labels[$dependency->module])->values()->all();
|
||||
$controls = ChannelProcessConfiguration::STEP_CONTROLS[$row['module']] ?? [];
|
||||
$parameters = array_values(array_filter($controls['parameters'] ?? [], fn (ProcessSetting $setting): bool => in_array(IntakeKind::from($this->intake), $setting->channelIntakes(), true) && ! $model::fixesSetting($setting) && ($this->expert() || in_array($setting, [ProcessSetting::HoldHours, ProcessSetting::DataRequestReminderHours, ProcessSetting::ArrivalInfoDaysBefore, ProcessSetting::ClarificationHoldAutoMinutes], true))));
|
||||
$parameters = array_values(array_filter($controls['parameters'] ?? [], fn (ProcessSetting $setting): bool => in_array(IntakeKind::from($this->intake), $setting->channelIntakes(), true) && ! $model::fixesSetting($setting) && ($this->expert() || in_array($setting, [ProcessSetting::HoldHours, ProcessSetting::DataRequestReminderHours, ProcessSetting::ArrivalInfoDaysBefore, ProcessSetting::ClarificationHoldAutoMinutes, ProcessSetting::ContractDelivery, ProcessSetting::BookingNotice, ProcessSetting::AwaitPortalConfirmation, ProcessSetting::PortalConfirmationWaitHours], true))));
|
||||
|
||||
return [...$row,
|
||||
'purpose' => $definition->purpose,
|
||||
'needs' => $needs,
|
||||
'after' => $after,
|
||||
'condition' => $definition->condition,
|
||||
'why' => $definition->why,
|
||||
'executions' => array_map(fn (Execution $execution): string => $execution->getLabel(), $definition->executions),
|
||||
'triggers' => $definition->triggers,
|
||||
'waits' => $definition->waits,
|
||||
'optional' => $definition->isOptional(),
|
||||
'version' => $catalogue->modules()[$row['module']]::version(),
|
||||
@@ -189,9 +203,9 @@ public function steps(): array
|
||||
'mode_options' => $configuration->modeOptions($row['module']),
|
||||
'performer_setting' => isset($controls['performer']) ? $controls['performer']['setting'] : null,
|
||||
'performer_options' => $configuration->performerOptions($model, $row['module']),
|
||||
'parameters' => array_map(fn (ProcessSetting $setting): array => $this->setting($setting, $profile), $parameters),
|
||||
'parameters' => array_map(fn (ProcessSetting $setting): array => [...$this->setting($setting, $profile), 'options' => $configuration->settingOptions($setting)], $parameters),
|
||||
];
|
||||
}, $configuration->preview($this->record, IntakeKind::from($this->intake), $this->draft()));
|
||||
}, $rows);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
namespace App\Process;
|
||||
|
||||
use App\Enums\BookingNoticeMode;
|
||||
use App\Enums\ChannelBookingModel;
|
||||
use App\Enums\ContractDelivery;
|
||||
use App\Enums\DataRequestMode;
|
||||
use App\Enums\IntakeKind;
|
||||
use App\Enums\ProcessingMode;
|
||||
@@ -31,7 +33,9 @@ final class ChannelProcessConfiguration
|
||||
'hold' => ['parameters' => [ProcessSetting::ClarificationHoldAutoMinutes, ProcessSetting::ClarificationHoldManualMinutes]],
|
||||
'offer.binding' => ['mode' => ProcessSetting::Processing, 'parameters' => [ProcessSetting::HoldHours, ProcessSetting::ContractTemplate]],
|
||||
'offer.information' => ['mode' => ProcessSetting::Processing, 'parameters' => [ProcessSetting::GuestLinkValidDays]],
|
||||
'documents.send' => ['mode' => ProcessSetting::Processing, 'parameters' => [ProcessSetting::ContractTemplate]],
|
||||
'documents.send' => ['mode' => ProcessSetting::Processing, 'parameters' => [ProcessSetting::ContractDelivery, ProcessSetting::ContractTemplate]],
|
||||
'documents.booking_notice' => ['parameters' => [ProcessSetting::BookingNotice]],
|
||||
'portal.confirmation' => ['parameters' => [ProcessSetting::AwaitPortalConfirmation, ProcessSetting::PortalConfirmationWaitHours]],
|
||||
'arrival.info' => ['performer' => ['field' => 'guest_messages', 'setting' => ProcessSetting::GuestMessages], 'parameters' => [ProcessSetting::ArrivalInfoDaysBefore]],
|
||||
];
|
||||
|
||||
@@ -193,6 +197,21 @@ public function performerOptions(ProcessModel $model, string $module): array
|
||||
->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* The fixed choices of a setting that is not free text (null: free input).
|
||||
*
|
||||
* @return array<string, string>|null
|
||||
*/
|
||||
public function settingOptions(ProcessSetting $setting): ?array
|
||||
{
|
||||
return match ($setting) {
|
||||
ProcessSetting::ContractDelivery => collect(ContractDelivery::cases())->mapWithKeys(fn (ContractDelivery $case): array => [$case->value => $case->getLabel()])->all(),
|
||||
ProcessSetting::BookingNotice => collect(BookingNoticeMode::cases())->mapWithKeys(fn (BookingNoticeMode $case): array => [$case->value => $case->getLabel()])->all(),
|
||||
ProcessSetting::AwaitPortalConfirmation => ['1' => 'ja, erst nach der Bestätigungsmail', '0' => 'nein, sofort'],
|
||||
default => null,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Allowed modes of a step (as values of its setting).
|
||||
*
|
||||
|
||||
@@ -39,6 +39,7 @@ public static function definition(): ModuleDefinition
|
||||
label: 'Bestätigung des Portals abwarten',
|
||||
purpose: 'Wartet auf die Bestätigungsmail des Portals, bevor Unterlagen und Nachrichten an den Gast gehen. Die Belegung ist von Anfang an gesichert.',
|
||||
phase: 'P02',
|
||||
why: 'Solange das Portal die Buchung nicht bestätigt hat, sollen keine Unterlagen an den Gast gehen; die Belegung ist trotzdem gesichert.',
|
||||
executions: [Execution::Automatic, Execution::Manual, Execution::NotRequired],
|
||||
condition: 'nur bei extern verbindlicher Buchung und nur, wenn für den Kanal „Bestätigungsmail abwarten“ eingestellt ist',
|
||||
requires: [Dependency::hard('intake.record')],
|
||||
|
||||
@@ -33,6 +33,7 @@ public static function definition(): ModuleDefinition
|
||||
label: 'Unverbindliche Auskunft und Buchungswunsch',
|
||||
purpose: 'Beantwortet die Anfrage mit einer unverbindlichen Auskunft ohne Reservierung; fragt der Gast die Buchung an, wird erneut geprüft und verbindlich bestätigt.',
|
||||
phase: 'P02',
|
||||
why: 'Der Gast braucht eine Antwort auf seine Anfrage; ob sie automatisch oder von Hand kommt, bestimmen Sie.',
|
||||
executions: [Execution::Automatic, Execution::Manual],
|
||||
condition: 'bei einer Anfrage ohne Reservierung',
|
||||
requires: [Dependency::hard('intake.record'), Dependency::soft('guest.data_request')],
|
||||
|
||||
@@ -28,6 +28,7 @@ public static function definition(): ModuleDefinition
|
||||
label: 'Anreise-Informationen',
|
||||
purpose: 'Wegbeschreibung, Schlüssel und Kontakt vor Ort rechtzeitig vor der Anreise.',
|
||||
phase: 'P04',
|
||||
why: 'Ohne Anreise-Informationen finden Gäste Schlüssel und Wohnung nicht; wer sie sendet, ist einstellbar.',
|
||||
executions: [Execution::Automatic, Execution::Portal, Execution::ServiceProvider, Execution::NotRequired],
|
||||
condition: 'bei verbindlichen Buchungen',
|
||||
effects: ['guest_mail'],
|
||||
|
||||
@@ -112,6 +112,10 @@
|
||||
</div>
|
||||
<div style="font-size:.85rem;margin-top:.25rem">{{ $step['purpose'] }}</div>
|
||||
<div style="{{ $muted }};margin-top:.25rem">
|
||||
@if ($step['needs'] !== []) braucht zuerst: {{ implode(', ', $step['needs']) }} · @elseif ($step['on']) läuft unabhängig · @endif
|
||||
@if ($step['after'] !== []) soll nach: {{ implode(', ', $step['after']) }} · @endif
|
||||
@if ($step['condition']) nur wenn: {{ $step['condition'] }} · @endif
|
||||
@if ($step['executions'] !== [] && ! $step['optional']) So darf das erfüllt werden: {{ implode(', ', $step['executions']) }}@if ($step['why']) – {{ $step['why'] }}@endif · @endif
|
||||
Wer: {{ $performers[$step['performer']] ?? $step['performer'] ?? '–' }}
|
||||
@if ($step['waits'] !== []) · kann warten auf: {{ implode(', ', array_map(fn ($wait) => ['guest' => 'Gast', 'portal' => 'Portal', 'landlord' => 'Sie', 'time' => 'Frist'][$wait] ?? $wait, $step['waits'])) }}@endif
|
||||
@if (! $step['on'] && $step['reason']) · <em>übersprungen: {{ $step['reason'] }}</em>@endif
|
||||
@@ -140,7 +144,14 @@
|
||||
|
||||
@foreach ($step['parameters'] as $parameter)
|
||||
<label style="display:block;font-size:.85rem;margin-top:.4rem">{{ $parameter['question'] }}
|
||||
<input type="text" wire:model.live.debounce.600ms="drafts.{{ $this->intake }}.settings.{{ $parameter['key'] }}" placeholder="{{ $parameter['value'] }}" style="{{ $input }};width:8rem;margin-left:.4rem">
|
||||
@if ($parameter['options'])
|
||||
<select wire:model.live="drafts.{{ $this->intake }}.settings.{{ $parameter['key'] }}" style="{{ $input }};margin-left:.4rem">
|
||||
<option value="">wie geerbt</option>
|
||||
@foreach ($parameter['options'] as $value => $label)<option value="{{ $value }}">{{ $label }}</option>@endforeach
|
||||
</select>
|
||||
@else
|
||||
<input type="text" wire:model.live.debounce.600ms="drafts.{{ $this->intake }}.settings.{{ $parameter['key'] }}" placeholder="{{ $parameter['value'] }}" style="{{ $input }};width:8rem;margin-left:.4rem">
|
||||
@endif
|
||||
<span style="{{ $muted }}">wirksam: {{ $parameter['value'] }} ({{ $parameter['source'] }})</span>
|
||||
@if ($parameter['set'])
|
||||
<button type="button" wire:click="inherit('{{ $parameter['key'] }}')" style="{{ $muted }};text-decoration:underline">auf geerbten Wert zurücksetzen</button>
|
||||
@@ -153,14 +164,14 @@
|
||||
</div>
|
||||
|
||||
<x-filament::section heading="Vorschau: ein neuer Vorgang" description="Mit den aktuellen, auch ungespeicherten Einstellungen. Es wird nichts gespeichert und nichts ausgeführt.">
|
||||
<ol style="font-size:.85rem;list-style:decimal;padding-left:1.2rem">
|
||||
<ul style="font-size:.85rem;list-style:disc;padding-left:1.2rem">
|
||||
@foreach ($steps as $step)
|
||||
<li style="{{ $step['on'] ? '' : 'color:#9ca3af;text-decoration:line-through' }}">
|
||||
{{ $step['label'] }}
|
||||
<span style="{{ $muted }}">– {{ $step['on'] ? ($performers[$step['performer']] ?? $step['performer'] ?? '').($step['mode'] ? ', '.(\App\Enums\ProcessingMode::tryFrom($step['mode'])?->getLabel() ?? \App\Enums\DataRequestMode::tryFrom($step['mode'])?->getLabel() ?? $step['mode']) : '') : 'übersprungen: '.$step['reason'] }}</span>
|
||||
</li>
|
||||
@endforeach
|
||||
</ol>
|
||||
</ul>
|
||||
<p style="{{ $muted }};margin-top:.6rem">Gilt für neue Vorgänge. Laufende Vorgänge dieses Kanals ({{ $this->runningCases() }}) behalten ihren bisherigen Ablauf.</p>
|
||||
<x-filament::button color="gray" wire:click="test" style="margin-top:.6rem">Ablauf testen</x-filament::button>
|
||||
<p style="{{ $muted }}">Spielt einen ausgedachten Vorgang mit genau dieser Einstellung durch – ohne Wirkung auf echte Daten.</p>
|
||||
|
||||
@@ -103,6 +103,25 @@ public function test_a_stored_old_setting_becomes_a_derived_capability_and_is_no
|
||||
$page->assertSee('abgeleitet aus Ihrer bisherigen Einstellung');
|
||||
}
|
||||
|
||||
/** The order is shown from the module definitions: dependencies, independence, conditions and how a duty may be fulfilled. */
|
||||
public function test_the_configurator_shows_dependencies_independence_and_allowed_fulfilment(): void
|
||||
{
|
||||
$ds = $this->channel('Destination Solution', []);
|
||||
$this->actingAs(User::factory()->create());
|
||||
|
||||
$steps = collect(Livewire::test(ChannelProcess::class, ['record' => $ds->getRouteKey()])->set('intake', 'booking')->instance()->steps())->keyBy('module');
|
||||
|
||||
$this->assertNotEmpty($steps['documents.send']['needs'], 'the contract documents need something first');
|
||||
$this->assertSame([], $steps['intake.record']['needs'], 'the intake depends on nothing');
|
||||
$this->assertNotNull($steps['documents.booking_notice']['condition']);
|
||||
foreach ($steps as $step) {
|
||||
if ($step['toggle'] === 'mandatory' && $step['executions'] !== []) {
|
||||
$this->assertNotNull($step['why'], $step['module'].': the restriction is explained');
|
||||
}
|
||||
}
|
||||
$this->assertNotEmpty(collect($steps['documents.send']['parameters'])->firstWhere('key', 'contract_delivery')['options']);
|
||||
}
|
||||
|
||||
public function test_saving_a_model_that_overrides_a_stored_setting_needs_the_confirmation_and_is_recorded(): void
|
||||
{
|
||||
$channel = $this->channel('Sonstiges Portal', ['booking' => ['payments' => 'portal', 'guest_messages' => 'portal']]);
|
||||
|
||||
@@ -57,6 +57,9 @@ public function test_every_module_has_a_complete_definition(): void
|
||||
$this->assertNotSame([], $definition->modes, "{$key}: an automatic module names its modes");
|
||||
$this->assertNotSame([], $definition->triggers, "{$key}: an automatic module names its triggers");
|
||||
}
|
||||
if ($definition->toggle === ModuleDefinition::TOGGLE_MANDATORY && $definition->executions !== []) {
|
||||
$this->assertNotNull($definition->why, "{$key}: a mandatory duty states why (shown instead of a lock)");
|
||||
}
|
||||
if ($definition->isTesterOnly()) {
|
||||
$this->assertNotSame([], $definition->points, "{$key}: a tester-only module sits at an extension point");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user