Added subassembly code in resource page of motor testing master
This commit is contained in:
@@ -28,9 +28,9 @@ class MotorTestingMasterResource extends Resource
|
|||||||
|
|
||||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||||
|
|
||||||
protected static ?string $navigationGroup = 'Master Entries';
|
protected static ?string $navigationGroup = 'Testing Panel';
|
||||||
|
|
||||||
protected static ?int $navigationSort = 12;
|
protected static ?int $navigationSort = 1;
|
||||||
|
|
||||||
public static function form(Form $form): Form
|
public static function form(Form $form): Form
|
||||||
{
|
{
|
||||||
@@ -61,6 +61,11 @@ class MotorTestingMasterResource extends Resource
|
|||||||
])
|
])
|
||||||
->hint(fn ($get) => $get('mTmError') ? $get('mTmError') : null)
|
->hint(fn ($get) => $get('mTmError') ? $get('mTmError') : null)
|
||||||
->hintColor('danger'),
|
->hintColor('danger'),
|
||||||
|
Forms\Components\TimePicker::make('routine_test_time')
|
||||||
|
->label('Routine Test Time')
|
||||||
|
->default('00:40:00')
|
||||||
|
->required()
|
||||||
|
->reactive(),
|
||||||
Forms\Components\Select::make('item_id')
|
Forms\Components\Select::make('item_id')
|
||||||
->label('Item Code')
|
->label('Item Code')
|
||||||
//->relationship('item', 'name')
|
//->relationship('item', 'name')
|
||||||
@@ -82,11 +87,40 @@ class MotorTestingMasterResource extends Resource
|
|||||||
->where('plant_id', $get('plant_id'))
|
->where('plant_id', $get('plant_id'))
|
||||||
->ignore($get('id')); // Ignore current record during updates
|
->ignore($get('id')); // Ignore current record during updates
|
||||||
}),
|
}),
|
||||||
Forms\Components\TimePicker::make('routine_test_time')
|
Forms\Components\TextInput::make('subassembly_code')
|
||||||
->label('Routine Test Time')
|
->label('Subassembly Code')
|
||||||
->default('00:40:00')
|
|
||||||
->required()
|
->required()
|
||||||
->reactive(),
|
->placeholder('Scan the valid code')
|
||||||
|
->reactive()
|
||||||
|
->alphaNum()
|
||||||
|
->minLength(6)
|
||||||
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
|
$code = $get('subassembly_code');
|
||||||
|
// Ensure `linestop_id` is not cleared
|
||||||
|
if (!$code) {
|
||||||
|
$set('iCodeError', 'Scan the valid Subassembly Code.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (strlen($code) < 6) {
|
||||||
|
$set('iCodeError', 'Subassembly code must be at least 6 digits.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (!preg_match('/^[a-zA-Z0-9]{6,}$/', $code)) {
|
||||||
|
$set('code',null);
|
||||||
|
$set('iCodeError', 'Subassembly code must contain only alpha-numeric characters.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$set('iCodeError', null);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
->extraAttributes(fn ($get) => [
|
||||||
|
'class' => $get('iCodeError') ? 'border-red-500' : '',
|
||||||
|
])
|
||||||
|
->hint(fn ($get) => $get('iCodeError') ? $get('iCodeError') : null)
|
||||||
|
->hintColor('danger'),
|
||||||
|
|
||||||
Forms\Components\Select::make('isi_model')
|
Forms\Components\Select::make('isi_model')
|
||||||
->label('ISI Model')
|
->label('ISI Model')
|
||||||
->options([
|
->options([
|
||||||
@@ -296,6 +330,11 @@ class MotorTestingMasterResource extends Resource
|
|||||||
->searchable()
|
->searchable()
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('subassembly_code')
|
||||||
|
->label('SubAssembly Code')
|
||||||
|
->searchable()
|
||||||
|
->alignCenter()
|
||||||
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('item.description')
|
Tables\Columns\TextColumn::make('item.description')
|
||||||
->label('Model')
|
->label('Model')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
|
|||||||
Reference in New Issue
Block a user