From a78cb75bdd4877b14894d53df1dd817b0d5f9934 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Tue, 29 Jul 2025 13:56:30 +0530 Subject: [PATCH] Added reprint for scan pallet --- .../Resources/PalletValidationResource.php | 2 +- app/Http/Controllers/PalletController.php | 56 +++++++++++++++++++ routes/api.php | 2 + 3 files changed, 59 insertions(+), 1 deletion(-) diff --git a/app/Filament/Resources/PalletValidationResource.php b/app/Filament/Resources/PalletValidationResource.php index 74d2003..d2ae977 100644 --- a/app/Filament/Resources/PalletValidationResource.php +++ b/app/Filament/Resources/PalletValidationResource.php @@ -521,7 +521,7 @@ class PalletValidationResource extends Resource ]) ->action(function (array $data) { $selectedPalletNumber = $data['pallet_list']; - return redirect()->route('download-qr-pdf', ['palletNo' => $selectedPalletNumber]); + return redirect()->route('download-reprint-qr-pdf', ['palletNo' => $selectedPalletNumber]); }) ->visible(function() { diff --git a/app/Http/Controllers/PalletController.php b/app/Http/Controllers/PalletController.php index 49fedba..90b7c80 100644 --- a/app/Http/Controllers/PalletController.php +++ b/app/Http/Controllers/PalletController.php @@ -17,6 +17,62 @@ class PalletController extends Controller // } + public function downloadReprintQrPdf($palletNo) + { + $qrCode = new QrCode($palletNo); + $output = new Output\Png(); + $qrBinary = $output->output($qrCode, 100); + $qrBase64 = base64_encode($qrBinary); + + return ' + + + + + + + + + + +
+ QR + + ' . htmlspecialchars($palletNo) . ' +
+ + + + '; + + // $mpdf = new Mpdf([ + // 'mode' => 'utf-8', + // 'format' => [60, 14], + // 'margin_left' => 0, + // 'margin_right' => 0, + // 'margin_top' => 0, + // 'margin_bottom' => 0, + // // 'tempDir' => '/var/www/storage/mpdf-tmp', + // ]); + + // $mpdf->WriteHTML($html); + // // Output PDF to browser for printing + // $mpdf->Output('qr-label.pdf', 'I'); + } + public function downloadQrPdf($palletNo) { $qrCode = new QrCode($palletNo); diff --git a/routes/api.php b/routes/api.php index f98d8ec..7ca3f7b 100644 --- a/routes/api.php +++ b/routes/api.php @@ -82,6 +82,8 @@ Route::get('sticker/get-master-type-data', [StickerMasterController::class, 'get Route::get('/download-qr-pdf/{palletNo}', [PalletController::class, 'downloadQrPdf'])->name('download-qr-pdf'); +Route::get('/download-qr-pdf/{palletNo}', [PalletController::class, 'downloadReprintQrPdf'])->name('download-reprint-qr-pdf'); + Route::get('/download-qr1-pdf/{palletNo}', [ProductionStickerReprintController::class, 'downloadQrPdf'])->name('download-qr1-pdf'); //Production Dashboard Controller