Updated rule parameters on unique item and setting default value and removed visible hide function
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
This commit is contained in:
@@ -86,7 +86,8 @@ class ProductCharacteristicsMasterResource extends Resource
|
|||||||
->where('line_id', $get('line_id'))
|
->where('line_id', $get('line_id'))
|
||||||
->where('work_group_master_id', $get('work_group_master_id'))
|
->where('work_group_master_id', $get('work_group_master_id'))
|
||||||
->where('machine_id', $get('machine_id'))
|
->where('machine_id', $get('machine_id'))
|
||||||
// ->where('characteristics_type', $get('characteristics_type'))
|
->where('characteristics_type', $get('characteristics_type'))
|
||||||
|
->where('name', $get('name'))
|
||||||
->ignore($get('id'));
|
->ignore($get('id'));
|
||||||
},
|
},
|
||||||
// function (callable $get): Closure {
|
// function (callable $get): Closure {
|
||||||
@@ -227,6 +228,11 @@ class ProductCharacteristicsMasterResource extends Resource
|
|||||||
// ->preload()
|
// ->preload()
|
||||||
->disabled(fn (Get $get) => ! empty($get('id') && ! Filament::auth()->user()->hasRole('Super Admin')))
|
->disabled(fn (Get $get) => ! empty($get('id') && ! Filament::auth()->user()->hasRole('Super Admin')))
|
||||||
->afterStateUpdated(function ($state, callable $set) {
|
->afterStateUpdated(function ($state, callable $set) {
|
||||||
|
if ($state == 'Visual') {
|
||||||
|
$set('lower', 0);
|
||||||
|
$set('middle', 0);
|
||||||
|
$set('upper', 0);
|
||||||
|
}
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
})
|
})
|
||||||
->required(),
|
->required(),
|
||||||
@@ -259,7 +265,8 @@ class ProductCharacteristicsMasterResource extends Resource
|
|||||||
$set('middle', ($state + $get('upper')) / 2);
|
$set('middle', ($state + $get('upper')) / 2);
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
})
|
})
|
||||||
->visible(fn (callable $get) => $get('inspection_type') == 'Value'),
|
// ->visible(fn (callable $get) => $get('inspection_type') == 'Value')
|
||||||
|
->readOnly(fn (callable $get) => $get('inspection_type') != 'Value'),
|
||||||
Forms\Components\TextInput::make('upper')
|
Forms\Components\TextInput::make('upper')
|
||||||
->label('Upper')
|
->label('Upper')
|
||||||
->numeric()
|
->numeric()
|
||||||
@@ -272,7 +279,8 @@ class ProductCharacteristicsMasterResource extends Resource
|
|||||||
$set('middle', ($get('lower') + $state) / 2);
|
$set('middle', ($get('lower') + $state) / 2);
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
})
|
})
|
||||||
->visible(fn (callable $get) => $get('inspection_type') == 'Value'),
|
// ->visible(fn (callable $get) => $get('inspection_type') == 'Value')
|
||||||
|
->readOnly(fn (callable $get) => $get('inspection_type') != 'Value'),
|
||||||
Forms\Components\TextInput::make('middle')
|
Forms\Components\TextInput::make('middle')
|
||||||
->label('Middle')
|
->label('Middle')
|
||||||
->readOnly()
|
->readOnly()
|
||||||
@@ -295,8 +303,8 @@ class ProductCharacteristicsMasterResource extends Resource
|
|||||||
->dehydrateStateUsing(fn ($state, Get $get) => ($get('lower') + $get('upper')) / 2)
|
->dehydrateStateUsing(fn ($state, Get $get) => ($get('lower') + $get('upper')) / 2)
|
||||||
->afterStateUpdated(function ($state, callable $set) {
|
->afterStateUpdated(function ($state, callable $set) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
})
|
}),
|
||||||
->visible(fn (callable $get) => $get('inspection_type') == 'Value'),
|
// ->visible(fn (callable $get) => $get('inspection_type') == 'Value'),
|
||||||
Forms\Components\Hidden::make('created_by')
|
Forms\Components\Hidden::make('created_by')
|
||||||
->label('Created By')
|
->label('Created By')
|
||||||
->default(Filament::auth()->user()?->name),
|
->default(Filament::auth()->user()?->name),
|
||||||
|
|||||||
Reference in New Issue
Block a user