Added migration and Updated model, resource, importer, exporter to add test_finished_at column and Added test_finished_at column to Testing Panel Post Reading API in TestingPanelController
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 18s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 38s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 1m18s
Laravel Pint / pint (pull_request) Successful in 4m12s
Laravel Larastan / larastan (pull_request) Failing after 8m23s

This commit is contained in:
dhanabalan
2026-10-26 14:51:52 +05:30
parent 6233103b8b
commit 58394901ac
6 changed files with 82 additions and 1 deletions

View File

@@ -128,6 +128,8 @@ class TestingPanelReadingExporter extends Exporter
->label('TEST SEQUENCE FLAG'),
ExportColumn::make('test_started_at')
->label('TEST STARTED AT'),
ExportColumn::make('test_finished_at')
->label('TEST FINISHED AT'),
ExportColumn::make('rework_count')
->label('REWORK COUNT'),
ExportColumn::make('rework_winded')

View File

@@ -262,6 +262,11 @@ class TestingPanelReadingImporter extends Importer
->label('TEST STARTED AT')
->exampleHeader('TEST STARTED AT')
->example('01-01-2026 00:08:00'),
ImportColumn::make('test_finished_at')
->requiredMapping()
->label('TEST FINISHED AT')
->exampleHeader('TEST FINISHED AT')
->example('01-01-2026 00:08:00'),
ImportColumn::make('rework_count')
->requiredMapping()
->label('REWORK COUNT')

View File

@@ -652,6 +652,16 @@ class TestingPanelReadingResource extends Resource
->reactive()
// ->live()
// ->format('d-m-Y H:i:s')
->readOnly(fn (Get $get) => $get('id')) // checkhere...............................
->disabled(fn (Get $get) => ! empty($get('id')))
->afterStateUpdated(function ($state, callable $set, callable $get) {
$set('updated_by', Filament::auth()->user()?->name);
}),
Forms\Components\DateTimePicker::make('test_finished_at')
->label('FR Finished At')
->reactive()
// ->live()
// ->format('d-m-Y H:i:s')
->readOnly(fn (Get $get) => $get('id'))
->disabled(fn (Get $get) => ! empty($get('id')))
->afterStateUpdated(function ($state, callable $set, callable $get) {
@@ -939,6 +949,11 @@ class TestingPanelReadingResource extends Resource
->alignCenter()
->sortable()
->dateTime(),
Tables\Columns\TextColumn::make('test_finished_at')
->label('FR Finished At')
->alignCenter()
->sortable()
->dateTime(),
Tables\Columns\TextColumn::make('rework_count')
->label('Rework Count')
->alignCenter(),
@@ -1232,6 +1247,16 @@ class TestingPanelReadingResource extends Resource
->placeholder('Select To DateTime')
->reactive()
->native(false),
DateTimePicker::make('test_finished_from')
->label('FR Finished From')
->placeholder('Select From DateTime')
->reactive()
->native(false),
DateTimePicker::make('test_finished_to')
->label('FR Finished To')
->placeholder('Select To DateTime')
->reactive()
->native(false),
Select::make('tested_by')
->label('Tested By')
->nullable()
@@ -1283,7 +1308,7 @@ class TestingPanelReadingResource extends Resource
// dd($data);
// Hide all records initially if no filters are applied
if (empty($data['Plant']) && empty($data['Line']) && empty($data['item_code']) && empty($data['subassembly_code']) && empty($data['machine_name']) && empty($data['item_description']) && empty($data['serial_number']) && empty($data['winded_serial_number']) && empty($data['output']) && empty($data['connection']) && empty($data['remark']) && empty($data['batch_number']) && empty($data['result']) && empty($data['test_sequence_flag']) && empty($data['test_started_from']) && empty($data['test_started_to']) && empty($data['tested_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['Line']) && empty($data['item_code']) && empty($data['subassembly_code']) && empty($data['machine_name']) && empty($data['item_description']) && empty($data['serial_number']) && empty($data['winded_serial_number']) && empty($data['output']) && empty($data['connection']) && empty($data['remark']) && empty($data['batch_number']) && empty($data['result']) && empty($data['test_sequence_flag']) && empty($data['test_started_from']) && empty($data['test_started_to']) && empty($data['test_finished_from']) && empty($data['test_finished_to']) && empty($data['tested_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');
}
@@ -1392,6 +1417,14 @@ class TestingPanelReadingResource extends Resource
$query->where('test_started_at', '<=', $data['test_started_to']);
}
if (! empty($data['test_finished_from'])) {
$query->where('test_finished_at', '>=', $data['test_finished_from']);
}
if (! empty($data['test_finished_to'])) {
$query->where('test_finished_at', '<=', $data['test_finished_to']);
}
if (! empty($data['created_from'])) {
$query->where('created_at', '>=', $data['created_from']);
}
@@ -1486,6 +1519,14 @@ class TestingPanelReadingResource extends Resource
$indicators[] = 'Test Started To: '.$data['test_started_to'];
}
if (! empty($data['test_finished_from'])) {
$indicators[] = 'Test Finished From: '.$data['test_finished_from'];
}
if (! empty($data['test_finished_to'])) {
$indicators[] = 'Test Finished To: '.$data['test_finished_to'];
}
if (! empty($data['serial_number'])) {
$indicators[] = 'Serial Number: '.$data['serial_number'];
}

View File

@@ -327,6 +327,7 @@ class TestingPanelController extends Controller
'rework_winded' => $serial['rework_winded'] ?? 0,
'test_sequence_flag' => $serial['test_sequence_flag'] ?? '4',
'test_started_at' => $serial['test_started_at'] ?? null,
'test_finished_at' => $serial['test_finished_at'] ?? null,
'output_flag' => $serial['output_flag'] ?? 0,
'tested_by' => (($serial['tested_by'] == 'jothi') ? 'Admin' : $serial['tested_by']) ?? null,
'updated_by' => (($serial['updated_by'] == 'jothi') ? 'Admin' : $serial['updated_by']) ?? null,

View File

@@ -59,6 +59,7 @@ class TestingPanelReading extends Model
'remark',
'test_sequence_flag',
'test_started_at',
'test_finished_at',
'rework_count',
'rework_winded',
'update_count',

View File

@@ -0,0 +1,31 @@
<?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_panel_readings
ADD COLUMN test_finished_at TIMESTAMP DEFAULT NULL
SQL;
DB::statement($sql1);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
// Schema::table('testing_panel_readings', function (Blueprint $table) {
// //
// });
}
};