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

@@ -21,12 +21,63 @@ class ProductionPlanResource extends Resource
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
protected static ?string $navigationGroup = 'Master Entries';
// protected static ?string $navigationParentItem = 'Production Line Stops';
protected static ?string $navigationGroup = 'Production';
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Select::make('plant_id')
->relationship('plant', 'name')
->required()
->nullable()
->reactive(),
Forms\Components\Select::make('block_name')
->required()
->nullable()
->reactive()
->afterStateUpdated(fn ($set) => $set('shift_id', null)),
Forms\Components\Select::make('shift_id')
->relationship('shift', 'name')
->required()
->nullable()
// ->options(fn (callable $get) =>
// \App\Models\Shift::where('plant_id', $get('plant_id'))
// ->pluck('name', 'id')
// ->toArray() // Convert collection to array
// )
->options(function (callable $get) {
if (!$get('plant_id')) {
return [];
}
return \App\Models\Shift::where('plant_id', $get('plant_id'))
->pluck('name', 'id')
->toArray();
})
->reactive()
->afterStateUpdated(fn ($set) => $set('line_id', null)),
Forms\Components\Select::make('line_id')
->relationship('line', 'name')
->required()
->nullable()
// ->options(fn (callable $get) =>
// \App\Models\Line::where('plant_id', $get('plant_id'))
// ->pluck('name', 'id')
// ->toArray() // Convert collection to array
// )
->options(function (callable $get) {
if (!$get('plant_id')) {
return [];
}
return \App\Models\Line::where('plant_id', $get('plant_id'))
->pluck('name', 'id')
->toArray();
})
->reactive(),
Forms\Components\TextInput::make('plan_quantity')
->required()
->numeric()
@@ -36,15 +87,7 @@ class ProductionPlanResource extends Resource
->numeric()
->readOnly()
->default(0),
Forms\Components\Select::make('plant_id')
->relationship('plant', 'name')
->required(),
Forms\Components\Select::make('shift_id')
->relationship('shift', 'name')
->required(),
Forms\Components\Select::make('line_id')
->relationship('line', 'name')
->required(),
]);
}