From 49bff7f2a77c37978b0add20b7809a71647a5e14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9Cmit=20Tun=C3=A7?= Date: Sat, 1 Nov 2025 17:53:55 -0300 Subject: [PATCH] Enhance item label handling in SectionTemplatesSection: Updated the itemLabel method to dynamically retrieve the title of the associated SectionTemplate based on the section_template_id. This improvement ensures accurate labeling in the Repeater component, enhancing user experience and clarity in the form structure. --- .../Schemas/Sections/SectionTemplatesSection.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/Filament/Admin/Resources/Pages/Schemas/Sections/SectionTemplatesSection.php b/app/Filament/Admin/Resources/Pages/Schemas/Sections/SectionTemplatesSection.php index 631ae32..1260774 100644 --- a/app/Filament/Admin/Resources/Pages/Schemas/Sections/SectionTemplatesSection.php +++ b/app/Filament/Admin/Resources/Pages/Schemas/Sections/SectionTemplatesSection.php @@ -4,6 +4,7 @@ namespace App\Filament\Admin\Resources\Pages\Schemas\Sections; use App\Models\SectionTemplate; use App\Services\TemplateService; +use Filament\Forms\Components\Actions\Action; use Filament\Forms\Components\Repeater; use Filament\Forms\Components\Select; use Filament\Schemas\Components\Group; @@ -112,7 +113,15 @@ class SectionTemplatesSection ->reorderable() ->collapsible() ->collapsed() - ->itemLabel(__('pages.template_section')) + ->itemLabel(function (array $state): ?string { + if (!isset($state['section_template_id'])) { + return __('pages.template_section'); + } + + $template = SectionTemplate::find($state['section_template_id']); + return $template ? $template->title : __('pages.template_section'); + }) + ->columnSpanFull(), ]) ->columnSpanFull()