From fd738f604c98a97cf40740604f2be003d525dc56 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Mon, 28 Sep 2026 17:33:03 +0530 Subject: [PATCH] Added logic in bulk sticker printing page --- app/Filament/Pages/BulkStickerPrinting.php | 38 +++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/app/Filament/Pages/BulkStickerPrinting.php b/app/Filament/Pages/BulkStickerPrinting.php index 6ae0e74..d5968b2 100644 --- a/app/Filament/Pages/BulkStickerPrinting.php +++ b/app/Filament/Pages/BulkStickerPrinting.php @@ -4,6 +4,7 @@ namespace App\Filament\Pages; use App\Models\Item; use App\Models\ClassCharacteristic; +use App\Models\ItemCharacteristic; use App\Models\Machine; use App\Models\Plant; use App\Models\ProductionOrder; @@ -871,6 +872,19 @@ class BulkStickerPrinting extends Page implements HasForms return; } + if($stickerId == 'SelfPriming Monoblock Pump Dual'){ + if ($fromSerNo % 2 == 0 || $toSerNo % 2 != 0) { + + Notification::make() + ->danger() + ->title('Invalid Serial Number') + ->body('For SelfPriming Monoblock Pump Dual, serial numbers must be even.') + ->send(); + + return; + } + } + $pOrderExist = ClassCharacteristic::where('plant_id',$plantId)->where('aufnr', $pOrder)->first(); if(!$pOrderExist){ @@ -932,7 +946,6 @@ class BulkStickerPrinting extends Page implements HasForms return; } - $structure = StickerStructureDetail::where('sticker_id',$stickerId)->first(); if (!$structure) { @@ -1144,6 +1157,29 @@ class BulkStickerPrinting extends Page implements HasForms $pdfContent ); + $written = file_put_contents( + $tempPdfPath, + $pdfContent + ); + + \Log::info('STICKER PDF DEBUG', [ + 'path' => $tempPdfPath, + 'written' => $written, + 'exists' => file_exists($tempPdfPath), + 'size' => file_exists($tempPdfPath) ? filesize($tempPdfPath) : 0, + 'header' => substr($pdfContent, 0, 10), + ]); + + if ($written === false) { + Notification::make() + ->danger() + ->title('PDF Save Failed') + ->body('Unable to save generated PDF.') + ->send(); + + return; + } + $pdfUrl = route( 'sticker.preview', [