You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
topnotch_website/app/Filament/Resources/InvoiceReportResource.php

83 lines
2.2 KiB
PHP

<?php
namespace App\Filament\Resources;
use App\Filament\Resources\InvoiceReportResource\Pages;
use App\Models\Order;
use Filament\Forms\Components\DatePicker;
use Filament\Forms\Components\Toggle;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Actions\Action;
use Filament\Tables\Table;
class InvoiceReportResource extends Resource
{
protected static ?string $model = Order::class;
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
protected static ?string $navigationGroup = 'Reports';
protected static ?string $navigationLabel = 'Invoice Reports';
protected static ?int $navigationSort = 2;
public static function form(Form $form): Form
{
return $form
->schema([
//
]);
}
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('company_name')
->searchable(),
])
->filters([
Tables\Filters\Filter::make('date_from')
->form([
DatePicker::make('date_from'),
]),
Tables\Filters\Filter::make('date_until')
->form([
DatePicker::make('date_from'),
]),
Tables\Filters\Filter::make('paid')
->form([
Toggle::make('paid'),
]),
], layout: Tables\Enums\FiltersLayout::AboveContent)
->actions([
Action::make('generateReport')
->label('Make Report')
->icon('lucide-sticky-note'),
]);
}
public static function getEloquentQuery(): \Illuminate\Database\Eloquent\Builder
{
return Order::query()
->has('invoice');
}
public static function getRelations(): array
{
return [
//
];
}
public static function getPages(): array
{
return [
'index' => Pages\ListInvoiceReports::route('/'),
];
}
}