1
0
forked from poc/pds

Updated session plant and line and overriding issue solved

This commit is contained in:
dhanabalan
2025-05-12 20:03:52 +05:30
parent fe55962670
commit e198b6e613

View File

@@ -9,8 +9,9 @@ use Filament\Pages\Dashboard\Concerns\HasFiltersForm;
use Filament\Pages\Page; use Filament\Pages\Page;
use Filament\Tables\Concerns\HasFilters; use Filament\Tables\Concerns\HasFilters;
use Illuminate\Support\Facades\Auth; 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'; protected static ?string $navigationIcon = 'heroicon-o-document-text';
@@ -22,11 +23,15 @@ class HourlyProduction extends Page
public function mount(): void 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([ $this->filtersForm->fill([
//'plant' => Plant::first()?->id // Default to first plant //'plant' => Plant::first()?->id // Default to first plant
'plant' => null, 'plant' => $plantId,
'line' => null, 'line' => $lineId,
]); ]);
} }
@@ -43,7 +48,7 @@ class HourlyProduction extends Page
->afterStateUpdated(function ($state) { ->afterStateUpdated(function ($state) {
session(['selected_plant' => $state]); session(['selected_plant' => $state]);
// Clear production quantity Dashboard session keys to avoid conflict // Clear production quantity Dashboard session keys to avoid conflict
session()->forget(['select_plant', 'select_line']); //session()->forget(['select_plant', 'select_line']);
$this->triggerChartUpdate(); $this->triggerChartUpdate();
}), }),
@@ -79,4 +84,11 @@ class HourlyProduction extends Page
{ {
return Auth::check() && Auth::user()->can('view production dashboard'); return Auth::check() && Auth::user()->can('view production dashboard');
} }
public function getWidgets(): array
{
return [
\App\Filament\Widgets\ItemOverview::class,
];
}
} }