diff --git a/app/Filament/Resources/Communication/Fields/InquiryFieldResource.php b/app/Filament/Resources/Communication/Fields/InquiryFieldResource.php index f014c6c..6cae064 100644 --- a/app/Filament/Resources/Communication/Fields/InquiryFieldResource.php +++ b/app/Filament/Resources/Communication/Fields/InquiryFieldResource.php @@ -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'; diff --git a/app/Filament/Support/TemplateEditor.php b/app/Filament/Support/TemplateEditor.php index 86ad2a1..4a13a25 100644 --- a/app/Filament/Support/TemplateEditor.php +++ b/app/Filament/Support/TemplateEditor.php @@ -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 $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, diff --git a/resources/views/filament/communication/answers.blade.php b/resources/views/filament/communication/answers.blade.php index 65bf8ff..cb33a06 100644 --- a/resources/views/filament/communication/answers.blade.php +++ b/resources/views/filament/communication/answers.blade.php @@ -12,11 +12,11 @@ @foreach ($stepAnswers->groupBy(fn ($answer) => $answer['group'] ?? '') as $group => $groupAnswers)
@if ($group !== '' || $step !== '') -

{{ $step }}@if ($group !== '' && $group !== null) · {{ $group }}@endif

+

{{ $step }}@if ($group !== '' && $group !== null) · {{ $group }}@endif

@endif
@foreach ($groupAnswers as $answer) -
{{ $answer['label'] }}
+
{{ $answer['label'] }}
{{ $answer['display'] }}
@endforeach