Files
minicrm/app/Filament/Resources/Customers/RelationManagers/FeedbacksRelationManager.php
phuongtc 8c6b71cb8a
Some checks failed
Tests / PHP 8.3 (push) Has been cancelled
Tests / PHP 8.4 (push) Has been cancelled
Tests / PHP 8.5 (push) Has been cancelled
feat: add i18n support for Vietnamese and English
2026-05-04 10:40:39 +00:00

64 lines
2.4 KiB
PHP

<?php
namespace App\Filament\Resources\Customers\RelationManagers;
use App\Filament\Resources\Feedback\FeedbackResource;
use Filament\Resources\RelationManagers\RelationManager;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Filters\SelectFilter;
use Filament\Tables\Table;
class FeedbacksRelationManager extends RelationManager
{
protected static string $relationship = 'feedbacks';
protected static ?string $title = 'app.feedback_history';
public function table(Table $table): Table
{
return $table
->recordTitleAttribute('title')
->columns([
TextColumn::make('title')
->searchable()
->url(fn ($record) => FeedbackResource::getUrl('edit', ['record' => $record])),
TextColumn::make('customerProduct.product.name')
->label(__('app.product'))
->placeholder(__('app.general')),
TextColumn::make('status')
->badge()
->color(fn (string $state): string => match ($state) {
'pending' => 'warning',
'processing' => 'info',
'resolved' => 'success',
'closed' => 'gray',
default => 'gray',
}),
TextColumn::make('tags.name')
->badge(),
TextColumn::make('feedbackChannel.name')
->label(__('app.channel')),
TextColumn::make('interactions_count')
->counts('interactions')
->label(__('app.interactions')),
TextColumn::make('created_at')
->dateTime('d/m/Y')
->sortable(),
])
->filters([
SelectFilter::make('status')
->options([
'pending' => __('app.status_pending'),
'processing' => __('app.status_processing'),
'resolved' => __('app.status_resolved'),
'closed' => __('app.status_closed'),
]),
SelectFilter::make('tags')
->relationship('tags', 'name'),
])
->defaultSort('created_at', 'desc')
->headerActions([])
->recordActions([]);
}
}