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

This commit is contained in:
dhanabalan
2026-05-29 15:35:05 +05:30
parent 58629f4cbb
commit 29b4775af2

View File

@@ -56,19 +56,15 @@ class WorkGroupMasterResource extends Resource
->afterStateUpdated(function ($state, $set, callable $get) {
$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('name', null);
$set('description', null);
$set('operation_number', null);
if (! $plantId) {
$set('pqPlantError', 'Please select a plant first.');
return;
}
})
->hint(fn ($get) => $get('pqPlantError') ? $get('pqPlantError') : null)
->hintColor('danger'),