From 9602be624df37df1a7c04da6ee40317ad847d0c4 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Mon, 16 Feb 2026 12:29:02 +0530 Subject: [PATCH] Changed logic in production quantity page --- app/Filament/Pages/ProductionQuantityPage.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/app/Filament/Pages/ProductionQuantityPage.php b/app/Filament/Pages/ProductionQuantityPage.php index 216d1e8..a4899f6 100644 --- a/app/Filament/Pages/ProductionQuantityPage.php +++ b/app/Filament/Pages/ProductionQuantityPage.php @@ -8,6 +8,7 @@ use App\Models\Machine; use App\Models\Plant; use App\Models\ProductionQuantity; use App\Models\Shift; +use App\Models\Block; use Carbon\Carbon; use Filament\Facades\Filament; use Filament\Forms\Components\Hidden; @@ -1296,6 +1297,8 @@ class ProductionQuantityPage extends Page implements HasForms $machine = Machine::where('work_center', $this->mId)->where('plant_id', $this->pId)->first(); + $workCenter = $this->mId; + if (!$machine) { Notification::make() ->title('Unknown Machine') @@ -1350,13 +1353,21 @@ class ProductionQuantityPage extends Page implements HasForms $this->iId = null; + // Get line + block in one shot + $line = Line::with('block')->find($lineId); + + $lineName = $line?->name; + $blockName = $line?->block?->name; + $shiftName = $shift?->name; + // after success insertion $this->form->fill([ 'plant_id'=> $this->pId, - 'block_name'=> $this->bId, - 'shift_id'=> $this->sId, - 'line_id'=> $this->lId, + 'machine_id'=> $workCenter, + 'block_name'=> $blockName, + 'shift_id'=> $shiftName, + 'line_id'=> $lineName, 'item_id'=> null, //'item_code'=> null, 'serial_number'=> null,