1
0
forked from poc/pds

Import Fun Completed and Sticker Master

This commit is contained in:
dhanabalan
2025-03-28 16:52:40 +05:30
parent ef4504155a
commit e46f290fd1
47 changed files with 1317 additions and 335 deletions

View File

@@ -28,6 +28,10 @@ class ItemResource extends Resource
{
return $form
->schema([
Forms\Components\Select::make('plant_id')
->relationship('plant', 'name')
->required(),
// ->nullable(),
Forms\Components\TextInput::make('code')
->required()
->unique(ignoreRecord: true)
@@ -38,38 +42,8 @@ class ItemResource extends Resource
->numeric()
->minValue(1),
Forms\Components\Textarea::make('description')
->required()
->columnSpanFull(),
Forms\Components\Select::make('plant_id')
->relationship('plant', 'name')
->required()
->reactive()
->afterStateUpdated(fn ($set) => $set('block_id', null)), // Reset block_id when plant changes
Forms\Components\Select::make('block_id')
->relationship('block', 'name')
->required()
->options(fn (callable $get) =>
\App\Models\Block::where('plant_id', $get('plant_id'))
->pluck('name', 'id')
->toArray() // Convert collection to array
)
->reactive(), // Ensures the dropdown updates when plant_id changes
// Forms\Components\Select::make('plant_id')
// ->relationship('plant', 'name')
// ->required()
// ->reactive(),
// Forms\Components\Select::make('block_id')
// ->relationship('block', 'name')
// ->required()
// ->options(fn (callable $get) =>
// \App\Models\Block::where('plant_id', $get('plant_id'))->pluck('name', 'id')
// )
// ->reactive() // Updates dynamically when plant_id changes
// ->afterStateUpdated(fn ($set) => $set('block_id', null)), // Reset block_id when plant_id changes
Forms\Components\Select::make('line_id')
->relationship('line', 'name')
->required(),
// ->columnSpanFull(),
]);
}
@@ -88,10 +62,6 @@ class ItemResource extends Resource
->sortable(),
Tables\Columns\TextColumn::make('description')
->sortable(),
Tables\Columns\TextColumn::make('line.name')
->sortable(),
Tables\Columns\TextColumn::make('block.name')
->sortable(),
Tables\Columns\TextColumn::make('plant.name')
->sortable(),
Tables\Columns\TextColumn::make('created_at')