Commented disabled functionality for line, group work center, work center and clear when needed
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Laravel Pint / pint (pull_request) Successful in 3m3s
Laravel Larastan / larastan (pull_request) Failing after 3m53s
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Laravel Pint / pint (pull_request) Successful in 3m3s
Laravel Larastan / larastan (pull_request) Failing after 3m53s
This commit is contained in:
@@ -59,6 +59,10 @@ class ProductCharacteristicsMasterResource extends Resource
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
$set('item_id', null);
|
||||
$set('line_id', null);
|
||||
$set('work_group_master_id', null);
|
||||
$set('machine_id', null);
|
||||
})
|
||||
->reactive()
|
||||
->required(),
|
||||
@@ -78,6 +82,9 @@ class ProductCharacteristicsMasterResource extends Resource
|
||||
->disabled(fn (Get $get) => ! empty($get('id')))
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
$set('line_id', null);
|
||||
$set('work_group_master_id', null);
|
||||
$set('machine_id', null);
|
||||
})
|
||||
->rules([
|
||||
function (callable $get) {
|
||||
@@ -112,16 +119,14 @@ class ProductCharacteristicsMasterResource extends Resource
|
||||
|
||||
return Line::where('plant_id', $plantId)->pluck('name', 'id');
|
||||
})
|
||||
->disabled(fn (Get $get) => ! empty($get('id')))
|
||||
// ->disabled(fn (Get $get) => ! empty($get('id')))
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('machine_id', null);
|
||||
if (! $get('work_group_master_id')) {
|
||||
$set('machine_id', null);
|
||||
}
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
$set('work_group_master_id', null);
|
||||
$set('machine_id', null);
|
||||
})
|
||||
// ->relationship('line', 'name'),
|
||||
->required(),
|
||||
// ->relationship('line', 'name'),
|
||||
Forms\Components\Select::make('work_group_master_id')
|
||||
->label('Group Work Center')
|
||||
->required()
|
||||
@@ -143,13 +148,13 @@ class ProductCharacteristicsMasterResource extends Resource
|
||||
|
||||
return WorkGroupMaster::where('plant_id', $get('plant_id'))->whereIn('id', $workGroupIds)->pluck('name', 'id')->toArray();
|
||||
})
|
||||
->disabled(fn (Get $get) => ! empty($get('id')))
|
||||
// ->disabled(fn (Get $get) => ! empty($get('id')))
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$lineId = $get('line_id');
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
$set('machine_id', null);
|
||||
if (! $lineId) {
|
||||
$set('mGroupWorkError', 'Please select a line first.');
|
||||
$set('machine_id', null);
|
||||
|
||||
return;
|
||||
} else {
|
||||
@@ -161,13 +166,12 @@ class ProductCharacteristicsMasterResource extends Resource
|
||||
// return;
|
||||
// }
|
||||
$set('mGroupWorkError', null);
|
||||
$set('machine_id', null);
|
||||
}
|
||||
})
|
||||
->extraAttributes(fn ($get) => [
|
||||
'class' => $get('mGroupWorkError') ? 'border-red-500' : '',
|
||||
])
|
||||
// ->dehydrateStateUsing(fn ($state) => null)
|
||||
// ->dehydrateStateUsing(fn ($state) => null)
|
||||
->hint(fn ($get) => $get('mGroupWorkError') ? $get('mGroupWorkError') : null)
|
||||
->hintColor('danger'),
|
||||
Forms\Components\Select::make('machine_id')
|
||||
@@ -189,7 +193,7 @@ class ProductCharacteristicsMasterResource extends Resource
|
||||
->where('work_group_master_id', $workGroupId)
|
||||
->pluck('work_center', 'id');
|
||||
})
|
||||
->disabled(fn (Get $get) => ! empty($get('id')))
|
||||
// ->disabled(fn (Get $get) => ! empty($get('id')))
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
if (! $get('plant_id') || ! $get('line_id') || ! $get('work_group_master_id')) {
|
||||
$set('machine_id', null);
|
||||
@@ -236,6 +240,7 @@ class ProductCharacteristicsMasterResource extends Resource
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->required(),
|
||||
|
||||
// Forms\Components\Select::make('result')
|
||||
// ->label('Visual Type')
|
||||
// ->reactive()
|
||||
@@ -253,6 +258,7 @@ class ProductCharacteristicsMasterResource extends Resource
|
||||
// session()->put('temp_result', $state);
|
||||
// })
|
||||
// ->hidden(fn (callable $get) => $get('inspection_type') != 'Visual'),
|
||||
|
||||
Forms\Components\TextInput::make('lower')
|
||||
->label('Lower')
|
||||
->numeric()
|
||||
|
||||
Reference in New Issue
Block a user