Version 2.0
This commit is contained in:
@@ -2,10 +2,12 @@
|
||||
|
||||
namespace App\Filament\Resources\Contracts\Tables;
|
||||
|
||||
use App\Enums\ContractCategory;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class ContractsTable
|
||||
@@ -17,15 +19,25 @@ class ContractsTable
|
||||
TextColumn::make('id')
|
||||
->sortable(),
|
||||
TextColumn::make('product.name')
|
||||
->label(__('app.product'))
|
||||
->searchable()
|
||||
->sortable(),
|
||||
TextColumn::make('customer.name')
|
||||
->label(__('app.widget_customer'))
|
||||
->searchable()
|
||||
->sortable(),
|
||||
TextColumn::make('type')
|
||||
TextColumn::make('category')
|
||||
->label(__('enums.contract_category_label'))
|
||||
->badge()
|
||||
->formatStateUsing(fn (string $state): string => \App\Enums\ContractType::from($state)->label()),
|
||||
->formatStateUsing(fn (string $state): string => ContractCategory::from($state)->label())
|
||||
->color(fn (string $state): string => ContractCategory::from($state)->color()),
|
||||
TextColumn::make('type')
|
||||
->label(__('enums.contract_type_label'))
|
||||
->badge()
|
||||
->formatStateUsing(fn (string $state): string => \App\Enums\ContractType::from($state)->label())
|
||||
->color(fn (string $state): string => \App\Enums\ContractType::from($state)->color()),
|
||||
TextColumn::make('status')
|
||||
->label(__('app.status'))
|
||||
->badge()
|
||||
->color(fn (string $state): string => match ($state) {
|
||||
'active' => 'success',
|
||||
@@ -34,15 +46,22 @@ class ContractsTable
|
||||
default => 'gray',
|
||||
})
|
||||
->formatStateUsing(fn (string $state): string => \App\Enums\ContractStatus::from($state)->label()),
|
||||
TextColumn::make('representative_name')
|
||||
->label(__('app.representative'))
|
||||
->placeholder('-')
|
||||
->toggleable(),
|
||||
TextColumn::make('start_date')
|
||||
->label(__('app.start_date'))
|
||||
->date()
|
||||
->sortable()
|
||||
->toggleable(),
|
||||
TextColumn::make('end_date')
|
||||
->label(__('app.end_date'))
|
||||
->date()
|
||||
->sortable()
|
||||
->toggleable(),
|
||||
TextColumn::make('signed_status')
|
||||
->label(__('app.signed_status'))
|
||||
->toggleable(),
|
||||
TextColumn::make('feedbacks_count')
|
||||
->counts('feedbacks')
|
||||
@@ -53,7 +72,12 @@ class ContractsTable
|
||||
->toggleable(),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
SelectFilter::make('category')
|
||||
->label(__('enums.contract_category_label'))
|
||||
->options(ContractCategory::options()),
|
||||
SelectFilter::make('status')
|
||||
->label(__('app.status'))
|
||||
->options(\App\Enums\ContractStatus::ACTIVE->options()),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
|
||||
Reference in New Issue
Block a user