Added category logic in create quality validation page #629
@@ -30,7 +30,7 @@ class CreateQualityValidation extends CreateRecord
|
||||
'checklistUpdated' => 'setChecklist',
|
||||
'checklist-cancelled' => 'handleChecklistCancel',
|
||||
'checklist-saved' => 'checkListSaved',
|
||||
'trigger-create' => 'doCreate',
|
||||
// 'trigger-create' => 'doCreate',
|
||||
];
|
||||
|
||||
public function setChecklist($checklist)
|
||||
@@ -89,13 +89,15 @@ class CreateQualityValidation extends CreateRecord
|
||||
->where('plant_id', $plantId)
|
||||
->first();
|
||||
|
||||
$categoryName = trim($item->category) ?? null;
|
||||
|
||||
if (!$item) {
|
||||
$this->existingRecords = collect();
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->existingRecords = ProductCharacteristicsMaster::where('plant_id', $plantId)
|
||||
->where('item_id', $item->id)
|
||||
->where('category', $categoryName)
|
||||
->where('line_id', $lineId)
|
||||
->get();
|
||||
}
|
||||
@@ -201,6 +203,7 @@ class CreateQualityValidation extends CreateRecord
|
||||
$checklist = $this->data['data']['checklist'] ?? [];
|
||||
|
||||
if (count($this->existingRecords) > 0){
|
||||
|
||||
$this->showChecklist = true;
|
||||
$this->halt();
|
||||
}
|
||||
@@ -223,10 +226,11 @@ class CreateQualityValidation extends CreateRecord
|
||||
return;
|
||||
}
|
||||
|
||||
$item_id = $item->id;
|
||||
// $item_id = $item->id;
|
||||
$categoryName = trim($item->category) ?? null;
|
||||
|
||||
$this->existingRecords = ProductCharacteristicsMaster::where('plant_id', $plant_id)
|
||||
->where('item_id', $item_id)
|
||||
->where('category', $categoryName)
|
||||
->where('line_id', $line_id)
|
||||
->get();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user