After Production Quantity and Overall Validation

This commit is contained in:
dhanabalan
2025-03-30 23:04:29 +05:30
parent e46f290fd1
commit 6e44b690f1
16 changed files with 1726 additions and 407 deletions

View File

@@ -13,6 +13,7 @@ use Filament\Tables\Actions\ImportAction;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Filament\Forms\Components\Section;
class BlockResource extends Resource
{
@@ -22,18 +23,60 @@ class BlockResource extends Resource
protected static ?string $navigationGroup = 'Master Entries';
protected static ?int $navigationSort = 3;
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('name')
->required(),
// ->unique(ignoreRecord: true),
// ->columnSpanFull(),
Forms\Components\Select::make('plant_id')
->relationship('plant', 'name')
// ->unique(ignoreRecord: true)
->required(),
Section::make('')
->schema([
Forms\Components\TextInput::make('name')
->required()
->unique(ignoreRecord: true)
->placeholder('Scan the valid name')
->reactive()
->afterStateUpdated(function ($state, callable $set, callable $get) {
$nameId = $get('name');
// Ensure `linestop_id` is not cleared
if (!$nameId) {
$set('bNameError', 'Scan the valid name.');
return;
}
else
{
$set('bNameError', null);
}
})
->extraAttributes(fn ($get) => [
'class' => $get('bNameError') ? 'border-red-500' : '',
])
->hint(fn ($get) => $get('bNameError') ? $get('bNameError') : null)
->hintColor('danger'),
Forms\Components\Select::make('plant_id')
->relationship('plant', 'name')
// ->unique(ignoreRecord: true)
->required()
->reactive()
->afterStateUpdated(function ($state, callable $set, callable $get) {
$nameId = $get('plant_id');
// Ensure `linestop_id` is not cleared
if (!$nameId) {
$set('bPlantError', 'Please select a plant first.');
return;
}
else
{
$set('bPlantError', null);
}
})
->extraAttributes(fn ($get) => [
'class' => $get('bPlantError') ? 'border-red-500' : '',
])
->hint(fn ($get) => $get('bPlantError') ? $get('bPlantError') : null)
->hintColor('danger'),
])
->columns(2),
]);
}