- lang/fa: add validation/auth/passwords/pagination translations so admin and API validation errors are in Persian - templates: soft-delete instead of cascade-deleting their generations; keep resolving trashed template on generations (labels/downloads) - templates: add TemplateInfolist with a real thumbnail ImageEntry - generations: auto-name template-based generations and use that name for the download file and as a searchable column - admin: show all dates as Jalali via ->jalaliDate()/->jalaliDateTime() Filament macros (App\Support\Jalali) - wallets: harden the deposit/withdraw action to surface the exact error instead of a 500 - profile: normalize Iranian mobile numbers (App\Support\Mobile), add social_links, coerce notification-preference booleans, require the current password to delete an account Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013P66ea1dC5CVM9t29496t5
70 lines
2.5 KiB
PHP
70 lines
2.5 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\Notifications\Tables;
|
|
|
|
use App\Enums\NotificationType;
|
|
use Filament\Actions\BulkActionGroup;
|
|
use Filament\Actions\DeleteBulkAction;
|
|
use Filament\Actions\EditAction;
|
|
use Filament\Actions\ViewAction;
|
|
use Filament\Tables\Columns\IconColumn;
|
|
use Filament\Tables\Columns\TextColumn;
|
|
use Filament\Tables\Filters\SelectFilter;
|
|
use Filament\Tables\Filters\TernaryFilter;
|
|
use Filament\Tables\Table;
|
|
|
|
class NotificationsTable
|
|
{
|
|
public static function configure(Table $table): Table
|
|
{
|
|
return $table
|
|
->columns([
|
|
TextColumn::make('user.name')
|
|
->label('کاربر')
|
|
->searchable()
|
|
->sortable(),
|
|
TextColumn::make('type')
|
|
->label('نوع')
|
|
->badge()
|
|
->formatStateUsing(fn (NotificationType $state): string => $state->label()),
|
|
TextColumn::make('title')
|
|
->label('عنوان')
|
|
->searchable()
|
|
->limit(40),
|
|
IconColumn::make('read_at')
|
|
->label('خوانده شده')
|
|
->boolean()
|
|
->getStateUsing(fn ($record): bool => $record->read_at !== null),
|
|
TextColumn::make('created_at')
|
|
->label('تاریخ ایجاد')
|
|
->jalaliDateTime()
|
|
->sortable()
|
|
->toggleable(isToggledHiddenByDefault: true),
|
|
])
|
|
->defaultSort('created_at', 'desc')
|
|
->filters([
|
|
SelectFilter::make('type')
|
|
->label('نوع')
|
|
->options(collect(NotificationType::cases())->mapWithKeys(fn (NotificationType $type) => [$type->value => $type->label()])),
|
|
TernaryFilter::make('read_at')
|
|
->label('وضعیت')
|
|
->placeholder('همه')
|
|
->trueLabel('خوانده شده')
|
|
->falseLabel('خوانده نشده')
|
|
->queries(
|
|
true: fn ($query) => $query->whereNotNull('read_at'),
|
|
false: fn ($query) => $query->whereNull('read_at'),
|
|
),
|
|
])
|
|
->recordActions([
|
|
ViewAction::make(),
|
|
EditAction::make(),
|
|
])
|
|
->toolbarActions([
|
|
BulkActionGroup::make([
|
|
DeleteBulkAction::make(),
|
|
]),
|
|
]);
|
|
}
|
|
}
|