From 6b89ea5fd9d051fffef383aeeaa9774329a6c2f9 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Mon, 16 Nov 2026 10:47:59 +0530 Subject: [PATCH 1/2] Added print panel 2 logic in create production order --- .../Pages/CreateProductionOrder.php | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/app/Filament/Resources/ProductionOrderResource/Pages/CreateProductionOrder.php b/app/Filament/Resources/ProductionOrderResource/Pages/CreateProductionOrder.php index d3f033da..f78eff41 100644 --- a/app/Filament/Resources/ProductionOrderResource/Pages/CreateProductionOrder.php +++ b/app/Filament/Resources/ProductionOrderResource/Pages/CreateProductionOrder.php @@ -283,6 +283,43 @@ class CreateProductionOrder extends CreateRecord } } + public function printPanel2() + { + $pOrder = trim($this->form->getState()['production_order'] ?? '') ?? null; + + $plantId = trim($this->form->getState()['plant_id'] ?? '') ?? null; + + $plantCode = Plant::where('id', $plantId)->value('code'); + + if (empty($plantId)) { + Notification::make() + ->title('Plant name cannot be empty!') + ->danger() + ->send(); + + return; + } elseif (empty($pOrder)) { + Notification::make() + ->title('Production order cannot be empty!') + ->danger() + ->send(); + return; + } + + $pOrderExists = ProductionOrder::where('plant_id', $plantId)->where('production_order', $pOrder)->first(); + + if (! $pOrderExists) { + Notification::make() + ->title("Production Order '{$pOrder}' does not exist to get print!") + ->danger() + ->send(); + + return; + } else { + return redirect()->route('production-orders.printpanel2', ['production_order' => $pOrder, 'plant_code' => $plantCode]); + } + } + public function exportSerialNo(){ $pOrder = trim($this->form->getState()['production_order'] ?? '') ?? null; From 84626536902122996ee9e2bd69b95ddc3a7f3e63 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Mon, 16 Nov 2026 10:51:54 +0530 Subject: [PATCH 2/2] Added print panel 2 in edit production order --- .../Pages/EditProductionOrder.php | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/app/Filament/Resources/ProductionOrderResource/Pages/EditProductionOrder.php b/app/Filament/Resources/ProductionOrderResource/Pages/EditProductionOrder.php index 8676c913..698be38a 100644 --- a/app/Filament/Resources/ProductionOrderResource/Pages/EditProductionOrder.php +++ b/app/Filament/Resources/ProductionOrderResource/Pages/EditProductionOrder.php @@ -89,6 +89,43 @@ class EditProductionOrder extends EditRecord } + public function printPanel2() + { + $pOrder = trim($this->form->getState()['production_order'] ?? '') ?? null; + + $plantId = trim($this->form->getState()['plant_id'] ?? '') ?? null; + + $plantCode = Plant::where('id', $plantId)->value('code'); + + if (empty($plantId)) { + Notification::make() + ->title('Plant name cannot be empty!') + ->danger() + ->send(); + + return; + } elseif (empty($pOrder)) { + Notification::make() + ->title('Production order cannot be empty!') + ->danger() + ->send(); + return; + } + + $pOrderExists = ProductionOrder::where('plant_id', $plantId)->where('production_order', $pOrder)->first(); + + if (! $pOrderExists) { + Notification::make() + ->title("Production Order '{$pOrder}' does not exist to get print!") + ->danger() + ->send(); + + return; + } else { + return redirect()->route('production-orders.printpanel2', ['production_order' => $pOrder, 'plant_code' => $plantCode]); + } + } + // public function printItemSerial() // { // $pOrder = trim($this->form->getState()['production_order'] ?? '') ?? null;