Simplified code logic on set property null while plant change
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
This commit is contained in:
@@ -56,19 +56,15 @@ class WorkGroupMasterResource extends Resource
|
|||||||
->afterStateUpdated(function ($state, $set, callable $get) {
|
->afterStateUpdated(function ($state, $set, callable $get) {
|
||||||
$plantId = $get('plant_id');
|
$plantId = $get('plant_id');
|
||||||
|
|
||||||
if (! $plantId) {
|
|
||||||
$set('pqPlantError', 'Please select a plant first.');
|
|
||||||
$set('name', null);
|
|
||||||
$set('description', null);
|
|
||||||
$set('operation_number', null);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$set('pqPlantError', null);
|
$set('pqPlantError', null);
|
||||||
$set('name', null);
|
$set('name', null);
|
||||||
$set('description', null);
|
$set('description', null);
|
||||||
$set('operation_number', null);
|
$set('operation_number', null);
|
||||||
|
if (! $plantId) {
|
||||||
|
$set('pqPlantError', 'Please select a plant first.');
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
->hint(fn ($get) => $get('pqPlantError') ? $get('pqPlantError') : null)
|
->hint(fn ($get) => $get('pqPlantError') ? $get('pqPlantError') : null)
|
||||||
->hintColor('danger'),
|
->hintColor('danger'),
|
||||||
|
|||||||
Reference in New Issue
Block a user