From 2fcb8699a080c4a3597ea3b0bc9c1ddf21d6deb8 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Mon, 5 Oct 2026 10:53:33 +0530 Subject: [PATCH] Added genearte button in production target page --- app/Filament/Pages/ProductionTarget.php | 26 ++++++++++++------- .../pages/production-target.blade.php | 7 +++++ 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/app/Filament/Pages/ProductionTarget.php b/app/Filament/Pages/ProductionTarget.php index 9e84523b..881730a9 100644 --- a/app/Filament/Pages/ProductionTarget.php +++ b/app/Filament/Pages/ProductionTarget.php @@ -137,16 +137,16 @@ class ProductionTarget extends Page ->pluck('name', 'id') ->toArray(); }) - ->reactive() - ->afterStateUpdated(function ($state, callable $get, $set) { - $plantId = $get('plant_id'); - $lineId = $state; - // $month = $get('month'); - $year = $get('year'); + ->reactive(), + // ->afterStateUpdated(function ($state, callable $get, $set) { + // $plantId = $get('plant_id'); + // $lineId = $state; + // // $month = $get('month'); + // $year = $get('year'); - $month = (int) $get('month'); - $this->dispatch('loadData',$year, $month, $plantId, $lineId, ''); - }), + // $month = (int) $get('month'); + // $this->dispatch('loadData',$year, $month, $plantId, $lineId, ''); + // }), TextInput::make('category') ->label('Category') @@ -212,6 +212,14 @@ class ProductionTarget extends Page // $this->dispatch('loadDataMonthly' ,$plantId, $lineId, $year, $month); } + public function generate(){ + $plantId = $this->filters['plant_id'] ?? null; + $lineId = $this->filters['line_id'] ?? null; + $year = $this->filters['year'] ?? null; + $month = (int) $this->filters['month'] ?? null; + $this->dispatch('loadData',$year, $month, $plantId, $lineId, ''); + } + public static function canAccess(): bool { return Auth::check() && Auth::user()->can('view production target page'); diff --git a/resources/views/filament/pages/production-target.blade.php b/resources/views/filament/pages/production-target.blade.php index 242dbbbb..fed44e30 100644 --- a/resources/views/filament/pages/production-target.blade.php +++ b/resources/views/filament/pages/production-target.blade.php @@ -12,6 +12,13 @@ > Export + + Generate +