Benenne den Feldkatalog, zeige Schrittnamen in Regeln und gliedere die Antworten im Posteingang
CI Feature / test (push) Successful in 4m9s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Sonnet 5.5 committed 2026-11-27 18:03:45 +01:00
1 parent 22f8afdcd6
commit a495b0d740
3 files changed
+9 -5

No files matched your search

@@ -35,7 +35,7 @@ class InquiryFieldResource extends CommunicationResource
protected static ?string $modelLabel = 'Feld'; protected static ?string $modelLabel = 'Feld';
protected static ?string $pluralModelLabel = 'Felder'; protected static ?string $pluralModelLabel = 'Feldkatalog';
protected static ?string $recordTitleAttribute = 'name'; protected static ?string $recordTitleAttribute = 'name';
+6 -2
View File
@@ -126,7 +126,7 @@ private static function rules(): array
]) ])
->collapsible() ->collapsible()
->addActionLabel('Regel hinzufügen') ->addActionLabel('Regel hinzufügen')
->itemLabel(fn (array $state): string => (TemplateCompiler::EFFECTS[$state['effect'] ?? ''] ?? 'Neue Regel').($state['target'] ?? null ? ' → '.self::targetName((string) $state['target']) : '')), ->itemLabel(fn (array $state, $livewire): string => (TemplateCompiler::EFFECTS[$state['effect'] ?? ''] ?? 'Neue Regel').(($state['target'] ?? null) ? ' → '.self::targetName((string) $state['target'], (array) ($livewire->data['draft'] ?? [])) : '')),
]), ]),
]; ];
} }
@@ -224,11 +224,15 @@ private static function targets(array $draft, string $effect): array
}; };
} }
private static function targetName(string $target): string /**
* @param array<string, mixed> $draft
*/
private static function targetName(string $target, array $draft = []): string
{ {
[$kind, $key] = array_pad(explode(':', $target, 2), 2, ''); [$kind, $key] = array_pad(explode(':', $target, 2), 2, '');
return match ($kind) { return match ($kind) {
'step' => (string) (self::inventory($draft)['steps'][$key] ?? $key),
'field' => (string) (InquiryField::query()->where('key', $key)->value('name') ?? $key), 'field' => (string) (InquiryField::query()->where('key', $key)->value('name') ?? $key),
'group' => (string) (InquiryFieldGroup::query()->where('key', $key)->value('name') ?? $key), 'group' => (string) (InquiryFieldGroup::query()->where('key', $key)->value('name') ?? $key),
default => $key, default => $key,
@@ -12,11 +12,11 @@
@foreach ($stepAnswers->groupBy(fn ($answer) => $answer['group'] ?? '') as $group => $groupAnswers) @foreach ($stepAnswers->groupBy(fn ($answer) => $answer['group'] ?? '') as $group => $groupAnswers)
<section aria-label="{{ trim($step.' '.$group) ?: 'Antworten' }}"> <section aria-label="{{ trim($step.' '.$group) ?: 'Antworten' }}">
@if ($group !== '' || $step !== '') @if ($group !== '' || $step !== '')
<h3 class="text-sm font-semibold text-gray-700" style="margin-bottom: .25rem;">{{ $step }}@if ($group !== '' && $group !== null) · {{ $group }}@endif</h3> <h3 style="margin-bottom: .25rem; font-weight: 600;">{{ $step }}@if ($group !== '' && $group !== null) · {{ $group }}@endif</h3>
@endif @endif
<dl style="display: grid; grid-template-columns: minmax(10rem, 18rem) 1fr; gap: .25rem 1rem; margin: 0;"> <dl style="display: grid; grid-template-columns: minmax(10rem, 18rem) 1fr; gap: .25rem 1rem; margin: 0;">
@foreach ($groupAnswers as $answer) @foreach ($groupAnswers as $answer)
<dt class="text-sm text-gray-600">{{ $answer['label'] }}</dt> <dt style="color: #6b7280;">{{ $answer['label'] }}</dt>
<dd style="margin: 0; white-space: pre-line;">{{ $answer['display'] }}</dd> <dd style="margin: 0; white-space: pre-line;">{{ $answer['display'] }}</dd>
@endforeach @endforeach
</dl> </dl>