Added genearte button in production target page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 14s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 18s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 13s
Laravel Pint / pint (pull_request) Successful in 3m11s
Laravel Larastan / larastan (pull_request) Failing after 4m19s

This commit is contained in:
dhanabalan
2026-10-05 10:53:33 +05:30
parent 1aa6d3bb28
commit 2fcb8699a0
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>