From 8c362bd83f6fadfb9d3513ae07cd9575714d86ed Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Fri, 29 May 2026 15:39:51 +0530 Subject: [PATCH] Updated error logic on plant change --- app/Filament/Resources/WorkGroupMasterResource.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/Filament/Resources/WorkGroupMasterResource.php b/app/Filament/Resources/WorkGroupMasterResource.php index b1d7f2c..8b21ab2 100644 --- a/app/Filament/Resources/WorkGroupMasterResource.php +++ b/app/Filament/Resources/WorkGroupMasterResource.php @@ -56,17 +56,20 @@ class WorkGroupMasterResource extends Resource ->afterStateUpdated(function ($state, $set, callable $get) { $plantId = $get('plant_id'); - $set('pqPlantError', null); + $set('wgmPlantError', null); $set('name', null); $set('description', null); $set('operation_number', null); if (! $plantId) { - $set('pqPlantError', 'Please select a plant first.'); + $set('wgmPlantError', 'Please select a plant first.'); return; } }) - ->hint(fn ($get) => $get('pqPlantError') ? $get('pqPlantError') : null) + ->extraAttributes(fn ($get) => [ + 'class' => $get('wgmPlantError') ? 'border-red-500' : '', + ]) + ->hint(fn ($get) => $get('wgmPlantError') ? $get('wgmPlantError') : null) ->hintColor('danger'), Forms\Components\TextInput::make('name') ->label('Group Work Center')