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() diff --git a/app/Models/Plant.php b/app/Models/Plant.php index b094a71b..4d590156 100644 --- a/app/Models/Plant.php +++ b/app/Models/Plant.php @@ -19,6 +19,7 @@ class Plant extends Model 'warehouse_number', 'reg_address', 'feed_address', + 'tollfree', ]; public function company(): BelongsTo @@ -196,10 +197,10 @@ class Plant extends Model return $this->hasMany(TempStopCharacteristic::class, 'plant_id', 'id'); } - public function laserAxisPositionMasters() - { - return $this->hasMany(LaserAxisPositionMaster::class, 'plant_id', 'id'); - } + // public function laserAxisPositionMasters() + // { + // return $this->hasMany(LaserAxisPositionMaster::class, 'plant_id', 'id'); + // } public function users() { diff --git a/database/migrations/2026_10_21_110213_add_tollfree_column_to_plants.php b/database/migrations/2026_10_21_110213_add_tollfree_column_to_plants.php new file mode 100644 index 00000000..733e8f42 --- /dev/null +++ b/database/migrations/2026_10_21_110213_add_tollfree_column_to_plants.php @@ -0,0 +1,31 @@ +