After Production Quantity and Overall Validation
This commit is contained in:
@@ -21,6 +21,8 @@ class StickerMasterResource extends Resource
|
||||
|
||||
protected static ?string $navigationGroup = 'Master Entries';
|
||||
|
||||
protected static ?int $navigationSort = 8;
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
@@ -28,17 +30,27 @@ class StickerMasterResource extends Resource
|
||||
Forms\Components\Select::make('plant_id')
|
||||
->relationship('plant', 'name')
|
||||
->reactive()
|
||||
->afterStateUpdated(fn (callable $set) => $set('item_id', null))
|
||||
->nullable()
|
||||
->afterStateUpdated(fn (callable $set) =>
|
||||
$set('item_id', null) & $set('item_description', null)
|
||||
)
|
||||
->required(),
|
||||
|
||||
Forms\Components\Select::make('item_id')
|
||||
->label('Item Code')
|
||||
->options(fn (callable $get) =>
|
||||
\App\Models\Item::where('plant_id', $get('plant_id'))
|
||||
->pluck('code', 'id')
|
||||
)
|
||||
->options(function (callable $get) {
|
||||
if (!$get('plant_id')) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return \App\Models\Item::where('plant_id', $get('plant_id'))
|
||||
->pluck('code', 'id')
|
||||
->toArray();
|
||||
})
|
||||
->required()
|
||||
->nullable()
|
||||
->searchable()
|
||||
->reactive()
|
||||
->live(debounce: 500) // Enable live updates
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$plantId = $get('plant_id'); // Get selected plant_id
|
||||
@@ -180,11 +192,9 @@ class StickerMasterResource extends Resource
|
||||
->label('ID')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('item.id')
|
||||
->numeric()
|
||||
Tables\Columns\TextColumn::make('item.code')
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('plant.name')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
Tables\Columns\CheckboxColumn::make('serial_number_motor')
|
||||
->disabled(true)
|
||||
|
||||
Reference in New Issue
Block a user