Kommunikation und Formulareditor, sowie Formular Widget #21

Merged
Lars merged 16 commits from develop into main 2026-11-28 08:49:57 +01:00
3 changed files with 9 additions and 5 deletions
Showing only changes of commit a495b0d740 - Show all commits

No files matched your search

@@ -35,7 +35,7 @@ class InquiryFieldResource extends CommunicationResource
protected static ?string $modelLabel = 'Feld';
protected static ?string $pluralModelLabel = 'Felder';
protected static ?string $pluralModelLabel = 'Feldkatalog';
protected static ?string $recordTitleAttribute = 'name';
+6 -2
View File
@@ -126,7 +126,7 @@ private static function rules(): array
])
->collapsible()
->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, '');
return match ($kind) {
'step' => (string) (self::inventory($draft)['steps'][$key] ?? $key),
'field' => (string) (InquiryField::query()->where('key', $key)->value('name') ?? $key),
'group' => (string) (InquiryFieldGroup::query()->where('key', $key)->value('name') ?? $key),
default => $key,
@@ -12,11 +12,11 @@
@foreach ($stepAnswers->groupBy(fn ($answer) => $answer['group'] ?? '') as $group => $groupAnswers)
<section aria-label="{{ trim($step.' '.$group) ?: 'Antworten' }}">
@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
<dl style="display: grid; grid-template-columns: minmax(10rem, 18rem) 1fr; gap: .25rem 1rem; margin: 0;">
@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>
@endforeach
</dl>