modified logic in upload ocr
This commit is contained in:
@@ -35,25 +35,8 @@ class OcrValidationResource extends Resource
|
||||
public $camera_capture;
|
||||
public $serialNumbers = [];
|
||||
|
||||
|
||||
// protected $listeners = [
|
||||
// 'set-serial-numbers' => 'fillSerialNumbers'
|
||||
// ];
|
||||
|
||||
use InteractsWithForms;
|
||||
|
||||
// public function fillSerialNumbers($event)
|
||||
// {
|
||||
// $serialNumbers = $event['serialNumbers'] ?? [];
|
||||
|
||||
// $this->form->fill([
|
||||
// 'serial_1' => $serialNumbers[0] ?? null,
|
||||
// 'serial_2' => $serialNumbers[1] ?? null,
|
||||
// 'serial_3' => $serialNumbers[2] ?? null,
|
||||
// 'serial_4' => $serialNumbers[3] ?? null,
|
||||
// ]);
|
||||
// }
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
@@ -125,7 +108,6 @@ class OcrValidationResource extends Resource
|
||||
->directory('uploads/temp')
|
||||
->preserveFilenames()
|
||||
->reactive(),
|
||||
|
||||
Forms\Components\Actions::make([
|
||||
Action::make('uploadNow')
|
||||
->label('Upload PDF Now')
|
||||
@@ -142,7 +124,7 @@ class OcrValidationResource extends Resource
|
||||
// $originalName = $uploaded->getClientOriginalName();
|
||||
// $path = 'uploads/GRNumber/' . $originalName;
|
||||
$finalFileName = $safeName . '.pdf';
|
||||
$finalPath = 'uploads/OcrGRNumber/' . $finalFileName;
|
||||
$finalPath = 'uploads/OcrGrNumber/' . $finalFileName;
|
||||
|
||||
if (Storage::disk('local')->exists($finalPath)) {
|
||||
Notification::make()
|
||||
@@ -211,7 +193,7 @@ class OcrValidationResource extends Resource
|
||||
}
|
||||
|
||||
$storedPath = $uploaded->storeAs(
|
||||
'uploads/OcrGRNumber',
|
||||
'uploads/OcrGrNumber',
|
||||
$finalFileName,
|
||||
'local'
|
||||
);
|
||||
@@ -285,7 +267,7 @@ class OcrValidationResource extends Resource
|
||||
$grNumber = trim($grNumber);
|
||||
|
||||
//$templatePath = storage_path('app/private/uploads/StickerTemplateOcr/Single.pdf');
|
||||
$templatePath = storage_path("app/private/uploads/OcrGRNumber/{$grNumber}.pdf");
|
||||
$templatePath = storage_path("app/private/uploads/OcrGrNumber/{$grNumber}.pdf");
|
||||
|
||||
if(!file_exists($templatePath))
|
||||
{
|
||||
@@ -364,9 +346,14 @@ class OcrValidationResource extends Resource
|
||||
|
||||
$plant = Plant::find($plant);
|
||||
|
||||
// $templatePath = storage_path('app/private/uploads/StickerTemplateOcr/multi.pdf');
|
||||
$grNumber = trim($grNumber);
|
||||
|
||||
$templatePath = storage_path("app/private/uploads/OcrGrNumber/'$grNumber'.pdf");
|
||||
//$templatePath = storage_path('app/private/uploads/StickerTemplateOcr/Single.pdf');
|
||||
$templatePath = storage_path("app/private/uploads/OcrGrNumber/{$grNumber}.pdf");
|
||||
|
||||
// $templatePath = storage_path('app/private/uploads/StickerTemplateOcr/multi.pdf');
|
||||
|
||||
//$templatePath = storage_path("app/private/uploads/OcrGrNumber/'$grNumber'.pdf");
|
||||
|
||||
if(!file_exists($templatePath))
|
||||
{
|
||||
@@ -464,7 +451,7 @@ class OcrValidationResource extends Resource
|
||||
return;
|
||||
}
|
||||
|
||||
$files = Storage::disk('local')->files('uploads/GRNumber');
|
||||
$files = Storage::disk('local')->files('uploads/OcrGRNumber');
|
||||
|
||||
$fileToDownload = null;
|
||||
foreach ($files as $file) {
|
||||
@@ -481,7 +468,6 @@ class OcrValidationResource extends Resource
|
||||
->send();
|
||||
return;
|
||||
}
|
||||
|
||||
return response()->download(Storage::disk('local')->path($fileToDownload));
|
||||
}),
|
||||
]),
|
||||
|
||||
Reference in New Issue
Block a user