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\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';
@@ -23,10 +24,14 @@ class HourlyProduction extends Page
public function mount(): void
{
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,
];
}
}