Merge pull request 'Added category logic in create quality validation page' (#629) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #629
This commit was merged in pull request #629.
This commit is contained in:
@@ -30,7 +30,7 @@ class CreateQualityValidation extends CreateRecord
|
|||||||
'checklistUpdated' => 'setChecklist',
|
'checklistUpdated' => 'setChecklist',
|
||||||
'checklist-cancelled' => 'handleChecklistCancel',
|
'checklist-cancelled' => 'handleChecklistCancel',
|
||||||
'checklist-saved' => 'checkListSaved',
|
'checklist-saved' => 'checkListSaved',
|
||||||
'trigger-create' => 'doCreate',
|
// 'trigger-create' => 'doCreate',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function setChecklist($checklist)
|
public function setChecklist($checklist)
|
||||||
@@ -89,13 +89,15 @@ class CreateQualityValidation extends CreateRecord
|
|||||||
->where('plant_id', $plantId)
|
->where('plant_id', $plantId)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
|
$categoryName = trim($item->category) ?? null;
|
||||||
|
|
||||||
if (!$item) {
|
if (!$item) {
|
||||||
$this->existingRecords = collect();
|
$this->existingRecords = collect();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->existingRecords = ProductCharacteristicsMaster::where('plant_id', $plantId)
|
$this->existingRecords = ProductCharacteristicsMaster::where('plant_id', $plantId)
|
||||||
->where('item_id', $item->id)
|
->where('category', $categoryName)
|
||||||
->where('line_id', $lineId)
|
->where('line_id', $lineId)
|
||||||
->get();
|
->get();
|
||||||
}
|
}
|
||||||
@@ -201,6 +203,7 @@ class CreateQualityValidation extends CreateRecord
|
|||||||
$checklist = $this->data['data']['checklist'] ?? [];
|
$checklist = $this->data['data']['checklist'] ?? [];
|
||||||
|
|
||||||
if (count($this->existingRecords) > 0){
|
if (count($this->existingRecords) > 0){
|
||||||
|
|
||||||
$this->showChecklist = true;
|
$this->showChecklist = true;
|
||||||
$this->halt();
|
$this->halt();
|
||||||
}
|
}
|
||||||
@@ -223,10 +226,11 @@ class CreateQualityValidation extends CreateRecord
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$item_id = $item->id;
|
// $item_id = $item->id;
|
||||||
|
$categoryName = trim($item->category) ?? null;
|
||||||
|
|
||||||
$this->existingRecords = ProductCharacteristicsMaster::where('plant_id', $plant_id)
|
$this->existingRecords = ProductCharacteristicsMaster::where('plant_id', $plant_id)
|
||||||
->where('item_id', $item_id)
|
->where('category', $categoryName)
|
||||||
->where('line_id', $line_id)
|
->where('line_id', $line_id)
|
||||||
->get();
|
->get();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user