Updated item code validations and warning messages on import
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Has been cancelled
Laravel Larastan / larastan (pull_request) Has been cancelled
Laravel Pint / pint (pull_request) Has been cancelled
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Has been cancelled
Laravel Larastan / larastan (pull_request) Has been cancelled
Laravel Pint / pint (pull_request) Has been cancelled
This commit is contained in:
@@ -624,9 +624,7 @@ class InvoiceValidationResource extends Resource
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (! $validRowsFound) {
|
||||
} elseif (! $validRowsFound) {
|
||||
Notification::make()
|
||||
->title('Invalid Serial Invoice')
|
||||
->danger() // This makes the notification red to indicate an error
|
||||
@@ -641,9 +639,9 @@ class InvoiceValidationResource extends Resource
|
||||
|
||||
$uniqueCodes = array_unique($materialCodes);
|
||||
|
||||
$matchedItems = StickerMaster::with('item')
|
||||
->whereHas('item', function ($query) use ($uniqueCodes) {
|
||||
$query->whereIn('code', $uniqueCodes);
|
||||
$matchedItems = StickerMaster::with('item')->where('plant_id', $plantId)
|
||||
->whereHas('item', function ($query) use ($uniqueCodes, $plantId) {
|
||||
$query->whereIn('code', $uniqueCodes)->where('plant_id', $plantId);
|
||||
})
|
||||
->get();
|
||||
|
||||
@@ -654,7 +652,7 @@ class InvoiceValidationResource extends Resource
|
||||
if (! empty($missingCodes)) {
|
||||
$missingCount = count($missingCodes);
|
||||
|
||||
$message = $missingCount > 10 ? "'$missingCount' item codes are not found in database." : 'The following item codes are not found in database:<br>'.implode(', ', $missingCodes);
|
||||
$message = $missingCount > 10 ? "'$missingCount' item codes are not found in sticker master." : 'The following item codes are not found in sticker master:<br>'.implode(', ', $missingCodes);
|
||||
|
||||
Notification::make()
|
||||
->title('Unknown Item Codes')
|
||||
@@ -678,7 +676,7 @@ class InvoiceValidationResource extends Resource
|
||||
if (count($invalidCodes) > 10) {
|
||||
Notification::make()
|
||||
->title('Invalid item codes found')
|
||||
->body(''.count($invalidCodes).'item codes found have material type.')
|
||||
->body(''.count($invalidCodes).' item codes have material type.')
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
@@ -920,9 +918,7 @@ class InvoiceValidationResource extends Resource
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (! empty($uniqueaplhaMat)) {
|
||||
} elseif (! empty($uniqueaplhaMat)) {
|
||||
Notification::make()
|
||||
->title('Invalid Material Quantity')
|
||||
->body('The following item codes material quantity must be a numeric values :<br>'.implode(', ', $uniqueaplhaMat))
|
||||
@@ -934,9 +930,7 @@ class InvoiceValidationResource extends Resource
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (! empty($uniqueZeroMat)) {
|
||||
} elseif (! empty($uniqueZeroMat)) {
|
||||
Notification::make()
|
||||
->title('Invalid Material Quantity')
|
||||
->body('The following item codes material quantity should be greater than 0:<br>'.implode(', ', $uniqueZeroMat))
|
||||
@@ -948,9 +942,7 @@ class InvoiceValidationResource extends Resource
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (! empty($uniqueEmptyMat)) {
|
||||
} elseif (! empty($uniqueEmptyMat)) {
|
||||
Notification::make()
|
||||
->title('Missing Material Quantity')
|
||||
->body("The following item codes doesn't have valid material quantity:<br>".implode(', ', $uniqueEmptyMat))
|
||||
@@ -962,9 +954,7 @@ class InvoiceValidationResource extends Resource
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (! $validRowsFound) {
|
||||
} elseif (! $validRowsFound) {
|
||||
Notification::make()
|
||||
->title('Invalid Material Invoice')
|
||||
->danger() // This makes the notification red to indicate an error
|
||||
@@ -980,9 +970,9 @@ class InvoiceValidationResource extends Resource
|
||||
|
||||
$uniqueCodes = array_unique($materialCodes);
|
||||
|
||||
$matchedItems = StickerMaster::with('item')
|
||||
->whereHas('item', function ($query) use ($uniqueCodes) {
|
||||
$query->whereIn('code', $uniqueCodes);
|
||||
$matchedItems = StickerMaster::with('item')->where('plant_id', $plantId)
|
||||
->whereHas('item', function ($query) use ($uniqueCodes, $plantId) {
|
||||
$query->whereIn('code', $uniqueCodes)->where('plant_id', $plantId);
|
||||
})
|
||||
->get();
|
||||
|
||||
@@ -993,9 +983,7 @@ class InvoiceValidationResource extends Resource
|
||||
if (! empty($missingCodes)) {
|
||||
$missingCount = count($missingCodes);
|
||||
|
||||
$message = $missingCount > 10
|
||||
? "'$missingCount' Item Codes are not found in sticker master."
|
||||
: 'Item Codes are not found in sticker master:<br>'.implode(', ', $missingCodes);
|
||||
$message = $missingCount > 10 ? "'$missingCount' item codes are not found in sticker master." : 'The following item codes are not found in sticker master:<br>'.implode(', ', $missingCodes);
|
||||
|
||||
Notification::make()
|
||||
->title('Unknown Item Codes')
|
||||
@@ -1019,7 +1007,7 @@ class InvoiceValidationResource extends Resource
|
||||
$invalidCodes = array_unique($invalidCodes);
|
||||
Notification::make()
|
||||
->title('Invalid item codes found')
|
||||
->body(''.count($invalidCodes).'invalid item codes found have serial number.')
|
||||
->body(''.count($invalidCodes).' item codes have serial type.')
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user