ranjith-dev #349

Merged
jothi merged 5 commits from ranjith-dev into master 2026-02-19 06:13:06 +00:00
Showing only changes of commit fd1c3a8094 - Show all commits

View File

@@ -5,6 +5,7 @@ namespace App\Filament\Resources;
use App\Filament\Exports\LineExporter;
use App\Filament\Imports\LineImporter;
use App\Filament\Resources\LineResource\Pages;
use App\Models\Block;
use App\Models\Line;
use App\Models\Plant;
use App\Models\WorkGroupMaster;
@@ -71,6 +72,38 @@ class LineResource extends Resource
])
->hint(fn ($get) => $get('lPlantError') ? $get('lPlantError') : null)
->hintColor('danger'),
Forms\Components\Select::make('block_id')
->label('Block')
->relationship('block', 'name')
->required()
// ->nullable(),
->reactive()
->options(function (callable $get) {
if (! $get('plant_id')) {
return [];
}
return Block::where('plant_id', $get('plant_id'))
->pluck('name', 'id')
->toArray();
})
->default(function () {
return optional(Block::latest()->first())->plant_id;
})
->afterStateUpdated(function ($state, callable $set, callable $get) {
$blockId = $get('block_id');
if (! $blockId) {
$set('lblockError', 'Please select a Block first.');
return;
} else {
$set('lblockError', null);
}
})
->extraAttributes(fn ($get) => [
'class' => $get('lblockError') ? 'border-red-500' : '',
])
->hint(fn ($get) => $get('lblockError') ? $get('lblockError') : null)
->hintColor('danger'),
Forms\Components\TextInput::make('name')
->required()
->placeholder('Scan the valid name')
@@ -1012,6 +1045,11 @@ class LineResource extends Resource
->alignCenter()
->sortable()
->searchable(),
Tables\Columns\TextColumn::make('block.name')
->label('Block')
->alignCenter()
->sortable()
->searchable(),
Tables\Columns\TextColumn::make('name')
->label('Line')
->alignCenter()