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

This commit is contained in:
dhanabalan
2026-02-26 20:18:18 +05:30
parent 0f29c0071c
commit 1704761844

View File

@@ -86,7 +86,8 @@ class ProductCharacteristicsMasterResource extends Resource
->where('line_id', $get('line_id'))
->where('work_group_master_id', $get('work_group_master_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'));
},
// function (callable $get): Closure {
@@ -227,6 +228,11 @@ class ProductCharacteristicsMasterResource extends Resource
// ->preload()
->disabled(fn (Get $get) => ! empty($get('id') && ! Filament::auth()->user()->hasRole('Super Admin')))
->afterStateUpdated(function ($state, callable $set) {
if ($state == 'Visual') {
$set('lower', 0);
$set('middle', 0);
$set('upper', 0);
}
$set('updated_by', Filament::auth()->user()?->name);
})
->required(),
@@ -259,7 +265,8 @@ class ProductCharacteristicsMasterResource extends Resource
$set('middle', ($state + $get('upper')) / 2);
$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')
->label('Upper')
->numeric()
@@ -272,7 +279,8 @@ class ProductCharacteristicsMasterResource extends Resource
$set('middle', ($get('lower') + $state) / 2);
$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')
->label('Middle')
->readOnly()
@@ -295,8 +303,8 @@ class ProductCharacteristicsMasterResource extends Resource
->dehydrateStateUsing(fn ($state, Get $get) => ($get('lower') + $get('upper')) / 2)
->afterStateUpdated(function ($state, callable $set) {
$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')
->label('Created By')
->default(Filament::auth()->user()?->name),