Updated resource file to add rework_winded and group work center column and Refactor resource validations and design
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
This commit is contained in:
@@ -19,6 +19,7 @@ use Closure;
|
|||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
use Filament\Forms;
|
use Filament\Forms;
|
||||||
use Filament\Forms\Components\DateTimePicker;
|
use Filament\Forms\Components\DateTimePicker;
|
||||||
|
use Filament\Forms\Components\Section;
|
||||||
use Filament\Forms\Components\Select;
|
use Filament\Forms\Components\Select;
|
||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
use Filament\Forms\Form;
|
use Filament\Forms\Form;
|
||||||
@@ -56,37 +57,36 @@ class TestingPanelReadingResource extends Resource
|
|||||||
public static function form(Form $form): Form
|
public static function form(Form $form): Form
|
||||||
{
|
{
|
||||||
return $form
|
return $form
|
||||||
|
->schema([
|
||||||
|
Section::make('')
|
||||||
->schema([
|
->schema([
|
||||||
Forms\Components\Select::make('plant_id')
|
Forms\Components\Select::make('plant_id')
|
||||||
->label('Plant Name')
|
->label('Plant Name')
|
||||||
->relationship('plant', 'name')
|
->relationship('plant', 'name')
|
||||||
->searchable()
|
->columnSpan(1) // (['default' => 1, 'sm' => 2])
|
||||||
->required()
|
|
||||||
->reactive()
|
->reactive()
|
||||||
|
->searchable()
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$userHas = Filament::auth()->user()->plant_id;
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
|
||||||
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
|
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
|
||||||
})
|
})
|
||||||
->default(function () {
|
|
||||||
return optional(TestingPanelReading::latest()->first())->plant_id;
|
|
||||||
})
|
|
||||||
->disabled(fn (Get $get) => ! empty($get('id')))
|
->disabled(fn (Get $get) => ! empty($get('id')))
|
||||||
|
->default(function () {
|
||||||
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
|
||||||
|
return ($userHas && strlen($userHas) > 0) ? $userHas : optional(TestingPanelReading::latest()->first())->plant_id ?? null;
|
||||||
|
})
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
$plantId = $get('plant_id');
|
$plantId = $get('plant_id');
|
||||||
if (! $plantId) {
|
if (! $plantId) {
|
||||||
$set('line_id', null);
|
|
||||||
$set('motor_testing_master_id', null);
|
|
||||||
$set('machine_id', null);
|
|
||||||
$set('tPrError', 'Please select a plant first.');
|
$set('tPrError', 'Please select a plant first.');
|
||||||
|
|
||||||
return;
|
|
||||||
} else {
|
} else {
|
||||||
$set('line_id', null);
|
|
||||||
$set('motor_testing_master_id', null);
|
|
||||||
$set('machine_id', null);
|
|
||||||
$set('tPrError', null);
|
$set('tPrError', null);
|
||||||
}
|
}
|
||||||
|
$set('line_id', null);
|
||||||
|
$set('motor_testing_master_id', null);
|
||||||
|
$set('machine_id', null);
|
||||||
|
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
})
|
})
|
||||||
@@ -94,10 +94,13 @@ class TestingPanelReadingResource extends Resource
|
|||||||
'class' => $get('tPrError') ? 'border-red-500' : '',
|
'class' => $get('tPrError') ? 'border-red-500' : '',
|
||||||
])
|
])
|
||||||
->hint(fn ($get) => $get('tPrError') ? $get('tPrError') : null)
|
->hint(fn ($get) => $get('tPrError') ? $get('tPrError') : null)
|
||||||
->hintColor('danger'),
|
->hintColor('danger')
|
||||||
|
->required(),
|
||||||
Forms\Components\Select::make('line_id')
|
Forms\Components\Select::make('line_id')
|
||||||
->label('Line Name')
|
->label('Line Name')
|
||||||
// ->relationship('line', 'name')
|
// ->relationship('line', 'name')
|
||||||
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
->searchable()
|
->searchable()
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$plantId = $get('plant_id');
|
$plantId = $get('plant_id');
|
||||||
@@ -105,24 +108,28 @@ class TestingPanelReadingResource extends Resource
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
return Line::where('plant_id', $plantId)
|
return Line::where('plant_id', $plantId)->pluck('name', 'id')->toArray();
|
||||||
->pluck('name', 'id')
|
|
||||||
->toArray();
|
|
||||||
})
|
|
||||||
->default(function () {
|
|
||||||
return optional(TestingPanelReading::latest()->first())->line_id;
|
|
||||||
})
|
})
|
||||||
->disabled(fn (Get $get) => ! empty($get('id')))
|
->disabled(fn (Get $get) => ! empty($get('id')))
|
||||||
->required()
|
->default(function (callable $get) {
|
||||||
->reactive()
|
$plantId = $get('plant_id');
|
||||||
|
if (empty($plantId)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TestingPanelReading::where('plant_id', $plantId)->latest()->first()->line_id ?? null;
|
||||||
|
})
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('motor_testing_master_id', null);
|
$set('motor_testing_master_id', null);
|
||||||
$set('machine_id', null);
|
$set('machine_id', null);
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
})
|
||||||
|
->required(),
|
||||||
Forms\Components\Select::make('machine_id')
|
Forms\Components\Select::make('machine_id')
|
||||||
->label('Work Center')
|
->label('Work Center')
|
||||||
// ->relationship('machine', 'work_center')
|
// ->relationship('machine', 'work_center')
|
||||||
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
->searchable()
|
->searchable()
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$lineId = $get('line_id');
|
$lineId = $get('line_id');
|
||||||
@@ -130,23 +137,25 @@ class TestingPanelReadingResource extends Resource
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only show machines for the selected line
|
return Machine::where('line_id', $lineId)->pluck('work_center', 'id')->toArray();
|
||||||
return Machine::where('line_id', $lineId)
|
|
||||||
->pluck('work_center', 'id')
|
|
||||||
->toArray();
|
|
||||||
})
|
|
||||||
->default(function () {
|
|
||||||
return optional(TestingPanelReading::latest()->first())->machine_id;
|
|
||||||
})
|
})
|
||||||
->disabled(fn (Get $get) => ! empty($get('id')))
|
->disabled(fn (Get $get) => ! empty($get('id')))
|
||||||
->required()
|
->default(function (callable $get) {
|
||||||
->reactive()
|
$plantId = $get('plant_id');
|
||||||
|
if (empty($plantId)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TestingPanelReading::where('plant_id', $plantId)->latest()->first()->machine_id ?? null;
|
||||||
|
})
|
||||||
->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(),
|
||||||
Forms\Components\Select::make('motor_testing_master_id')
|
Forms\Components\Select::make('motor_testing_master_id')
|
||||||
->label('Item Code')
|
->label('Item Code')
|
||||||
// ->relationship('motorTestingMaster', 'item.code')
|
// ->relationship('motorTestingMaster', 'item.code')
|
||||||
|
->columnSpan(1)
|
||||||
// ->options(function (callable $get) {
|
// ->options(function (callable $get) {
|
||||||
// $plantId = $get('plant_id');
|
// $plantId = $get('plant_id');
|
||||||
// if (!$plantId) {
|
// if (!$plantId) {
|
||||||
@@ -159,6 +168,8 @@ class TestingPanelReadingResource extends Resource
|
|||||||
// ->pluck('item.code', 'id')
|
// ->pluck('item.code', 'id')
|
||||||
// ->toArray();
|
// ->toArray();
|
||||||
// })
|
// })
|
||||||
|
->reactive()
|
||||||
|
->searchable()
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$plantId = $get('plant_id');
|
$plantId = $get('plant_id');
|
||||||
if (! $plantId) {
|
if (! $plantId) {
|
||||||
@@ -172,18 +183,19 @@ class TestingPanelReadingResource extends Resource
|
|||||||
->pluck('items.code', 'motor_testing_masters.id')
|
->pluck('items.code', 'motor_testing_masters.id')
|
||||||
->toArray();
|
->toArray();
|
||||||
})
|
})
|
||||||
|
->disabled(fn (Get $get) => ! empty($get('id')))
|
||||||
// ->getOptionLabelUsing(fn ($value) =>
|
// ->getOptionLabelUsing(fn ($value) =>
|
||||||
// MotorTestingMaster::with('item')->find($value)?->item?->code
|
// MotorTestingMaster::with('item')->find($value)?->item?->code
|
||||||
// )
|
// )
|
||||||
->required()
|
|
||||||
->searchable()
|
|
||||||
->reactive()
|
|
||||||
->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(),
|
||||||
Forms\Components\TextInput::make('output')
|
Forms\Components\TextInput::make('output')
|
||||||
->label('Output')
|
->label('Output ID')
|
||||||
->required()
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->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);
|
||||||
})
|
})
|
||||||
@@ -213,10 +225,13 @@ class TestingPanelReadingResource extends Resource
|
|||||||
$fail("Output should be between 'Output1' and 'Output99'!");
|
$fail("Output should be between 'Output1' and 'Output99'!");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}),
|
})
|
||||||
|
->required(),
|
||||||
Forms\Components\TextInput::make('serial_number')
|
Forms\Components\TextInput::make('serial_number')
|
||||||
->label('Serial Number')
|
->label('Serial Number')
|
||||||
->required()
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->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);
|
||||||
})
|
})
|
||||||
@@ -244,9 +259,13 @@ class TestingPanelReadingResource extends Resource
|
|||||||
$fail("Serial number should not begin with '0' or letter!");
|
$fail("Serial number should not begin with '0' or letter!");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}),
|
})
|
||||||
|
->required(),
|
||||||
Forms\Components\TextInput::make('winded_serial_number')
|
Forms\Components\TextInput::make('winded_serial_number')
|
||||||
->label('Winded Serial Number')
|
->label('Winded Serial Number')
|
||||||
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->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);
|
||||||
})
|
})
|
||||||
@@ -275,224 +294,366 @@ class TestingPanelReadingResource extends Resource
|
|||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('before_fr_volt')
|
Forms\Components\TextInput::make('before_fr_volt')
|
||||||
->label('Before FR Volt')
|
->label('Before FR Volt')
|
||||||
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->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('before_fr_cur')
|
Forms\Components\TextInput::make('before_fr_cur')
|
||||||
->label('Before FR Current')
|
->label('Before FR Current')
|
||||||
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->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('before_fr_pow')
|
Forms\Components\TextInput::make('before_fr_pow')
|
||||||
->label('Before FR Power')
|
->label('Before FR Power')
|
||||||
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->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('before_fr_res_ry')
|
Forms\Components\TextInput::make('before_fr_res_ry')
|
||||||
->label('Before FR Resistance RY')
|
->label('Before FR Resistance RY')
|
||||||
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->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('before_fr_res_yb')
|
Forms\Components\TextInput::make('before_fr_res_yb')
|
||||||
->label('Before FR Resistance YB')
|
->label('Before FR Resistance YB')
|
||||||
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->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('before_fr_res_br')
|
Forms\Components\TextInput::make('before_fr_res_br')
|
||||||
->label('Before FR Resistance BR')
|
->label('Before FR Resistance BR')
|
||||||
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->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('before_fr_ir')
|
Forms\Components\TextInput::make('before_fr_ir')
|
||||||
->label('Before FR IR')
|
->label('Before FR IR')
|
||||||
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->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('before_fr_ir_r')
|
Forms\Components\TextInput::make('before_fr_ir_r')
|
||||||
->label('Before FR IR R')
|
->label('Before FR IR R')
|
||||||
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->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('before_fr_ir_y')
|
Forms\Components\TextInput::make('before_fr_ir_y')
|
||||||
->label('Before FR IR Y')
|
->label('Before FR IR Y')
|
||||||
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->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('before_fr_ir_b')
|
Forms\Components\TextInput::make('before_fr_ir_b')
|
||||||
->label('Before FR IR B')
|
->label('Before FR IR B')
|
||||||
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->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('before_fr_freq')
|
Forms\Components\TextInput::make('before_fr_freq')
|
||||||
->label('Before FR Frequency')
|
->label('Before FR Frequency')
|
||||||
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->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('before_fr_speed')
|
Forms\Components\TextInput::make('before_fr_speed')
|
||||||
->label('Before FR Speed')
|
->label('Before FR Speed')
|
||||||
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->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('after_fr_vol')
|
Forms\Components\TextInput::make('after_fr_vol')
|
||||||
->label('After FR Volt')
|
->label('After FR Volt')
|
||||||
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->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('after_fr_cur')
|
Forms\Components\TextInput::make('after_fr_cur')
|
||||||
->label('After FR Current')
|
->label('After FR Current')
|
||||||
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->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('after_fr_pow')
|
Forms\Components\TextInput::make('after_fr_pow')
|
||||||
->label('After FR Power')
|
->label('After FR Power')
|
||||||
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->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('after_fr_ir_hot')
|
Forms\Components\TextInput::make('after_fr_ir_hot')
|
||||||
->label('After FR IR Hot')
|
->label('After FR IR Hot')
|
||||||
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->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('after_fr_ir_hot_r')
|
Forms\Components\TextInput::make('after_fr_ir_hot_r')
|
||||||
->label('After FR IR Hot R')
|
->label('After FR IR Hot R')
|
||||||
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->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('after_fr_ir_hot_y')
|
Forms\Components\TextInput::make('after_fr_ir_hot_y')
|
||||||
->label('After FR IR Hot Y')
|
->label('After FR IR Hot Y')
|
||||||
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->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('after_fr_ir_hot_b')
|
Forms\Components\TextInput::make('after_fr_ir_hot_b')
|
||||||
->label('After FR IR Hot B')
|
->label('After FR IR Hot B')
|
||||||
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->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('after_fr_ir_cool')
|
Forms\Components\TextInput::make('after_fr_ir_cool')
|
||||||
->label('After FR IR Cool')
|
->label('After FR IR Cool')
|
||||||
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->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('after_fr_ir_cool_r')
|
Forms\Components\TextInput::make('after_fr_ir_cool_r')
|
||||||
->label('After FR IR Cool R')
|
->label('After FR IR Cool R')
|
||||||
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->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('after_fr_ir_cool_y')
|
Forms\Components\TextInput::make('after_fr_ir_cool_y')
|
||||||
->label('After FR IR Cool Y')
|
->label('After FR IR Cool Y')
|
||||||
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->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('after_fr_ir_cool_b')
|
Forms\Components\TextInput::make('after_fr_ir_cool_b')
|
||||||
->label('After FR IR Cool B')
|
->label('After FR IR Cool B')
|
||||||
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->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('after_fr_freq')
|
Forms\Components\TextInput::make('after_fr_freq')
|
||||||
->label('After FR Frequency')
|
->label('After FR Frequency')
|
||||||
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->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('after_fr_speed')
|
Forms\Components\TextInput::make('after_fr_speed')
|
||||||
->label('After FR Speed')
|
->label('After FR Speed')
|
||||||
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->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('after_fr_leak_cur')
|
Forms\Components\TextInput::make('after_fr_leak_cur')
|
||||||
->label('After FR Leak Current')
|
->label('After FR Leak Current')
|
||||||
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->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('locked_rt_volt')
|
Forms\Components\TextInput::make('locked_rt_volt')
|
||||||
->label('Locked RT Volt')
|
->label('Locked RT Volt')
|
||||||
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->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('locked_rt_cur')
|
Forms\Components\TextInput::make('locked_rt_cur')
|
||||||
->label('Locked RT Current')
|
->label('Locked RT Current')
|
||||||
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->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('locked_rt_pow')
|
Forms\Components\TextInput::make('locked_rt_pow')
|
||||||
->label('Locked RT Power')
|
->label('Locked RT Power')
|
||||||
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->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('no_load_pickup_volt')
|
Forms\Components\TextInput::make('no_load_pickup_volt')
|
||||||
->label('No Load Pickup Volt')
|
->label('No Load Pickup Volt')
|
||||||
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->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('room_temperature')
|
Forms\Components\TextInput::make('room_temperature')
|
||||||
->label('Room Temperature')
|
->label('Room Temperature')
|
||||||
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->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\Select::make('hv_test')
|
Forms\Components\Select::make('hv_test')
|
||||||
->label('High Voltage Test')
|
->label('High Voltage Test')
|
||||||
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->disabled(fn (Get $get) => $get('id'))
|
||||||
->options([
|
->options([
|
||||||
'With Stood' => 'With Stood',
|
'With Stood' => 'With Stood',
|
||||||
'Not With Stood' => 'Not With Stood',
|
'Not With Stood' => 'Not With Stood',
|
||||||
])
|
])
|
||||||
->selectablePlaceholder(false)
|
->selectablePlaceholder(false)
|
||||||
->default('Not With Stood')
|
->default('Not With Stood')
|
||||||
->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);
|
||||||
}),
|
})
|
||||||
|
->required(),
|
||||||
Forms\Components\TextInput::make('batch_number')
|
Forms\Components\TextInput::make('batch_number')
|
||||||
->label('Batch Number')
|
->label('Batch Number')
|
||||||
->readOnly(fn (callable $get) => ! $get('id'))
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->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('batch_count')
|
Forms\Components\TextInput::make('batch_count')
|
||||||
->label('Batch Count')
|
->label('Batch Count')
|
||||||
->default('0')
|
->columnSpan(1)
|
||||||
->readOnly(fn (callable $get) => ! $get('id'))
|
->reactive()
|
||||||
|
->integer()
|
||||||
|
->minValue(0)
|
||||||
|
->default(0)
|
||||||
|
->readOnly(fn (Get $get) => $get('id') || ! $get('batch_number'))
|
||||||
->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\Select::make('result')
|
Forms\Components\Select::make('result')
|
||||||
->label('Result')
|
->label('Result')
|
||||||
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->disabled(fn (Get $get) => $get('id'))
|
||||||
->options([
|
->options([
|
||||||
'PASS' => 'PASS', // Not With Stood
|
'PASS' => 'PASS', // Not With Stood
|
||||||
'FAIL' => 'FAIL',
|
'FAIL' => 'FAIL',
|
||||||
])
|
])
|
||||||
->selectablePlaceholder(false)
|
->selectablePlaceholder(false)
|
||||||
->default('FAIL')
|
->default('FAIL')
|
||||||
->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);
|
||||||
}),
|
})
|
||||||
|
->required(),
|
||||||
Forms\Components\TextInput::make('remark')
|
Forms\Components\TextInput::make('remark')
|
||||||
->label('Remark')
|
->label('Remark')
|
||||||
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->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('rework_count')
|
Forms\Components\TextInput::make('rework_count')
|
||||||
->label('Rework Count')
|
->label('Rework Count')
|
||||||
->default('0')
|
->columnSpan(1)
|
||||||
->readOnly(fn (callable $get) => ! $get('id'))
|
->reactive()
|
||||||
|
->integer()
|
||||||
|
->minValue(0)
|
||||||
|
->default(0)
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->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\Select::make('rework_winded')
|
||||||
|
->label('Rework Winded Status')
|
||||||
|
->columnSpan(1)
|
||||||
|
// ->nullable()
|
||||||
|
->reactive()
|
||||||
|
->disabled(fn (Get $get) => $get('id'))
|
||||||
|
->options(function () {
|
||||||
|
return [
|
||||||
|
'1' => 'Yes',
|
||||||
|
'0' => 'No',
|
||||||
|
];
|
||||||
|
})
|
||||||
|
->selectablePlaceholder(false)
|
||||||
|
->default('0')
|
||||||
|
->afterStateUpdated(function (callable $set) {
|
||||||
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
|
})
|
||||||
|
->required(),
|
||||||
Forms\Components\TextInput::make('update_count')
|
Forms\Components\TextInput::make('update_count')
|
||||||
->label('Update Count')
|
->label('Update Count')
|
||||||
->default('0')
|
->columnSpan(1)
|
||||||
->readOnly(fn (callable $get) => ! $get('id'))
|
->reactive()
|
||||||
|
->integer()
|
||||||
|
->minValue(0)
|
||||||
|
->default(0)
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->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('output_flag')
|
Forms\Components\TextInput::make('output_flag')
|
||||||
->label('Output Flag')
|
->label('Output Flag')
|
||||||
->default('0')
|
->columnSpan(1)
|
||||||
->readOnly(fn (callable $get) => ! $get('id'))
|
->reactive()
|
||||||
|
->integer()
|
||||||
|
->minValue(0)
|
||||||
|
->default(0)
|
||||||
|
->maxValue(1)
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->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\Hidden::make('tested_by')
|
Forms\Components\TextInput::make('tested_by')
|
||||||
|
->label('Tested By')
|
||||||
|
->columnSpan(1)
|
||||||
->default(fn () => Filament::auth()->user()?->name)
|
->default(fn () => Filament::auth()->user()?->name)
|
||||||
|
->readOnly()
|
||||||
->required(),
|
->required(),
|
||||||
Forms\Components\Hidden::make('updated_by')
|
Forms\Components\Hidden::make('updated_by')
|
||||||
->default(fn () => Filament::auth()->user()?->name)
|
->default(fn () => Filament::auth()->user()?->name)
|
||||||
@@ -500,6 +661,8 @@ class TestingPanelReadingResource extends Resource
|
|||||||
Forms\Components\TextInput::make('id')
|
Forms\Components\TextInput::make('id')
|
||||||
->hidden()
|
->hidden()
|
||||||
->readOnly(),
|
->readOnly(),
|
||||||
|
])
|
||||||
|
->columns(['default' => 1, 'sm' => 2]),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -514,6 +677,7 @@ class TestingPanelReadingResource extends Resource
|
|||||||
// ->sortable(),
|
// ->sortable(),
|
||||||
Tables\Columns\TextColumn::make('No.')
|
Tables\Columns\TextColumn::make('No.')
|
||||||
->label('No.')
|
->label('No.')
|
||||||
|
->alignCenter()
|
||||||
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
||||||
$paginator = $livewire->getTableRecords();
|
$paginator = $livewire->getTableRecords();
|
||||||
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||||
@@ -527,6 +691,9 @@ class TestingPanelReadingResource extends Resource
|
|||||||
Tables\Columns\TextColumn::make('line.name')
|
Tables\Columns\TextColumn::make('line.name')
|
||||||
->label('Line Name')
|
->label('Line Name')
|
||||||
->alignCenter(),
|
->alignCenter(),
|
||||||
|
Tables\Columns\TextColumn::make('machine.workGroupMaster.name')
|
||||||
|
->label('Group Work Center')
|
||||||
|
->alignCenter(),
|
||||||
Tables\Columns\TextColumn::make('machine.work_center')
|
Tables\Columns\TextColumn::make('machine.work_center')
|
||||||
->label('Work Center')
|
->label('Work Center')
|
||||||
->alignCenter(),
|
->alignCenter(),
|
||||||
@@ -539,16 +706,28 @@ class TestingPanelReadingResource extends Resource
|
|||||||
Tables\Columns\TextColumn::make('motorTestingMaster.item.description')
|
Tables\Columns\TextColumn::make('motorTestingMaster.item.description')
|
||||||
->label('Model')
|
->label('Model')
|
||||||
->alignCenter(),
|
->alignCenter(),
|
||||||
|
Tables\Columns\TextColumn::make('motorTestingMaster.item.category')
|
||||||
|
->label('Category')
|
||||||
|
->default('-')
|
||||||
|
->alignCenter()
|
||||||
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
|
Tables\Columns\TextColumn::make('motorTestingMaster.item.uom')
|
||||||
|
->label('Unit of Measure')
|
||||||
|
->default('-')
|
||||||
|
->alignCenter()
|
||||||
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
Tables\Columns\TextColumn::make('output')
|
Tables\Columns\TextColumn::make('output')
|
||||||
->label('Output')
|
->label('Output ID')
|
||||||
->alignCenter(),
|
->alignCenter(),
|
||||||
Tables\Columns\TextColumn::make('serial_number')
|
Tables\Columns\TextColumn::make('serial_number')
|
||||||
->label('Serial Number')
|
->label('Motor Serial Number')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
|
->searchable()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('winded_serial_number')
|
Tables\Columns\TextColumn::make('winded_serial_number')
|
||||||
->label('Winded Serial Number')
|
->label('Winded Serial Number')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
|
->searchable()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('motorTestingMaster.kw')
|
Tables\Columns\TextColumn::make('motorTestingMaster.kw')
|
||||||
->label('KW')
|
->label('KW')
|
||||||
@@ -661,7 +840,13 @@ class TestingPanelReadingResource extends Resource
|
|||||||
->alignCenter(),
|
->alignCenter(),
|
||||||
Tables\Columns\TextColumn::make('hv_test')
|
Tables\Columns\TextColumn::make('hv_test')
|
||||||
->label('High Voltage Test')
|
->label('High Voltage Test')
|
||||||
->alignCenter(),
|
->alignCenter()
|
||||||
|
->color(fn (string $state): string => match ($state) {
|
||||||
|
'With Stood' => 'success',
|
||||||
|
'Not With Stood' => 'danger',
|
||||||
|
default => 'warning', // gray
|
||||||
|
})
|
||||||
|
->default('-'),
|
||||||
Tables\Columns\TextColumn::make('batch_number')
|
Tables\Columns\TextColumn::make('batch_number')
|
||||||
->label('Batch Number')
|
->label('Batch Number')
|
||||||
->alignCenter(),
|
->alignCenter(),
|
||||||
@@ -670,13 +855,29 @@ class TestingPanelReadingResource extends Resource
|
|||||||
->alignCenter(),
|
->alignCenter(),
|
||||||
Tables\Columns\TextColumn::make('result')
|
Tables\Columns\TextColumn::make('result')
|
||||||
->label('Result')
|
->label('Result')
|
||||||
->alignCenter(),
|
->alignCenter()
|
||||||
|
->color(fn (string $state): string => match ($state) {
|
||||||
|
'PASS' => 'success',
|
||||||
|
'FAIL' => 'danger',
|
||||||
|
default => 'warning', // gray
|
||||||
|
})
|
||||||
|
->badge()
|
||||||
|
->default('-'),
|
||||||
Tables\Columns\TextColumn::make('remark')
|
Tables\Columns\TextColumn::make('remark')
|
||||||
->label('Remark')
|
->label('Remark')
|
||||||
->alignCenter(),
|
->alignCenter(),
|
||||||
Tables\Columns\TextColumn::make('rework_count')
|
Tables\Columns\TextColumn::make('rework_count')
|
||||||
->label('Rework Count')
|
->label('Rework Count')
|
||||||
->alignCenter(),
|
->alignCenter(),
|
||||||
|
Tables\Columns\TextColumn::make('rework_winded')
|
||||||
|
->label('Rework Winded Status')
|
||||||
|
->alignCenter()
|
||||||
|
->formatStateUsing(fn ($state): string => match ((string) $state) {
|
||||||
|
'1' => 'Yes',
|
||||||
|
'0' => 'No',
|
||||||
|
default => 'No',
|
||||||
|
})
|
||||||
|
->badge(),
|
||||||
Tables\Columns\TextColumn::make('update_count')
|
Tables\Columns\TextColumn::make('update_count')
|
||||||
->label('Updated Count')
|
->label('Updated Count')
|
||||||
->alignCenter(),
|
->alignCenter(),
|
||||||
@@ -695,8 +896,7 @@ class TestingPanelReadingResource extends Resource
|
|||||||
->sortable(),
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('tested_by')
|
Tables\Columns\TextColumn::make('tested_by')
|
||||||
->label('Tested By')
|
->label('Tested By')
|
||||||
->alignCenter()
|
->alignCenter(),
|
||||||
->numeric(),
|
|
||||||
Tables\Columns\TextColumn::make('updated_at')
|
Tables\Columns\TextColumn::make('updated_at')
|
||||||
->label('Updated At')
|
->label('Updated At')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
@@ -704,8 +904,7 @@ class TestingPanelReadingResource extends Resource
|
|||||||
->dateTime(),
|
->dateTime(),
|
||||||
Tables\Columns\TextColumn::make('updated_by')
|
Tables\Columns\TextColumn::make('updated_by')
|
||||||
->label('Updated By')
|
->label('Updated By')
|
||||||
->alignCenter()
|
->alignCenter(),
|
||||||
->numeric(),
|
|
||||||
Tables\Columns\TextColumn::make('deleted_at')
|
Tables\Columns\TextColumn::make('deleted_at')
|
||||||
->label('Deleted At')
|
->label('Deleted At')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
@@ -713,6 +912,7 @@ class TestingPanelReadingResource extends Resource
|
|||||||
->dateTime()
|
->dateTime()
|
||||||
->toggleable(isToggledHiddenByDefault: true),
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
])
|
])
|
||||||
|
->searchPlaceholder('Search by Serial Number')
|
||||||
->filters([
|
->filters([
|
||||||
Tables\Filters\TrashedFilter::make(),
|
Tables\Filters\TrashedFilter::make(),
|
||||||
Filter::make('advanced_filters')
|
Filter::make('advanced_filters')
|
||||||
@@ -720,8 +920,9 @@ class TestingPanelReadingResource extends Resource
|
|||||||
->form([
|
->form([
|
||||||
Select::make('Plant')
|
Select::make('Plant')
|
||||||
->label('Search by Plant Name')
|
->label('Search by Plant Name')
|
||||||
->searchable()
|
|
||||||
->nullable()
|
->nullable()
|
||||||
|
->searchable()
|
||||||
|
->reactive()
|
||||||
->options(function () {
|
->options(function () {
|
||||||
// return Plant::pluck('name', 'id');
|
// return Plant::pluck('name', 'id');
|
||||||
$userHas = Filament::auth()->user()->plant_id;
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
@@ -736,7 +937,6 @@ class TestingPanelReadingResource extends Resource
|
|||||||
|
|
||||||
// return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
|
// return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
|
||||||
})
|
})
|
||||||
->reactive()
|
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
$set('Line', null);
|
$set('Line', null);
|
||||||
$set('item_code', null);
|
$set('item_code', null);
|
||||||
@@ -744,26 +944,25 @@ class TestingPanelReadingResource extends Resource
|
|||||||
}),
|
}),
|
||||||
Select::make('Line')
|
Select::make('Line')
|
||||||
->label('Search by Line Name')
|
->label('Search by Line Name')
|
||||||
->searchable()
|
|
||||||
->nullable()
|
->nullable()
|
||||||
|
->searchable()
|
||||||
|
->reactive()
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$plantId = $get('Plant');
|
$plantId = $get('Plant');
|
||||||
if (! $plantId) {
|
if (! $plantId) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
return Line::where('plant_id', $plantId)
|
return Line::where('plant_id', $plantId)->pluck('name', 'id')->toArray();
|
||||||
->pluck('name', 'id')
|
|
||||||
->toArray();
|
|
||||||
})
|
})
|
||||||
->reactive()
|
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
$set('item_code', null);
|
$set('item_code', null);
|
||||||
}),
|
}),
|
||||||
Select::make('machine_name')
|
Select::make('machine_name')
|
||||||
->label('Search by Work Center')
|
->label('Search by Work Center')
|
||||||
->searchable()
|
|
||||||
->nullable()
|
->nullable()
|
||||||
|
->searchable()
|
||||||
|
->reactive()
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$plantId = $get('Plant');
|
$plantId = $get('Plant');
|
||||||
$lineId = $get('Line');
|
$lineId = $get('Line');
|
||||||
@@ -772,31 +971,26 @@ class TestingPanelReadingResource extends Resource
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
return Machine::where('plant_id', $plantId)
|
return Machine::where('plant_id', $plantId)->where('line_id', $lineId)->pluck('work_center', 'id')->toArray();
|
||||||
->where('line_id', $lineId)
|
}),
|
||||||
->pluck('work_center', 'id')
|
|
||||||
->toArray();
|
|
||||||
})
|
|
||||||
->reactive(),
|
|
||||||
Select::make('item_code')
|
Select::make('item_code')
|
||||||
->label('Search by Item Code')
|
->label('Search by Item Code')
|
||||||
->searchable()
|
|
||||||
->nullable()
|
->nullable()
|
||||||
|
->searchable()
|
||||||
|
->reactive()
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$plantId = $get('Plant');
|
$plantId = $get('Plant');
|
||||||
if ($plantId) {
|
|
||||||
return Item::where('plant_id', $plantId)
|
if (empty($plantId)) {
|
||||||
->whereHas('motorTestingMasters')
|
|
||||||
->pluck('code', 'id')
|
|
||||||
->toArray();
|
|
||||||
} else {
|
|
||||||
return [];
|
return [];
|
||||||
// return Item::whereHas('motorTestingMasters')
|
|
||||||
// ->pluck('code', 'id')
|
|
||||||
// ->toArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return Item::whereHas('motorTestingMasters', function ($query) use ($plantId) {
|
||||||
|
if ($plantId) {
|
||||||
|
$query->where('plant_id', $plantId);
|
||||||
|
}
|
||||||
|
})->pluck('code', 'id')->toArray();
|
||||||
})
|
})
|
||||||
->reactive()
|
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
$set('item_description', null);
|
$set('item_description', null);
|
||||||
}),
|
}),
|
||||||
@@ -806,22 +1000,23 @@ class TestingPanelReadingResource extends Resource
|
|||||||
->placeholder('Enter Serial Number'),
|
->placeholder('Enter Serial Number'),
|
||||||
Select::make('subassembly_code')
|
Select::make('subassembly_code')
|
||||||
->label('Search by Subassembly Code')
|
->label('Search by Subassembly Code')
|
||||||
->searchable()
|
|
||||||
->nullable()
|
->nullable()
|
||||||
|
->searchable()
|
||||||
|
->reactive()
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$plantId = $get('Plant');
|
$plantId = $get('Plant');
|
||||||
|
|
||||||
|
if (empty($plantId)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return MotorTestingMaster::whereHas('testingPanelReadings', function ($query) use ($plantId) {
|
||||||
if ($plantId) {
|
if ($plantId) {
|
||||||
return MotorTestingMaster::whereHas('testingPanelReadings', function ($query) {
|
$query->where('plant_id', $plantId);
|
||||||
|
}
|
||||||
$query->whereNotNull('id');
|
$query->whereNotNull('id');
|
||||||
})->whereNotNull('subassembly_code')->orderBy('subassembly_code')->pluck('subassembly_code', 'id');
|
})->whereNotNull('subassembly_code')->orderBy('subassembly_code')->pluck('subassembly_code', 'id');
|
||||||
} else {
|
|
||||||
return [];
|
|
||||||
// return Item::whereHas('motorTestingMasters')
|
|
||||||
// ->pluck('code', 'id')
|
|
||||||
// ->toArray();
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
->reactive()
|
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
$set('item_description', null);
|
$set('item_description', null);
|
||||||
}),
|
}),
|
||||||
@@ -831,45 +1026,40 @@ class TestingPanelReadingResource extends Resource
|
|||||||
->placeholder('Enter Winded Serial Number'),
|
->placeholder('Enter Winded Serial Number'),
|
||||||
Select::make('item_description')
|
Select::make('item_description')
|
||||||
->label('Search by Model')
|
->label('Search by Model')
|
||||||
|
->nullable()
|
||||||
->searchable()
|
->searchable()
|
||||||
|
->reactive()
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$plantId = $get('Plant');
|
$plantId = $get('Plant');
|
||||||
|
|
||||||
// $query = Item::query();
|
if (empty($plantId)) {
|
||||||
// if ($plantId) {
|
|
||||||
// $query->where('plant_id', $plantId);
|
|
||||||
// }
|
|
||||||
|
|
||||||
$plantId = $get('Plant');
|
|
||||||
if ($plantId) {
|
|
||||||
return Item::where('plant_id', $plantId)
|
|
||||||
->whereHas('motorTestingMasters')
|
|
||||||
->pluck('description', 'id')
|
|
||||||
->toArray();
|
|
||||||
} else {
|
|
||||||
return [];
|
return [];
|
||||||
// return Item::whereHas('motorTestingMasters')
|
|
||||||
// ->pluck('description', 'id')
|
|
||||||
// ->toArray();
|
|
||||||
}
|
}
|
||||||
// return $query->pluck('description', 'description')->toArray();
|
|
||||||
|
return Item::whereHas('motorTestingMasters', function ($query) use ($plantId) {
|
||||||
|
if ($plantId) {
|
||||||
|
$query->where('plant_id', $plantId);
|
||||||
|
}
|
||||||
|
})->pluck('description', 'id')->toArray();
|
||||||
})
|
})
|
||||||
->reactive()
|
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
$set('item_code', null);
|
$set('item_code', null);
|
||||||
}),
|
}),
|
||||||
Select::make('output')
|
Select::make('output')
|
||||||
->label('Search by Output')
|
->label('Search by Output ID')
|
||||||
|
->nullable()
|
||||||
->searchable()
|
->searchable()
|
||||||
->options(function () {
|
->reactive()
|
||||||
return TestingPanelReading::whereNotNull('output')
|
->options(function (callable $get) {
|
||||||
->select('output')
|
$plantId = $get('Plant');
|
||||||
->distinct()
|
|
||||||
->orderBy('output')
|
if (empty($plantId)) {
|
||||||
->pluck('output', 'output') // key and label are both the output value
|
return [];
|
||||||
->toArray();
|
}
|
||||||
})
|
|
||||||
->reactive(),
|
return TestingPanelReading::where('plant_id', $plantId)->whereNotNull('output')->distinct()->orderBy('output')->pluck('output', 'output')->toArray();
|
||||||
|
// ->select('output')
|
||||||
|
}),
|
||||||
// TextInput::make('phase')
|
// TextInput::make('phase')
|
||||||
// ->label('Phase'),
|
// ->label('Phase'),
|
||||||
// Select::make('phase')
|
// Select::make('phase')
|
||||||
@@ -900,10 +1090,11 @@ class TestingPanelReadingResource extends Resource
|
|||||||
// })
|
// })
|
||||||
// ->reactive(),
|
// ->reactive(),
|
||||||
// ...
|
// ...
|
||||||
|
|
||||||
Select::make('connection')
|
Select::make('connection')
|
||||||
->label('Connection')
|
->label('Connection')
|
||||||
->required()
|
->nullable()
|
||||||
|
->reactive()
|
||||||
|
->selectablePlaceholder(false)
|
||||||
->default('Star')
|
->default('Star')
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$plantId = $get('Plant');
|
$plantId = $get('Plant');
|
||||||
@@ -920,8 +1111,7 @@ class TestingPanelReadingResource extends Resource
|
|||||||
->toArray();
|
->toArray();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
->selectablePlaceholder(false)
|
->required(),
|
||||||
->reactive(),
|
|
||||||
// ..
|
// ..
|
||||||
TextInput::make('remark')
|
TextInput::make('remark')
|
||||||
->label('Remark')
|
->label('Remark')
|
||||||
@@ -933,7 +1123,9 @@ class TestingPanelReadingResource extends Resource
|
|||||||
->placeholder(placeholder: 'Enter Batch Number'),
|
->placeholder(placeholder: 'Enter Batch Number'),
|
||||||
Select::make('result')
|
Select::make('result')
|
||||||
->label('Search by Result')
|
->label('Search by Result')
|
||||||
|
->nullable()
|
||||||
->searchable()
|
->searchable()
|
||||||
|
->reactive()
|
||||||
->options(function () {
|
->options(function () {
|
||||||
return TestingPanelReading::query()
|
return TestingPanelReading::query()
|
||||||
->whereNotNull('result')
|
->whereNotNull('result')
|
||||||
@@ -942,11 +1134,12 @@ class TestingPanelReadingResource extends Resource
|
|||||||
->filter() // filters out nulls and empty automatically
|
->filter() // filters out nulls and empty automatically
|
||||||
->mapWithKeys(fn ($value) => [$value => $value])
|
->mapWithKeys(fn ($value) => [$value => $value])
|
||||||
->toArray();
|
->toArray();
|
||||||
})
|
}),
|
||||||
->reactive(),
|
|
||||||
Select::make('tested_by')
|
Select::make('tested_by')
|
||||||
->label('Tested By')
|
->label('Tested By')
|
||||||
->nullable()
|
->nullable()
|
||||||
|
->searchable()
|
||||||
|
->reactive()
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$plantId = $get('Plant');
|
$plantId = $get('Plant');
|
||||||
if (! $plantId) {
|
if (! $plantId) {
|
||||||
@@ -954,22 +1147,22 @@ class TestingPanelReadingResource extends Resource
|
|||||||
} else {
|
} else {
|
||||||
return TestingPanelReading::where('plant_id', $plantId)->whereNotNull('tested_by')->select('tested_by')->distinct()->pluck('tested_by', 'tested_by');
|
return TestingPanelReading::where('plant_id', $plantId)->whereNotNull('tested_by')->select('tested_by')->distinct()->pluck('tested_by', 'tested_by');
|
||||||
}
|
}
|
||||||
})
|
}),
|
||||||
->searchable()
|
DateTimePicker::make('created_from')
|
||||||
->reactive(),
|
|
||||||
DateTimePicker::make(name: 'created_from')
|
|
||||||
->label('Created From')
|
->label('Created From')
|
||||||
->placeholder(placeholder: 'Select From DateTime')
|
->placeholder('Select From DateTime')
|
||||||
->reactive()
|
->reactive()
|
||||||
->native(false),
|
->native(false),
|
||||||
DateTimePicker::make('created_to')
|
DateTimePicker::make('created_to')
|
||||||
->label('Created To')
|
->label('Created To')
|
||||||
->placeholder(placeholder: 'Select To DateTime')
|
->placeholder('Select To DateTime')
|
||||||
->reactive()
|
->reactive()
|
||||||
->native(false),
|
->native(false),
|
||||||
Select::make('updated_by')
|
Select::make('updated_by')
|
||||||
->label('Updated By')
|
->label('Updated By')
|
||||||
->nullable()
|
->nullable()
|
||||||
|
->searchable()
|
||||||
|
->reactive()
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$plantId = $get('Plant');
|
$plantId = $get('Plant');
|
||||||
if (! $plantId) {
|
if (! $plantId) {
|
||||||
@@ -977,17 +1170,15 @@ class TestingPanelReadingResource extends Resource
|
|||||||
} else {
|
} else {
|
||||||
return TestingPanelReading::where('plant_id', $plantId)->whereNotNull('updated_by')->select('updated_by')->distinct()->pluck('updated_by', 'updated_by');
|
return TestingPanelReading::where('plant_id', $plantId)->whereNotNull('updated_by')->select('updated_by')->distinct()->pluck('updated_by', 'updated_by');
|
||||||
}
|
}
|
||||||
})
|
}),
|
||||||
->searchable()
|
DateTimePicker::make('updated_from')
|
||||||
->reactive(),
|
|
||||||
DateTimePicker::make(name: 'updated_from')
|
|
||||||
->label('Updated From')
|
->label('Updated From')
|
||||||
->placeholder(placeholder: 'Select From DateTime')
|
->placeholder('Select From DateTime')
|
||||||
->reactive()
|
->reactive()
|
||||||
->native(false),
|
->native(false),
|
||||||
DateTimePicker::make('updated_to')
|
DateTimePicker::make('updated_to')
|
||||||
->label('Updated To')
|
->label('Updated To')
|
||||||
->placeholder(placeholder: 'Select To DateTime')
|
->placeholder('Select To DateTime')
|
||||||
->reactive()
|
->reactive()
|
||||||
->native(false),
|
->native(false),
|
||||||
])
|
])
|
||||||
@@ -1141,7 +1332,7 @@ class TestingPanelReadingResource extends Resource
|
|||||||
$indicators[] = 'Subassembly Code: '.MotorTestingMaster::where('id', $data['subassembly_code'])->value('subassembly_code');
|
$indicators[] = 'Subassembly Code: '.MotorTestingMaster::where('id', $data['subassembly_code'])->value('subassembly_code');
|
||||||
}
|
}
|
||||||
if (! empty($data['output'])) {
|
if (! empty($data['output'])) {
|
||||||
$indicators[] = 'Output: '.$data['output'];
|
$indicators[] = 'Output ID: '.$data['output'];
|
||||||
}
|
}
|
||||||
if (! empty($data['item_description'])) {
|
if (! empty($data['item_description'])) {
|
||||||
$item = Item::where('id', $data['item_description'])->first()?->description ?? null;
|
$item = Item::where('id', $data['item_description'])->first()?->description ?? null;
|
||||||
|
|||||||
Reference in New Issue
Block a user