Added migration (sale_order and job_order), and Updated model, policy, resource, importer, exporter, controller (Get API) with functionality for Testing Line Visualization
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 17s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 20s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 23s
Laravel Pint / pint (pull_request) Successful in 2m57s
Laravel Larastan / larastan (pull_request) Failing after 5m24s

This commit is contained in:
dhanabalan
2026-11-05 19:17:08 +05:30
parent ea48d410bd
commit 4c284291f6
6 changed files with 129 additions and 2 deletions

View File

@@ -88,6 +88,30 @@ class TestingLineVisualizationResource extends Resource
$set('updated_by', Filament::auth()->user()?->name);
})
->required(),
Forms\Components\TextInput::make('sale_order')
->label('Sale Order')
->placeholder('Enter Sale Order')
->reactive()
->default(function () {
$userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? null : optional(TestingLineVisualization::latest()->first())->sale_order ?? null;
})
->afterStateUpdated(function ($state, callable $set, callable $get) {
$set('updated_by', Filament::auth()->user()?->name);
}), // ->required(),
Forms\Components\TextInput::make('job_order')
->label('Job Order')
->placeholder('Enter Job Order')
->reactive()
->default(function () {
$userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? null : optional(TestingLineVisualization::latest()->first())->job_order ?? null;
})
->afterStateUpdated(function ($state, callable $set, callable $get) {
$set('updated_by', Filament::auth()->user()?->name);
}), // ->required(),
Forms\Components\TextInput::make('pump_model')
->label('Pump Model')
->placeholder('Enter Pump Model')
@@ -281,6 +305,16 @@ class TestingLineVisualizationResource extends Resource
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('sale_order')
->label('Sale Order')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('job_order')
->label('Job Order')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('pump_model')
->label('Pump Model')
->alignCenter()
@@ -405,6 +439,14 @@ class TestingLineVisualizationResource extends Resource
->label('Line No')
->placeholder('Enter Line No')
->live(500),
TextInput::make('sale_order')
->label('Sale Order')
->placeholder('Enter Sale Order')
->live(500),
TextInput::make('job_order')
->label('Job Order')
->placeholder('Enter Job Order')
->live(500),
TextInput::make('pump_model')
->label('Pump Model')
->placeholder('Enter Pump Model')
@@ -511,7 +553,7 @@ class TestingLineVisualizationResource extends Resource
])
->query(function ($query, array $data) {
// Hide all records initially if no filters are applied
if (empty($data['Plant']) && empty($data['test_bed_group']) && empty($data['line_no']) && empty($data['pump_model']) && empty($data['pump_type']) && empty($data['motor_details']) && empty($data['test_type']) && Str::length($data['flow']) <= 0 && Str::length($data['head']) <= 0 && Str::length($data['run_time']) <= 0 && empty($data['live_status']) && empty($data['observation_remarks']) && empty($data['created_by']) && empty($data['created_from']) && empty($data['created_to']) && empty($data['updated_by']) && empty($data['updated_from']) && empty($data['updated_to'])) {
if (empty($data['Plant']) && empty($data['test_bed_group']) && empty($data['line_no']) && empty($data['sale_order']) && empty($data['job_order']) && empty($data['pump_model']) && empty($data['pump_type']) && empty($data['motor_details']) && empty($data['test_type']) && Str::length($data['flow']) <= 0 && Str::length($data['head']) <= 0 && Str::length($data['run_time']) <= 0 && empty($data['live_status']) && empty($data['observation_remarks']) && empty($data['created_by']) && empty($data['created_from']) && empty($data['created_to']) && empty($data['updated_by']) && empty($data['updated_from']) && empty($data['updated_to'])) {
return $query->whereRaw('1 = 0');
}
@@ -533,6 +575,14 @@ class TestingLineVisualizationResource extends Resource
$query->where('line_no', $data['line_no']);
}
if (! empty($data['sale_order'])) {
$query->where('sale_order', 'like', '%'.$data['sale_order'].'%');
}
if (! empty($data['job_order'])) {
$query->where('job_order', 'like', '%'.$data['job_order'].'%');
}
if (! empty($data['pump_model'])) {
$query->where('pump_model', 'like', '%'.$data['pump_model'].'%');
}
@@ -614,6 +664,14 @@ class TestingLineVisualizationResource extends Resource
$indicators[] = 'Line No: '.$data['line_no'];
}
if (! empty($data['sale_order'])) {
$indicators[] = 'Sale Order: '.$data['sale_order'];
}
if (! empty($data['job_order'])) {
$indicators[] = 'Job Order: '.$data['job_order'];
}
if (! empty($data['pump_model'])) {
$indicators[] = 'Pump Model: '.$data['pump_model'];
}