diff --git a/app/Filament/Resources/MotorTestingMasterResource.php b/app/Filament/Resources/MotorTestingMasterResource.php index 194b33642..032faca90 100644 --- a/app/Filament/Resources/MotorTestingMasterResource.php +++ b/app/Filament/Resources/MotorTestingMasterResource.php @@ -94,16 +94,19 @@ class MotorTestingMasterResource extends Resource // { // return []; // } + if ($plantId) { return Configuration::where('plant_id', $plantId) ->where('c_name', 'MOTOR_PHASE') + ->orderBy('created_at') ->pluck('c_value', 'c_value') ->toArray(); } else { return Configuration::where('c_name', 'MOTOR_PHASE') + ->orderBy('created_at') ->pluck('c_value', 'c_value') ->toArray(); } @@ -148,12 +151,14 @@ class MotorTestingMasterResource extends Resource { return Configuration::where('plant_id', $plantId) ->where('c_name', 'MOTOR_CONNECTION') + ->orderBy('created_at') ->pluck('c_value', 'c_value') ->toArray(); } else { return Configuration::where('c_name', 'MOTOR_CONNECTION') + ->orderBy('created_at') ->pluck('c_value', 'c_value') ->toArray(); } @@ -169,9 +174,28 @@ class MotorTestingMasterResource extends Resource Forms\Components\TextInput::make('ins_res_limit') ->label('Insulation Resistance Limit') ->required(), - Forms\Components\TextInput::make('ins_res_type') + Forms\Components\Select::make('ins_res_type') ->label('Insulation Resistance Type') ->default('O') + ->selectablePlaceholder(false) + ->options(function (callable $get) { + $plantId = $get('plant_id'); + if ($plantId) + { + return Configuration::where('plant_id', $plantId) + ->where('c_name', 'INSULATION_RESISTANCE_TYPE') + ->orderBy('created_at') + ->pluck('c_value', 'c_value') + ->toArray(); + } + else + { + return Configuration::where('c_name', 'INSULATION_RESISTANCE_TYPE') + ->orderBy('created_at') + ->pluck('c_value', 'c_value') + ->toArray(); + } + }) ->required(), Forms\Components\TextInput::make('res_ry_ll') ->label('Resistance RY LL')