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
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:
@@ -30,6 +30,10 @@ class TestingLineVisualizationExporter extends Exporter
|
||||
->label('TEST BED GROUP'),
|
||||
ExportColumn::make('line_no')
|
||||
->label('LINE NO'),
|
||||
ExportColumn::make('sale_order')
|
||||
->label('SALE ORDER'),
|
||||
ExportColumn::make('job_order')
|
||||
->label('JOB ORDER'),
|
||||
ExportColumn::make('pump_model')
|
||||
->label('PUMP MODEL'),
|
||||
ExportColumn::make('pump_type')
|
||||
|
||||
@@ -37,6 +37,18 @@ class TestingLineVisualizationImporter extends Importer
|
||||
->exampleHeader('LINE NO')
|
||||
->example(['1'])
|
||||
->rules(['required']),
|
||||
ImportColumn::make('sale_order')
|
||||
->requiredMapping()
|
||||
->label('SALE ORDER')
|
||||
->exampleHeader('SALE ORDER')
|
||||
->example(['1RA0009024'])
|
||||
->rules(['required']),
|
||||
ImportColumn::make('job_order')
|
||||
->requiredMapping()
|
||||
->label('JOB ORDER')
|
||||
->exampleHeader('JOB ORDER')
|
||||
->example(['7000001'])
|
||||
->rules(['required']),
|
||||
ImportColumn::make('pump_model')
|
||||
->requiredMapping()
|
||||
->label('PUMP MODEL')
|
||||
@@ -111,6 +123,8 @@ class TestingLineVisualizationImporter extends Importer
|
||||
$plantId = null;
|
||||
$testBedGroup = trim($this->data['test_bed_group']);
|
||||
$lineNo = trim($this->data['line_no']);
|
||||
$saleOrder = trim($this->data['sale_order']);
|
||||
$jobOrder = trim($this->data['job_order']);
|
||||
$pumpModel = trim($this->data['pump_model']);
|
||||
$pumpType = trim($this->data['pump_type']);
|
||||
$motorDetails = trim($this->data['motor_details']);
|
||||
@@ -147,6 +161,14 @@ class TestingLineVisualizationImporter extends Importer
|
||||
$warnMsg[] = "Line no can't be empty!";
|
||||
}
|
||||
|
||||
if ($saleOrder == null || $saleOrder == '') {
|
||||
$warnMsg[] = "Sale order can't be empty!";
|
||||
}
|
||||
|
||||
if ($jobOrder == null || $jobOrder == '') {
|
||||
$warnMsg[] = "Job order can't be empty!";
|
||||
}
|
||||
|
||||
if ($pumpModel == null || $pumpModel == '') {
|
||||
$warnMsg[] = "Pump model can't be empty!";
|
||||
}
|
||||
@@ -186,7 +208,6 @@ class TestingLineVisualizationImporter extends Importer
|
||||
} elseif ($status != 'Running' && $status != 'OFF' && $status != 'Aligning' && $status != 'MTN') {
|
||||
$warnMsg[] = 'Invalid status value!';
|
||||
}
|
||||
// Check for duplicate record based on plant_id, test_bed_group, and line_no
|
||||
}
|
||||
|
||||
if (! empty($warnMsg)) {
|
||||
@@ -197,6 +218,8 @@ class TestingLineVisualizationImporter extends Importer
|
||||
'plant_id' => $plantId,
|
||||
'test_bed_group' => $testBedGroup,
|
||||
'line_no' => $lineNo,
|
||||
'sale_order' => $saleOrder,
|
||||
'job_order' => $jobOrder,
|
||||
'pump_model' => $pumpModel,
|
||||
'pump_type' => $pumpType,
|
||||
'motor_details' => $motorDetails,
|
||||
|
||||
@@ -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'];
|
||||
}
|
||||
|
||||
@@ -139,6 +139,8 @@ class TestingLineVisualizationController extends Controller
|
||||
$response[] = [
|
||||
'test_bed_group' => $row->test_bed_group ?? '',
|
||||
'line_no' => $row->line_no ?? '',
|
||||
'sale_order' => $row->sale_order ?? '',
|
||||
'job_order' => $row->job_order ?? '',
|
||||
'pump_model' => $row->pump_model ?? '',
|
||||
'pump_type' => $row->pump_type ?? '',
|
||||
'motor_details' => $row->motor_details ?? '',
|
||||
|
||||
@@ -14,6 +14,8 @@ class TestingLineVisualization extends Model
|
||||
'plant_id',
|
||||
'test_bed_group',
|
||||
'line_no',
|
||||
'sale_order',
|
||||
'job_order',
|
||||
'pump_model',
|
||||
'pump_type',
|
||||
'motor_details',
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql1 = <<<'SQL'
|
||||
ALTER TABLE testing_line_visualizations
|
||||
ADD COLUMN sale_order TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
|
||||
$sql2 = <<<'SQL'
|
||||
ALTER TABLE testing_line_visualizations
|
||||
ADD COLUMN job_order TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('testing_line_visualizations', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user