base commit
This commit is contained in:
commit
a794dacd39
345 files changed
+29597
No files matched your search
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Filament\Widgets;
|
||||
|
||||
use App\Enums\DisciplinarySeverity;
|
||||
use App\Models\DisciplinaryReport;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
use Filament\Widgets\TableWidget;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class RecentReportsWidget extends TableWidget
|
||||
{
|
||||
protected static ?string $heading = 'Recent Disciplinary Reports';
|
||||
|
||||
protected int | string | array $columnSpan = 'full';
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->query(
|
||||
DisciplinaryReport::query()
|
||||
->with(['employee', 'creator'])
|
||||
->latest('report_date')
|
||||
->limit(5),
|
||||
)
|
||||
->columns([
|
||||
TextColumn::make('employee.full_name')
|
||||
->label('Employee'),
|
||||
TextColumn::make('report_date')
|
||||
->date(),
|
||||
TextColumn::make('title')
|
||||
->limit(40),
|
||||
TextColumn::make('severity')
|
||||
->badge()
|
||||
->color(fn (DisciplinarySeverity $state): string => $state->color())
|
||||
->formatStateUsing(fn (DisciplinarySeverity $state): string => $state->label()),
|
||||
TextColumn::make('creator.name')
|
||||
->label('Created By'),
|
||||
])
|
||||
->paginated(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Builder<DisciplinaryReport>|null
|
||||
*/
|
||||
protected function getTableQuery(): ?Builder
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user