- 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
63 lines
2.5 KiB
PHP
63 lines
2.5 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\Wallets\RelationManagers;
|
|
|
|
use App\Enums\WalletTransactionType;
|
|
use Filament\Resources\RelationManagers\RelationManager;
|
|
use Filament\Tables\Columns\TextColumn;
|
|
use Filament\Tables\Filters\SelectFilter;
|
|
use Filament\Tables\Table;
|
|
|
|
class TransactionsRelationManager extends RelationManager
|
|
{
|
|
protected static string $relationship = 'transactions';
|
|
|
|
protected static ?string $title = 'تراکنشها';
|
|
|
|
protected static ?string $modelLabel = 'تراکنش';
|
|
|
|
protected static ?string $pluralModelLabel = 'تراکنشها';
|
|
|
|
public function table(Table $table): Table
|
|
{
|
|
return $table
|
|
->columns([
|
|
TextColumn::make('type')
|
|
->label('نوع')
|
|
->badge()
|
|
->formatStateUsing(fn (WalletTransactionType $state): string => $state->label())
|
|
->color(fn (WalletTransactionType $state): string => $state === WalletTransactionType::Credit ? 'success' : 'danger'),
|
|
TextColumn::make('amount')
|
|
->label('مبلغ')
|
|
->formatStateUsing(fn (int $state): string => number_format($state).' تومان'),
|
|
TextColumn::make('balance_before')
|
|
->label('قبل')
|
|
->formatStateUsing(fn (int $state): string => number_format($state)),
|
|
TextColumn::make('balance_after')
|
|
->label('بعد')
|
|
->formatStateUsing(fn (int $state): string => number_format($state)),
|
|
TextColumn::make('description')
|
|
->label('توضیحات')
|
|
->limit(40),
|
|
TextColumn::make('creator.name')
|
|
->label('ثبتکننده')
|
|
->placeholder('سیستم'),
|
|
TextColumn::make('created_at')
|
|
->label('تاریخ')
|
|
->jalaliDateTime()
|
|
->sortable(),
|
|
])
|
|
->defaultSort('created_at', 'desc')
|
|
->filters([
|
|
SelectFilter::make('type')
|
|
->label('نوع')
|
|
->options([
|
|
WalletTransactionType::Credit->value => WalletTransactionType::Credit->label(),
|
|
WalletTransactionType::Debit->value => WalletTransactionType::Debit->label(),
|
|
]),
|
|
])
|
|
->recordActions([])
|
|
->toolbarActions([]);
|
|
}
|
|
}
|