Konfigurator: Ablauf im Zusammenhang aus dem Plan, Nachrichtenregeln, einheitliche Anfrage-/Buchungsansicht; Abnahmetests
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
221ce8ca81
commit
b1b09a6db4
7 files changed
+616
-36
No files matched your search
@@ -269,10 +269,12 @@ public function conflicts(Channel $channel, IntakeKind $intake, string $modelKey
|
||||
|
||||
// A model with slots does not narrow the guest communication itself: the portal's capability does.
|
||||
$messages = $model->slots() === [] ? null : (app(ChannelCapabilities::class)->resolve($channel)[ChannelCapabilities::MESSAGES_GUEST] ?? null);
|
||||
$storedMessages = ProcessSetting::GuestMessages->normalize($stored[ProcessSetting::GuestMessages->value] ?? null);
|
||||
if ($messages !== null && $messages->isKnown() && $messages->value === false && $storedMessages === Responsibility::Portal->value) {
|
||||
$conflicts[] = ['setting' => ProcessSetting::GuestMessages, 'stored' => ProcessSetting::GuestMessages->describe($storedMessages), 'fixed' => ProcessSetting::GuestMessages->describe(Responsibility::Landlord->value),
|
||||
'text' => ProcessSetting::GuestMessages->question().' Bisher eingestellt: „'.ProcessSetting::GuestMessages->describe($storedMessages).'“. Laut Fähigkeit des Portals schreibt es den Gast aber nicht an; künftig: „'.ProcessSetting::GuestMessages->describe(Responsibility::Landlord->value).'“.'];
|
||||
foreach ($model->slots() === [] ? [] : [ProcessSetting::GuestMessages, ProcessSetting::ArrivalInfoSender, ProcessSetting::ReviewRequestSender] as $sender) {
|
||||
$storedSender = $sender->normalize($stored[$sender->value] ?? null);
|
||||
if ($messages !== null && $messages->isKnown() && $messages->value === false && $storedSender === Responsibility::Portal->value) {
|
||||
$conflicts[] = ['setting' => $sender, 'stored' => $sender->describe($storedSender), 'fixed' => $sender->describe(Responsibility::Landlord->value),
|
||||
'text' => $sender->question().' Bisher eingestellt: „'.$sender->describe($storedSender).'“. Laut Fähigkeit des Portals schreibt es den Gast aber nicht an; künftig: „'.$sender->describe(Responsibility::Landlord->value).'“.'];
|
||||
}
|
||||
}
|
||||
|
||||
return $conflicts;
|
||||
@@ -506,8 +508,10 @@ private function templateProblems(Channel $channel, ProcessModel $model, array $
|
||||
}
|
||||
}
|
||||
$messages = app(ChannelCapabilities::class)->resolve($channel, $capabilities)[ChannelCapabilities::MESSAGES_GUEST] ?? null;
|
||||
if (($draft['settings'][ProcessSetting::GuestMessages->value] ?? null) === Responsibility::Portal->value && $messages !== null && $messages->isKnown() && $messages->value === false) {
|
||||
$problems[] = 'Gastkommunikation durch das Portal ist eingestellt, das Portal schreibt den Gast laut bestätigter Fähigkeit aber nicht an.';
|
||||
foreach ([ProcessSetting::GuestMessages, ProcessSetting::ArrivalInfoSender, ProcessSetting::ReviewRequestSender] as $sender) {
|
||||
if (($draft['settings'][$sender->value] ?? null) === Responsibility::Portal->value && $messages !== null && $messages->isKnown() && $messages->value === false) {
|
||||
$problems[] = $sender->question().' „Das Portal“ ist eingestellt, das Portal schreibt den Gast laut Fähigkeit aber nicht an.';
|
||||
}
|
||||
}
|
||||
|
||||
return $problems;
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Process;
|
||||
|
||||
use App\Process\Modules\ModuleDefinition;
|
||||
|
||||
/**
|
||||
* The course of a resolved plan as the runner executes it: which steps start at once and run in parallel, which wait
|
||||
* for others, which are conditional, event-driven or time-driven. Derived only from the same facts the
|
||||
* {@see ProcessRunner} uses – the hard dependencies among the steps that are in the plan and apply, `applies()` (as the
|
||||
* preview row's reason), the trigger kinds and what a step waits for. No grouping by phase, no hand-written text.
|
||||
* Pure: it reads, it never changes anything.
|
||||
*/
|
||||
final class ProcessLanes
|
||||
{
|
||||
public function __construct(private ProcessCatalogue $catalogue) {}
|
||||
|
||||
/**
|
||||
* @param list<array{module: string, label: string, on: bool, reason: ?string}> $rows the preview rows of a draft (ChannelProcessConfiguration::preview)
|
||||
* @return array{parallel: list<array{module: string, label: string, note: ?string}>, waiting: list<array{module: string, label: string, note: ?string, after: list<string>}>, event: list<array{module: string, label: string, note: ?string}>, later: list<array{module: string, label: string, note: ?string}>, off: list<array{module: string, label: string, note: ?string}>}
|
||||
*/
|
||||
public function of(array $rows): array
|
||||
{
|
||||
$active = [];
|
||||
foreach ($rows as $row) {
|
||||
if ($row['on']) {
|
||||
$active[$row['module']] = $row['label'];
|
||||
}
|
||||
}
|
||||
$lanes = ['parallel' => [], 'waiting' => [], 'event' => [], 'later' => [], 'off' => []];
|
||||
|
||||
foreach ($rows as $row) {
|
||||
$definition = $this->catalogue->modules()[$row['module']]::definition();
|
||||
if (! $row['on']) {
|
||||
$lanes['off'][] = ['module' => $row['module'], 'label' => $row['label'], 'note' => $row['reason']];
|
||||
|
||||
continue;
|
||||
}
|
||||
if ($row['module'] === 'intake.record') {
|
||||
continue;
|
||||
}
|
||||
$hard = array_values(array_map(fn ($dependency): string => $active[$dependency->module], array_filter($definition->requires, fn ($dependency): bool => $dependency->hard && $dependency->module !== 'intake.record' && isset($active[$dependency->module]))));
|
||||
$item = ['module' => $row['module'], 'label' => $row['label'], 'note' => $this->note($definition)];
|
||||
|
||||
$lanes[match (true) {
|
||||
$hard !== [] => 'waiting',
|
||||
$definition->toggle === ModuleDefinition::TOGGLE_EVENT_DRIVEN => 'event',
|
||||
$definition->triggers !== [] && collect($definition->triggers)->every(fn (string $trigger): bool => str_starts_with($trigger, 'schedule:')) => 'later',
|
||||
default => 'parallel',
|
||||
}][] = $hard !== [] ? [...$item, 'after' => $hard] : $item;
|
||||
}
|
||||
|
||||
return $lanes;
|
||||
}
|
||||
|
||||
private function note(ModuleDefinition $definition): ?string
|
||||
{
|
||||
$waits = array_map(fn (string $wait): string => ['guest' => 'den Gast', 'portal' => 'das Portal', 'landlord' => 'Sie', 'time' => 'eine Frist'][$wait] ?? $wait, $definition->waits);
|
||||
|
||||
return $waits === [] ? null : 'kann warten auf '.implode(', ', $waits);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user