changed logic for select for not ok allowed for incomplete checklist
Some checks failed
Gemini PR Review / Gemini PR Review (pull_request) Failing after 18s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 30s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 26s
Laravel Pint / pint (pull_request) Successful in 4m20s
Laravel Larastan / larastan (pull_request) Failing after 5m15s
Some checks failed
Gemini PR Review / Gemini PR Review (pull_request) Failing after 18s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 30s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 26s
Laravel Pint / pint (pull_request) Successful in 4m20s
Laravel Larastan / larastan (pull_request) Failing after 5m15s
This commit is contained in:
@@ -69,14 +69,16 @@ public $records = [];
|
||||
public function saveChecklist()
|
||||
{
|
||||
|
||||
if(!$this->selectForNotOk){
|
||||
|
||||
if (empty($this->checklist) || count($this->checklist) != count($this->records)) {
|
||||
Notification::make()
|
||||
->title('Incomplete Checklist')
|
||||
->body('Please complete all checklist fields before submitting.')
|
||||
->danger()
|
||||
->send();
|
||||
return;
|
||||
if (empty($this->checklist) || count($this->checklist) != count($this->records)) {
|
||||
Notification::make()
|
||||
->title('Incomplete Checklist')
|
||||
->body('Please complete all checklist fields before submitting.')
|
||||
->danger()
|
||||
->send();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$item = Item::where('code', $this->data['item_id'])->first();
|
||||
@@ -209,10 +211,58 @@ public $records = [];
|
||||
return;
|
||||
}
|
||||
|
||||
// if($this->selectForNotOk){
|
||||
|
||||
// foreach ($this->checklist as $characteristicId => $value) {
|
||||
|
||||
// $characteristic = ProductCharacteristicsMaster::find($characteristicId);
|
||||
|
||||
// $itemCharacteristic = ProductCharacteristicsMaster::where('plant_id', $this->data['plant_id'])
|
||||
// ->where('line_id', $this->data['line_id'])
|
||||
// ->where('name', $characteristic->name)
|
||||
// ->where('item_id', $itemId)
|
||||
// ->first();
|
||||
|
||||
// if (($itemCharacteristic?->inspection_type ?? null) === 'Value') {
|
||||
|
||||
// if ($itemCharacteristic && is_numeric($value) && $value >= $itemCharacteristic->lower && $value <= $itemCharacteristic->upper
|
||||
// ) {
|
||||
// $status = 'Ok';
|
||||
// } else {
|
||||
// $status = 'NotOk';
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// $status = $value;
|
||||
// }
|
||||
|
||||
// $prod = ProductionCharacteristic::create([
|
||||
// 'plant_id' => $this->data['plant_id'] ?? null,
|
||||
// 'item_id' => $itemId ?? null,
|
||||
// 'line_id' => $this->data['line_id'] ?? null,
|
||||
// 'machine_id' => $characteristic?->machine_id ?? null,
|
||||
// 'production_order' => $this->data['production_order'] ?? null,
|
||||
// 'serial_number' => $this->data['serial_number'] ?? null,
|
||||
// 'characteristic_name' => $characteristic?->name ?? null,
|
||||
// 'observed_value' => $value ?? null,
|
||||
// 'status' => $status,
|
||||
// 'inspection_status' => $finalInspectionStatus ?? null,
|
||||
// 'inspection_lot_number' => $this->data['inspection_lot_number'] ?? null,
|
||||
// 'created_by' => $this->data['created_by'] ?? null,
|
||||
// 'updated_by' => $this->data['updated_by'] ?? null,
|
||||
// ]);
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
|
||||
if($this->selectForNotOk){
|
||||
|
||||
foreach ($this->checklist as $characteristicId => $value) {
|
||||
foreach ($this->records as $record) {
|
||||
|
||||
$characteristicId = $record['id'];
|
||||
|
||||
$value = $this->checklist[$characteristicId] ?? null;
|
||||
|
||||
$characteristic = ProductCharacteristicsMaster::find($characteristicId);
|
||||
|
||||
@@ -223,8 +273,10 @@ public $records = [];
|
||||
->first();
|
||||
|
||||
if (($itemCharacteristic?->inspection_type ?? null) === 'Value') {
|
||||
|
||||
if ($itemCharacteristic && is_numeric($value) && $value >= $itemCharacteristic->lower && $value <= $itemCharacteristic->upper
|
||||
if ($value == null || $value == '') {
|
||||
$status = null;
|
||||
}
|
||||
else if ($itemCharacteristic && is_numeric($value) && $value >= $itemCharacteristic->lower && $value <= $itemCharacteristic->upper
|
||||
) {
|
||||
$status = 'Ok';
|
||||
} else {
|
||||
@@ -232,7 +284,7 @@ public $records = [];
|
||||
}
|
||||
}
|
||||
else {
|
||||
$status = $value;
|
||||
$status = !empty($value) ? $value : null;
|
||||
}
|
||||
|
||||
$prod = ProductionCharacteristic::create([
|
||||
@@ -251,7 +303,6 @@ public $records = [];
|
||||
'updated_by' => $this->data['updated_by'] ?? null,
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -267,7 +318,7 @@ public $records = [];
|
||||
->where('item_id', $itemId)
|
||||
->first();
|
||||
|
||||
if (($itemCharacteristic?->inspection_type ?? null) === 'Value') {
|
||||
if (($itemCharacteristic?->inspection_type ?? null) == 'Value') {
|
||||
|
||||
if ($itemCharacteristic && is_numeric($value) && $value >= $itemCharacteristic->lower && $value <= $itemCharacteristic->upper
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user