Added status in filter and modified logic in rework action #990
@@ -1003,6 +1003,10 @@ class PanelBoxValidationResource extends Resource
|
||||
->where('inspection_lot_number', $inspecLotNo)
|
||||
->first();
|
||||
|
||||
$alreadyExistsSupplier = PanelBoxValidation::where('serial_number', $serialNumber)
|
||||
->where('plant_id', $plantId)
|
||||
->first();
|
||||
|
||||
if ($alreadyExists) {
|
||||
Notification::make()
|
||||
->title('Duplicate Found')
|
||||
@@ -1016,9 +1020,9 @@ class PanelBoxValidationResource extends Resource
|
||||
|
||||
return;
|
||||
}
|
||||
else if(!$alreadyExists)
|
||||
if($alreadyExistsSupplier)
|
||||
{
|
||||
if($alreadyExists->panel_box_supplier != $supplierNo){
|
||||
if($alreadyExistsSupplier->panel_box_supplier != $supplierNo){
|
||||
Notification::make()
|
||||
->title('Supplier Mismatch')
|
||||
->body(
|
||||
@@ -2007,6 +2011,13 @@ class PanelBoxValidationResource extends Resource
|
||||
0 => 'No',
|
||||
])
|
||||
->reactive(),
|
||||
Select::make('status')
|
||||
->label('Status')
|
||||
->options([
|
||||
'Ok' => 'Ok',
|
||||
'NotOk' => 'Not Ok',
|
||||
])
|
||||
->reactive(),
|
||||
DateTimePicker::make(name: 'created_from')
|
||||
->label('Created From')
|
||||
->placeholder('Select From DateTime')
|
||||
@@ -2020,7 +2031,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['rework_count']) && 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['status']) && empty($data['created_from']) && empty($data['created_to'])) {
|
||||
return $query->whereRaw('1 = 0');
|
||||
}
|
||||
|
||||
@@ -2073,6 +2084,10 @@ class PanelBoxValidationResource extends Resource
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($data['status'])) {
|
||||
$query->where('status', $data['status']);
|
||||
}
|
||||
|
||||
if (! empty($data['created_from'])) {
|
||||
$query->where('created_at', '>=', $data['created_from']);
|
||||
}
|
||||
@@ -2119,6 +2134,10 @@ class PanelBoxValidationResource extends Resource
|
||||
$indicators[] = 'Panel Box Code: '.$data['panel_box_code'];
|
||||
}
|
||||
|
||||
if (! empty($data['status'])) {
|
||||
$indicators[] = 'Status: '.$data['status'];
|
||||
}
|
||||
|
||||
if (! empty($data['created_from'])) {
|
||||
$indicators[] = 'From: '.$data['created_from'];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user