remove item code checkign validation part in ocr validation page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 29s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 20s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 27s
Laravel Larastan / larastan (pull_request) Failing after 3m51s
Laravel Pint / pint (pull_request) Successful in 5m48s

This commit is contained in:
dhanabalan
2026-08-13 09:40:12 +05:30
parent 6b8b03b2e3
commit b662795677

View File

@@ -146,21 +146,22 @@ class OcrValidationResource extends Resource
// $fullPath = storage_path('app/' . $storedPath);
$fullPath = storage_path('app/private/'.$storedPath);
$parser = new Parser;
// $pdf = $parser->parseContent(file_get_contents($uploaded->getRealPath()));
$pdf = $parser->parseContent(file_get_contents($uploaded->getRealPath()));
$pdf = $parser->parseFile($fullPath);
$text = $pdf->getText();
// dd($text);
// dd($text);
$item1 = null;
$item2 = null;
if (preg_match('/Item code\s*:\s*(\S+)/i', $text, $matches)) {
$item1 = $matches[1];
} elseif (preg_match('/E CODE\s*:\s*(\S+)/i', $text, $matches)) {
$item2 = $matches[1];
}
// if (preg_match('/Item code\s*:\s*(\S+)/i', $text, $matches)) {
// $item1 = $matches[1];
// }
// // elseif (preg_match('/E CODE\s*:\s*(\S+)/i', $text, $matches)) {
// else if (preg_match('/(?:Item\s*code|E[-\s]*CODE)\s*:\s*(\S+)/i', $text, $matches)) {
// $item2 = $matches[1];
// }
// dd($item2);
$processOrder = $get('gr_number');
@@ -194,36 +195,45 @@ class OcrValidationResource extends Resource
'local'
);
if ($itemCode == $item1) {
Notification::make()
Notification::make()
->title('Success')
->body("Gr Number '$processOrder' PDF uploaded successfully.")
->success()
->send();
return;
}
if ($itemCode == $item2) {
Notification::make()
->title('Success')
->body("Gr Number '$processOrder' PDF uploaded successfully.")
->success()
->send();
return;
} else {
Notification::make()
->title('Item Code not matched')
->body("Item Code: {$item->code} not matched with the uploaded pdf code $item1.")
->danger()
->send();
// if ($itemCode == $item1) {
// Notification::make()
// ->title('Success')
// ->body("Gr Number '$processOrder' PDF uploaded successfully.")
// ->success()
// ->send();
if (Storage::disk('local')->exists($storedPath)) {
Storage::disk('local')->delete($storedPath);
}
// return;
// }
// if ($itemCode == $item2) {
// Notification::make()
// ->title('Success')
// ->body("Gr Number '$processOrder' PDF uploaded successfully.")
// ->success()
// ->send();
return;
}
// return;
// }
// else {
// Notification::make()
// ->title('Item Code not matched')
// ->body("Item Code: {$item->code} not matched with the uploaded pdf code $item2.")
// ->danger()
// ->send();
// if (Storage::disk('local')->exists($storedPath)) {
// Storage::disk('local')->delete($storedPath);
// }
// return;
// }
}
} else {
Notification::make()