1
0
forked from poc/pds

Refactor validation logic in CreateInvoiceValidation to include additional checks for package types (use pack_slip if tube_sticker does not exist) and streamline code structure

This commit is contained in:
dhanabalan
2025-09-26 18:59:33 +05:30
parent d2c7f85917
commit 998fbf814c
2 changed files with 32 additions and 27 deletions

View File

@@ -481,7 +481,6 @@ class InvoiceValidationResource extends Resource
$duplicateSerialCodes = array_unique($duplicateSerials);
if (!empty($uniqueInvalidCodes)) {
Notification::make()
->title('Invalid Item Codes')
@@ -539,17 +538,17 @@ class InvoiceValidationResource extends Resource
return;
}
$uniqueCodes = array_unique($materialCodes);
$uniqueCodes = array_unique($materialCodes);
$matchedItems = StickerMaster::with('item')
->whereHas('item', function ($query) use ($uniqueCodes) {
$query->whereIn('code', $uniqueCodes);
})
->get();
$matchedItems = StickerMaster::with('item')
->whereHas('item', function ($query) use ($uniqueCodes) {
$query->whereIn('code', $uniqueCodes);
})
->get();
$matchedCodes = $matchedItems->pluck('item.code')->toArray();
$matchedCodes = $matchedItems->pluck('item.code')->toArray();
$missingCodes = array_diff($uniqueCodes, $matchedCodes);
$missingCodes = array_diff($uniqueCodes, $matchedCodes);
if (!empty($missingCodes))
{
@@ -615,7 +614,6 @@ class InvoiceValidationResource extends Resource
->visible(function() {
return Filament::auth()->user()->can('view import serial invoice');
}),
Tables\Actions\Action::make('Import Invoice Material')
->label('Import Material Invoice')
->form([