Merge pull request 'solved bug issue in panel box validation' (#942) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s

Reviewed-on: #942
This commit was merged in pull request #942.
This commit is contained in:
2026-08-26 10:05:22 +00:00

View File

@@ -5,6 +5,7 @@ namespace App\Filament\Resources;
use App\Filament\Resources\PanelBoxValidationResource\Pages;
use App\Filament\Resources\PanelBoxValidationResource\RelationManagers;
use App\Models\PanelBoxValidation;
use App\Models\ProductionCharacteristic;
use Filament\Facades\Filament;
use Filament\Forms;
use Filament\Forms\Form;
@@ -807,6 +808,13 @@ class PanelBoxValidationResource extends Resource
}
}
// $okSerialExists = ProductionCharacteristic::where('serial_number', $serialNumber)->where('plant_id', $plantId)->get();
// if($okSerialExists){
// }
$serialExists = PanelBoxValidation::where('serial_number', $serialNumber)->where('plant_id', $plantId)->latest()->first();
if ($serialExists) {
@@ -1029,7 +1037,8 @@ class PanelBoxValidationResource extends Resource
else
{
// $livewire->showChecklist = true;
$data = $livewire->data;
// $data = $livewire->data;
$data = $get();
if ($livewire->checkIfHasCharacteristics($data)) {
@@ -1963,6 +1972,13 @@ class PanelBoxValidationResource extends Resource
->label('Panel Box Code')
->reactive()
->placeholder('Enter Panel Box Code'),
Select::make('rework_count')
->label('Rework')
->options([
1 => 'Yes',
0 => 'No',
])
->reactive(),
DateTimePicker::make(name: 'created_from')
->label('Created From')
->placeholder('Select From DateTime')
@@ -1976,7 +1992,7 @@ class PanelBoxValidationResource extends Resource
])
->query(function ($query, array $data) {
// Hide all records initially if no filters are applied
if (empty($data['Plant']) && empty($data['Line']) && empty($data['Item']) && empty($data['production_order']) && empty($data['serial_number']) && empty($data['inspection_lot_number']) && empty($data['panel_box_code']) && empty($data['created_from']) && empty($data['created_to'])) {
if (empty($data['Plant']) && empty($data['Line']) && empty($data['Item']) && empty($data['production_order']) && empty($data['serial_number']) && empty($data['inspection_lot_number']) && empty($data['panel_box_code']) && empty($data['rework_count']) && empty($data['created_from']) && empty($data['created_to'])) {
return $query->whereRaw('1 = 0');
}
@@ -2020,6 +2036,15 @@ class PanelBoxValidationResource extends Resource
$query->where('panel_box_code', 'like', '%'.$data['panel_box_code'].'%');
}
if (! empty($data['rework_count'])) {
if ($data['rework_count'] == 1) {
$query->where('rework_count', '>', 0);
}
else if ($data['rework_count'] == 0) {
$query->where('rework_count', '=', '0');
}
}
if (! empty($data['created_from'])) {
$query->where('created_at', '>=', $data['created_from']);
}