diff --git a/app/Filament/Resources/PlantResource.php b/app/Filament/Resources/PlantResource.php index ef54fb96..6a9acec1 100644 --- a/app/Filament/Resources/PlantResource.php +++ b/app/Filament/Resources/PlantResource.php @@ -230,6 +230,29 @@ class PlantResource extends Resource ]) ->hint(fn ($get) => $get('pFeedAddressError') ? $get('pRegAddressError') : null) ->hintColor('danger'), + Forms\Components\Textarea::make('tollfree') + ->label('Tollfree') + ->placeholder('Scan the valid Tollfree') + ->unique(ignoreRecord: true) + ->columnSpanFull() + ->reactive() + ->minLength(5) + ->afterStateUpdated(function ($state, callable $set, callable $get) { + $nameId = $get('tollfree'); + // Ensure `linestop_id` is not cleared + if (! $nameId) { + $set('pTollfreeError', 'Scan the valid tollfree.'); + + return; + } else { + $set('pTollfreeError', null); + } + }) + ->extraAttributes(fn ($get) => [ + 'class' => $get('pTollfreeError') ? 'border-red-500' : '', + ]) + ->hint(fn ($get) => $get('pTollfreeError') ? $get('pTollfreeError') : null) + ->hintColor('danger'), Forms\Components\TextInput::make('id') ->hidden() ->readOnly(), @@ -289,6 +312,11 @@ class PlantResource extends Resource ->alignCenter() ->sortable() ->searchable(), + Tables\Columns\TextColumn::make('tollfree') + ->label('Tollfree') + ->alignCenter() + ->sortable() + ->searchable(), Tables\Columns\TextColumn::make('company.name') ->label('Company') ->alignCenter()