Added label, placeholder, default value and subassembly_code filter logic
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
This commit is contained in:
@@ -119,7 +119,7 @@ class MotorTestingMasterResource extends Resource
|
|||||||
Forms\Components\TextInput::make('subassembly_code')
|
Forms\Components\TextInput::make('subassembly_code')
|
||||||
->label('Subassembly Code')
|
->label('Subassembly Code')
|
||||||
// ->required()
|
// ->required()
|
||||||
->placeholder('Scan the valid code')
|
->placeholder('Scan the subassembly code')
|
||||||
->reactive()
|
->reactive()
|
||||||
->alphaNum()
|
->alphaNum()
|
||||||
->minLength(6)
|
->minLength(6)
|
||||||
@@ -195,42 +195,49 @@ class MotorTestingMasterResource extends Resource
|
|||||||
->reactive(),
|
->reactive(),
|
||||||
Forms\Components\TextInput::make('hp')
|
Forms\Components\TextInput::make('hp')
|
||||||
->label('HP')
|
->label('HP')
|
||||||
|
->placeholder('Scan the HP')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('kw')
|
Forms\Components\TextInput::make('kw')
|
||||||
->label('KW')
|
->label('KW')
|
||||||
|
->placeholder('Scan the KW')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('volt')
|
Forms\Components\TextInput::make('volt')
|
||||||
->label('Volt')
|
->label('Volt')
|
||||||
|
->placeholder('Scan the volt')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('current')
|
Forms\Components\TextInput::make('current')
|
||||||
->label('Current')
|
->label('Current')
|
||||||
|
->placeholder('Scan the current')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('rpm')
|
Forms\Components\TextInput::make('rpm')
|
||||||
->label('RPM')
|
->label('RPM')
|
||||||
|
->placeholder('Scan the RPM')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('torque')
|
Forms\Components\TextInput::make('torque')
|
||||||
->label('Torque')
|
->label('Torque')
|
||||||
|
->placeholder('Scan the torque')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('frequency')
|
Forms\Components\TextInput::make('frequency')
|
||||||
->label('Frequency')
|
->label('Frequency')
|
||||||
|
->placeholder('Scan the frequency')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
@@ -265,12 +272,14 @@ class MotorTestingMasterResource extends Resource
|
|||||||
->reactive(),
|
->reactive(),
|
||||||
Forms\Components\TextInput::make('ins_res_limit')
|
Forms\Components\TextInput::make('ins_res_limit')
|
||||||
->label('Insulation Resistance Limit')
|
->label('Insulation Resistance Limit')
|
||||||
|
->placeholder('Scan the insulation resistance limit')
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
})
|
})
|
||||||
->required(),
|
->required(),
|
||||||
Forms\Components\Select::make('ins_res_type')
|
Forms\Components\Select::make('ins_res_type')
|
||||||
->label('Insulation Resistance Type')
|
->label('Insulation Resistance Type')
|
||||||
|
->placeholder('Scan the insulation resistance type')
|
||||||
->default('O')
|
->default('O')
|
||||||
->selectablePlaceholder(false)
|
->selectablePlaceholder(false)
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
@@ -294,96 +303,112 @@ class MotorTestingMasterResource extends Resource
|
|||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('res_ry_ll')
|
Forms\Components\TextInput::make('res_ry_ll')
|
||||||
->label('Resistance RY LL')
|
->label('Resistance RY LL')
|
||||||
|
->placeholder('Scan the resistance RY LL')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('res_ry_ul')
|
Forms\Components\TextInput::make('res_ry_ul')
|
||||||
->label('Resistance RY UL')
|
->label('Resistance RY UL')
|
||||||
|
->placeholder('Scan the resistance RY UL')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('res_yb_ll')
|
Forms\Components\TextInput::make('res_yb_ll')
|
||||||
->label('Resistance YB LL')
|
->label('Resistance YB LL')
|
||||||
|
->placeholder('Scan the resistance YB LL')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('res_yb_ul')
|
Forms\Components\TextInput::make('res_yb_ul')
|
||||||
->label('Resistance YB UL')
|
->label('Resistance YB UL')
|
||||||
|
->placeholder('Scan the resistance YB UL')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('res_br_ll')
|
Forms\Components\TextInput::make('res_br_ll')
|
||||||
->label('Resistance BR LL')
|
->label('Resistance BR LL')
|
||||||
|
->placeholder('Scan the resistance BR LL')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('res_br_ul')
|
Forms\Components\TextInput::make('res_br_ul')
|
||||||
->label('Resistance BR UL')
|
->label('Resistance BR UL')
|
||||||
|
->placeholder('Scan the resistance BR UL')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('lock_volt_limit')
|
Forms\Components\TextInput::make('lock_volt_limit')
|
||||||
->label('Lock Volt Limit')
|
->label('Lock Volt Limit')
|
||||||
|
->placeholder('Scan the lock volt limit')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('leak_cur_limit')
|
Forms\Components\TextInput::make('leak_cur_limit')
|
||||||
->label('Leakage Current Limit')
|
->label('Leakage Current Limit')
|
||||||
|
->placeholder('Scan the leakage current limit')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('lock_cur_ll')
|
Forms\Components\TextInput::make('lock_cur_ll')
|
||||||
->label('Lock Current LL')
|
->label('Lock Current LL')
|
||||||
|
->placeholder('Scan the lock current LL')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('lock_cur_ul')
|
Forms\Components\TextInput::make('lock_cur_ul')
|
||||||
->label('Lock Current UL')
|
->label('Lock Current UL')
|
||||||
|
->placeholder('Scan the lock current UL')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('noload_cur_ll')
|
Forms\Components\TextInput::make('noload_cur_ll')
|
||||||
->label('No Load Current LL')
|
->label('No Load Current LL')
|
||||||
|
->placeholder('Scan the no load current LL')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('noload_cur_ul')
|
Forms\Components\TextInput::make('noload_cur_ul')
|
||||||
->label('No Load Current UL')
|
->label('No Load Current UL')
|
||||||
|
->placeholder('Scan the no load current UL')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('noload_pow_ll')
|
Forms\Components\TextInput::make('noload_pow_ll')
|
||||||
->label('No Load Power LL')
|
->label('No Load Power LL')
|
||||||
|
->placeholder('Scan the no load power LL')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('noload_pow_ul')
|
Forms\Components\TextInput::make('noload_pow_ul')
|
||||||
->label('No Load Power UL')
|
->label('No Load Power UL')
|
||||||
|
->placeholder('Scan the no load power UL')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('noload_spd_ll')
|
Forms\Components\TextInput::make('noload_spd_ll')
|
||||||
->label('No Load Speed LL')
|
->label('No Load Speed LL')
|
||||||
|
->placeholder('Scan the no load speed LL')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('noload_spd_ul')
|
Forms\Components\TextInput::make('noload_spd_ul')
|
||||||
->label('No Load Speed UL')
|
->label('No Load Speed UL')
|
||||||
|
->placeholder('Scan the no load speed UL')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
@@ -420,6 +445,7 @@ class MotorTestingMasterResource extends Resource
|
|||||||
->sortable(),
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('item.category')
|
Tables\Columns\TextColumn::make('item.category')
|
||||||
->label('Category')
|
->label('Category')
|
||||||
|
->default('-')
|
||||||
->searchable()
|
->searchable()
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
@@ -430,6 +456,7 @@ class MotorTestingMasterResource extends Resource
|
|||||||
->sortable(),
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('subassembly_code')
|
Tables\Columns\TextColumn::make('subassembly_code')
|
||||||
->label('Subassembly Code')
|
->label('Subassembly Code')
|
||||||
|
->default('-')
|
||||||
->searchable()
|
->searchable()
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
@@ -593,17 +620,34 @@ class MotorTestingMasterResource extends Resource
|
|||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$pId = $get('Plant');
|
$pId = $get('Plant');
|
||||||
|
|
||||||
return Item::whereHas('motorTestingMasters', function ($query) use ($pId) {
|
if (! $pId) {
|
||||||
if ($pId) {
|
return [];
|
||||||
$query->where('plant_id', $pId);
|
} else {
|
||||||
}
|
return Item::whereHas('motorTestingMasters', function ($query) use ($pId) {
|
||||||
})->pluck('code', 'id');
|
if ($pId) {
|
||||||
|
$query->where('plant_id', $pId);
|
||||||
|
}
|
||||||
|
})->pluck('code', 'id');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
->searchable()
|
||||||
|
->reactive(),
|
||||||
|
Select::make('subassembly_code')
|
||||||
|
->label('Search by Subassembly Code')
|
||||||
|
->nullable()
|
||||||
|
->options(function (callable $get) {
|
||||||
|
$plantId = $get('Plant');
|
||||||
|
if (! $plantId) {
|
||||||
|
return [];
|
||||||
|
} else {
|
||||||
|
return MotorTestingMaster::where('plant_id', $plantId)->whereNotNull('subassembly_code')->select('subassembly_code')->distinct()->pluck('subassembly_code', 'subassembly_code');
|
||||||
|
}
|
||||||
})
|
})
|
||||||
->searchable()
|
->searchable()
|
||||||
->reactive(),
|
->reactive(),
|
||||||
TextInput::make('description')
|
TextInput::make('description')
|
||||||
->label('Description')
|
->label('Model')
|
||||||
->placeholder('Enter Description'),
|
->placeholder('Enter Model'),
|
||||||
Radio::make('isi_type')
|
Radio::make('isi_type')
|
||||||
->label('ISI Model ?')
|
->label('ISI Model ?')
|
||||||
->boolean()
|
->boolean()
|
||||||
@@ -714,7 +758,7 @@ class MotorTestingMasterResource extends Resource
|
|||||||
])
|
])
|
||||||
->query(function ($query, array $data) {
|
->query(function ($query, array $data) {
|
||||||
// Hide all records initially if no filters are applied
|
// Hide all records initially if no filters are applied
|
||||||
if (empty($data['Plant']) && empty($data['Item']) && empty($data['description']) && empty($data['isi_type']) && empty($data['phase_type']) && empty($data['connection_type']) && empty($data['created_by']) && empty($data['created_from']) && empty($data['created_to']) && empty($data['updated_by']) && empty($data['updated_from']) && empty($data['updated_to'])) {// || $data['isi_type'] == 'All')
|
if (empty($data['Plant']) && empty($data['Item']) && empty($data['subassembly_code']) && empty($data['description']) && empty($data['isi_type']) && empty($data['phase_type']) && empty($data['connection_type']) && empty($data['created_by']) && empty($data['created_from']) && empty($data['created_to']) && empty($data['updated_by']) && empty($data['updated_from']) && empty($data['updated_to'])) {// || $data['isi_type'] == 'All')
|
||||||
return $query->whereRaw('1 = 0');
|
return $query->whereRaw('1 = 0');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -738,6 +782,10 @@ class MotorTestingMasterResource extends Resource
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! empty($data['subassembly_code'])) {
|
||||||
|
$query->where('subassembly_code', $data['subassembly_code']);
|
||||||
|
}
|
||||||
|
|
||||||
if (! empty($data['description'])) {
|
if (! empty($data['description'])) {
|
||||||
$pId = $data['Plant'] ?? null;
|
$pId = $data['Plant'] ?? null;
|
||||||
$descIds = Item::where('description', 'like', '%'.$data['description'].'%')->whereHas('motorTestingMasters', function ($query) use ($pId) {
|
$descIds = Item::where('description', 'like', '%'.$data['description'].'%')->whereHas('motorTestingMasters', function ($query) use ($pId) {
|
||||||
@@ -807,8 +855,12 @@ class MotorTestingMasterResource extends Resource
|
|||||||
$indicators[] = 'Item Codes: '.$itemCode;
|
$indicators[] = 'Item Codes: '.$itemCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! empty($data['subassembly_code'])) {
|
||||||
|
$indicators[] = 'Subassembly Code: '.$data['subassembly_code'];
|
||||||
|
}
|
||||||
|
|
||||||
if (! empty($data['description'])) {
|
if (! empty($data['description'])) {
|
||||||
$indicators[] = 'Description: '.$data['description'];
|
$indicators[] = 'Model: '.$data['description'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($data['isi_type'] == 'Y') {
|
if ($data['isi_type'] == 'Y') {
|
||||||
|
|||||||
Reference in New Issue
Block a user