Added chart for invoice quantity

This commit is contained in:
dhanabalan
2025-06-29 16:17:44 +05:30
parent cc48e4ae3d
commit ced01440f5
2 changed files with 394 additions and 0 deletions

View File

@@ -0,0 +1,70 @@
<?php
namespace App\Filament\Pages;
use App\Models\Plant;
use Filament\Pages\Page;
use Filament\Pages\Dashboard\Concerns\HasFiltersForm;
use Filament\Forms\Form;
use Filament\Forms\Components\Select;
use Illuminate\Support\Facades\Auth;
class InvoiceQuantityDashboard extends Page
{
use HasFiltersForm;
protected static ?string $navigationIcon = 'heroicon-o-document-text';
protected static ?string $navigationGroup = 'Invoice DashBoard';
protected static string $view = 'filament.pages.invoice-quantity-dashboard';
public function mount(): void
{
session()->forget(['selec_plant', 'select_invoice']);
$this->filtersForm->fill([
'plant' => null,
'invoice' => null,
]);
}
public function filtersForm(Form $form): Form
{
return $form
->statePath('filters') // Explicitly set where to store form data
->schema([
Select::make('plant')
->options(Plant::pluck('name', 'id'))
->label('Select Plant')
->reactive()
->afterStateUpdated(function ($state) {
session(['selec_plant' => $state]);
$this->dispatch('invoiceChart');
}),
Select::make('invoice')
->options([
'serial_invoice' => 'Serial Invoice',
'individual_material' => 'Individual Material Invoice',
'bundle_material' => 'Bundle Material Invoice',
])
->label('Select Invoice')
->reactive()
->default(0)
->afterStateUpdated(function ($state) {
session(['select_invoice' => $state]);
$this->dispatch('invoiceChart');
})
])
->columns(2);
}
public static function getNavigationLabel(): string
{
return 'Invoice Quantity';
}
public static function canAccess(): bool
{
return Auth::check() && Auth::user()->can('view invoice serial quantity dashboard');
}
}