From e198b6e6138ebcffb8249c5f22dc8f0d800430c4 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Mon, 12 May 2025 20:03:52 +0530 Subject: [PATCH] Updated session plant and line and overriding issue solved --- app/Filament/Pages/HourlyProduction.php | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/app/Filament/Pages/HourlyProduction.php b/app/Filament/Pages/HourlyProduction.php index b49105552..462cb27d8 100644 --- a/app/Filament/Pages/HourlyProduction.php +++ b/app/Filament/Pages/HourlyProduction.php @@ -9,8 +9,9 @@ use Filament\Pages\Dashboard\Concerns\HasFiltersForm; use Filament\Pages\Page; use Filament\Tables\Concerns\HasFilters; use Illuminate\Support\Facades\Auth; +use Filament\Pages\Dashboard; -class HourlyProduction extends Page +class HourlyProduction extends page { protected static ?string $navigationIcon = 'heroicon-o-document-text'; @@ -22,11 +23,15 @@ class HourlyProduction extends Page public function mount(): void { - session()->forget(['selected_plant', 'selected_line']); + session()->forget(['selected_plant', 'selected_line']); + session()->forget(['select_plant', 'select_line']); + $plantId = session('selected_plant', null); // Default to the first plant if not selected + $lineId = session('selected_line', null); + $this->filtersForm->fill([ //'plant' => Plant::first()?->id // Default to first plant - 'plant' => null, - 'line' => null, + 'plant' => $plantId, + 'line' => $lineId, ]); } @@ -43,7 +48,7 @@ class HourlyProduction extends Page ->afterStateUpdated(function ($state) { session(['selected_plant' => $state]); // Clear production quantity Dashboard session keys to avoid conflict - session()->forget(['select_plant', 'select_line']); + //session()->forget(['select_plant', 'select_line']); $this->triggerChartUpdate(); }), @@ -79,4 +84,11 @@ class HourlyProduction extends Page { return Auth::check() && Auth::user()->can('view production dashboard'); } + + public function getWidgets(): array + { + return [ + \App\Filament\Widgets\ItemOverview::class, + ]; + } }