Merge pull request 'Added genearte button in production target page' (#1171) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 21s

Reviewed-on: #1171
This commit was merged in pull request #1171.
This commit is contained in:
2026-10-05 05:23:48 +00:00
2 changed files with 24 additions and 9 deletions

View File

@@ -137,16 +137,16 @@ class ProductionTarget extends Page
->pluck('name', 'id') ->pluck('name', 'id')
->toArray(); ->toArray();
}) })
->reactive() ->reactive(),
->afterStateUpdated(function ($state, callable $get, $set) { // ->afterStateUpdated(function ($state, callable $get, $set) {
$plantId = $get('plant_id'); // $plantId = $get('plant_id');
$lineId = $state; // $lineId = $state;
// $month = $get('month'); // // $month = $get('month');
$year = $get('year'); // $year = $get('year');
$month = (int) $get('month'); // $month = (int) $get('month');
$this->dispatch('loadData',$year, $month, $plantId, $lineId, ''); // $this->dispatch('loadData',$year, $month, $plantId, $lineId, '');
}), // }),
TextInput::make('category') TextInput::make('category')
->label('Category') ->label('Category')
@@ -212,6 +212,14 @@ class ProductionTarget extends Page
// $this->dispatch('loadDataMonthly' ,$plantId, $lineId, $year, $month); // $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 public static function canAccess(): bool
{ {
return Auth::check() && Auth::user()->can('view production target page'); return Auth::check() && Auth::user()->can('view production target page');

View File

@@ -12,6 +12,13 @@
> >
Export Export
</x-filament::button> </x-filament::button>
<x-filament::button
wire:click="generate"
color="primary"
class="mt-4"
>
Generate
</x-filament::button>
<div class="bg-white shadow rounded-xl p-4 mt-6"> <div class="bg-white shadow rounded-xl p-4 mt-6">
<livewire:production-target-plan /> <livewire:production-target-plan />
</div> </div>