diff --git a/app/Filament/Resources/ProductionQuantityResource.php b/app/Filament/Resources/ProductionQuantityResource.php index 65a1ae77e..ff35a51dc 100644 --- a/app/Filament/Resources/ProductionQuantityResource.php +++ b/app/Filament/Resources/ProductionQuantityResource.php @@ -33,9 +33,8 @@ class ProductionQuantityResource extends Resource // protected static ?string $navigationParentItem = 'Display Transactions'; protected static ?string $navigationGroup = 'Production'; - public $plant_id; - + // public $plant_id; public static function form(Form $form): Form { return $form @@ -58,8 +57,6 @@ class ProductionQuantityResource extends Resource //... - // $set('plantId', $state); - session(['select_plant' => $state]); session()->forget('select_line'); // Reset line filter @@ -116,7 +113,6 @@ class ProductionQuantityResource extends Resource $latestShiftId = optional(ProductionQuantity::latest()->first())->shift_id; return optional(Shift::where('id', $latestShiftId)->first())->block_id; }) - // ->afterStateUpdated(fn ($set) => $set('shift_id', null)) ->afterStateUpdated(function ($state, callable $set, callable $get) { if($get('id')) { @@ -132,6 +128,9 @@ class ProductionQuantityResource extends Resource $blockId = $get('block_name'); $set('shift_id', null); + session(['select_plant' => $get('plant_id')]); + session()->forget('select_line'); + if (!$blockId) { $set('pqBlockError', 'Please select a block first.'); return; @@ -180,6 +179,9 @@ class ProductionQuantityResource extends Resource $curShiftId = $get('shift_id'); $set('line_id', null); + session(['select_plant' => $get('plant_id')]); + session()->forget('select_line'); + if (!$curShiftId) { $set('pqShiftError', 'Please select a shift first.'); return; @@ -229,8 +231,12 @@ class ProductionQuantityResource extends Resource } $lineId = $get('line_id'); - $set('item_code', null); + + session(['select_plant' => $get('plant_id')]); + session()->forget('select_line'); + session(['select_line' => $state]); + if (!$lineId) { $set('pqLineError', 'Please select a line first.'); return; @@ -259,9 +265,6 @@ class ProductionQuantityResource extends Resource // $set('recent_qr', null); // } } - - //.. - session(['select_line' => $state]); }) // ->extraAttributes([ // 'x-on:change' => "\$wire.dispatch('filtersUpdated')", // Dispatch Livewire event from Alpine.js