From b74b3626225eb0585dbc415761a65f00fc1c1ded Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Mon, 2 Jun 2025 11:48:44 +0530 Subject: [PATCH] Added insulation resistance type for motor testing masters --- .../Resources/MotorTestingMasterResource.php | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) 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')