feat: Persian panel/API fixes and structural-model tweaks

- 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
This commit is contained in:
2026-09-07 01:00:09 +03:30
parent 46ae711a20
commit 936f789ac8
38 changed files with 756 additions and 39 deletions

View File

@@ -17,6 +17,9 @@ use App\Policies\UserPolicy;
use App\Policies\WalletPolicy;
use App\Policies\WalletTransactionPolicy;
use App\Services\Payments\FakePaymentGateway;
use App\Support\Jalali;
use Filament\Infolists\Components\TextEntry;
use Filament\Tables\Columns\TextColumn;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Facades\URL;
use Illuminate\Support\ServiceProvider;
@@ -41,6 +44,8 @@ class AppServiceProvider extends ServiceProvider
URL::forceScheme('https');
}
$this->registerJalaliMacros();
User::observe(UserObserver::class);
Gate::policy(User::class, UserPolicy::class);
@@ -50,4 +55,31 @@ class AppServiceProvider extends ServiceProvider
Gate::policy(WalletTransaction::class, WalletTransactionPolicy::class);
Gate::policy(Notification::class, NotificationPolicy::class);
}
/**
* Adds ->jalaliDate() / ->jalaliDateTime() helpers to Filament table columns and
* infolist entries so every date shown in the admin panel is Shamsi.
*/
private function registerJalaliMacros(): void
{
TextColumn::macro('jalaliDate', function () {
/** @var TextColumn $this */
return $this->formatStateUsing(fn ($state): ?string => Jalali::date($state));
});
TextColumn::macro('jalaliDateTime', function () {
/** @var TextColumn $this */
return $this->formatStateUsing(fn ($state): ?string => Jalali::dateTime($state));
});
TextEntry::macro('jalaliDate', function () {
/** @var TextEntry $this */
return $this->formatStateUsing(fn ($state): ?string => Jalali::date($state));
});
TextEntry::macro('jalaliDateTime', function () {
/** @var TextEntry $this */
return $this->formatStateUsing(fn ($state): ?string => Jalali::dateTime($state));
});
}
}