- PermissionSeeder: 29 permissions with role mapping (admin/manager/staff) - Policies updated to use hasPermissionTo() instead of hasRole() - ExportBackup command: JSON per-table backup with chunk processing - UserResource: CRUD users with role assignment (admin only) - RoleResource: CRUD roles with permission assignment (admin only) - UserPolicy + RolePolicy: admin-only access control - ImportCskh: detailed skip logging with color in dry-run mode - Widgets: permission-based visibility checks - Tests: 8/8 pass (21 assertions)
125 lines
4.2 KiB
PHP
125 lines
4.2 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\Feedback\Tables;
|
|
|
|
use Filament\Actions\BulkActionGroup;
|
|
use Filament\Actions\DeleteBulkAction;
|
|
use Filament\Actions\EditAction;
|
|
use Filament\Tables\Columns\IconColumn;
|
|
use Filament\Tables\Columns\TextColumn;
|
|
use Filament\Tables\Filters\SelectFilter;
|
|
use Filament\Tables\Table;
|
|
|
|
class FeedbackTable
|
|
{
|
|
public static function configure(Table $table): Table
|
|
{
|
|
return $table
|
|
->columns([
|
|
TextColumn::make('id')
|
|
->label('#')
|
|
->sortable()
|
|
->weight('bold')
|
|
->color('primary'),
|
|
|
|
TextColumn::make('title')
|
|
->searchable()
|
|
->sortable()
|
|
->weight('semibold')
|
|
->limit(40),
|
|
|
|
TextColumn::make('customer.name')
|
|
->searchable()
|
|
->sortable(),
|
|
|
|
TextColumn::make('customerProduct.product.name')
|
|
->label('Product')
|
|
->placeholder('General')
|
|
->sortable()
|
|
->toggleable(),
|
|
|
|
TextColumn::make('contract.type')
|
|
->label('Contract')
|
|
->badge()
|
|
->formatStateUsing(fn (?string $state): string => $state ? \App\Enums\ContractType::from($state)->label() : '-')
|
|
->color(fn (?string $state): string => match ($state) {
|
|
'sale' => 'success',
|
|
'lease' => 'info',
|
|
'bcc' => 'warning',
|
|
default => 'gray',
|
|
})
|
|
->placeholder('-')
|
|
->toggleable(),
|
|
|
|
TextColumn::make('feedbackChannel.name')
|
|
->label('Channel')
|
|
->badge()
|
|
->color('gray'),
|
|
|
|
TextColumn::make('tags.name')
|
|
->badge()
|
|
->separator(',')
|
|
->toggleable(),
|
|
|
|
TextColumn::make('status')
|
|
->badge()
|
|
->color(fn(string $state): string => match ($state) {
|
|
'pending' => 'warning',
|
|
'processing' => 'info',
|
|
'resolved' => 'success',
|
|
'closed' => 'gray',
|
|
default => 'gray',
|
|
}),
|
|
|
|
TextColumn::make('currentDepartment.name')
|
|
->label('Department')
|
|
->badge()
|
|
->color('info')
|
|
->toggleable(),
|
|
|
|
TextColumn::make('assignedTo.name')
|
|
->label('Assigned To')
|
|
->toggleable(),
|
|
|
|
IconColumn::make('is_escalated')
|
|
->label('Escalated')
|
|
->boolean()
|
|
->toggleable(),
|
|
|
|
TextColumn::make('created_at')
|
|
->label('Created')
|
|
->since()
|
|
->sortable()
|
|
->toggleable()
|
|
->color('secondary'),
|
|
])
|
|
->filters([
|
|
SelectFilter::make('status')
|
|
->options([
|
|
'pending' => 'Pending',
|
|
'processing' => 'Processing',
|
|
'resolved' => 'Resolved',
|
|
'closed' => 'Closed',
|
|
]),
|
|
SelectFilter::make('feedback_channel_id')
|
|
->relationship('feedbackChannel', 'name')
|
|
->label('Channel'),
|
|
SelectFilter::make('current_department_id')
|
|
->relationship('currentDepartment', 'name')
|
|
->label('Department'),
|
|
SelectFilter::make('assigned_to')
|
|
->relationship('assignedTo', 'name')
|
|
->label('Assigned To'),
|
|
])
|
|
->recordActions([
|
|
EditAction::make(),
|
|
])
|
|
->toolbarActions([
|
|
BulkActionGroup::make([
|
|
DeleteBulkAction::make(),
|
|
]),
|
|
])
|
|
->defaultSort('created_at', 'desc');
|
|
}
|
|
}
|