i18n(users): wrap role Select options with I18n::opts + 2FA status + Locale
- Both role selects (primary + additional roles multi) passed the raw
roleLabels() array without translation; wrap with I18n::opts() so
Proprietar/Administrator/… now render translated in RU/EN.
- 2FA status text ('✓ Activat (TOTP)' / '✗ Dezactivat') split so
the checkmark stays and label runs through __().
- +3 translations (Activat (TOTP), Dezactivat, Locale) — Locale is
Filament's auto-generated headline from the `locale` field.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -79,7 +79,7 @@ class UserResource extends Resource
|
||||
->schema([
|
||||
Forms\Components\Select::make('role')
|
||||
->label(__('Rol primar'))
|
||||
->options(\App\Auth\Permissions::roleLabels())
|
||||
->options(\App\Support\I18n::opts(\App\Auth\Permissions::roleLabels()))
|
||||
->required()
|
||||
->default('mechanic')
|
||||
->helperText(__('Rolul principal — sincronizat automat cu drepturile RBAC.')),
|
||||
@@ -98,7 +98,7 @@ class UserResource extends Resource
|
||||
Forms\Components\Select::make('roles_picked')
|
||||
->label(__('Roluri suplimentare'))
|
||||
->multiple()
|
||||
->options(\App\Auth\Permissions::roleLabels())
|
||||
->options(\App\Support\I18n::opts(\App\Auth\Permissions::roleLabels()))
|
||||
->afterStateHydrated(function ($component, $record) {
|
||||
if ($record) $component->state($record->roles->pluck('name')->all());
|
||||
})
|
||||
@@ -130,7 +130,7 @@ class UserResource extends Resource
|
||||
->schema([
|
||||
Forms\Components\Placeholder::make('mfa_status')
|
||||
->label(__('Autentificare 2FA'))
|
||||
->content(fn ($record) => $record && $record->hasTwoFactorEnabled() ? '✓ Activat (TOTP)' : '✗ Dezactivat'),
|
||||
->content(fn ($record) => $record && $record->hasTwoFactorEnabled() ? '✓ ' . __('Activat (TOTP)') : '✗ ' . __('Dezactivat')),
|
||||
Forms\Components\Placeholder::make('last_login')
|
||||
->label(__('Ultima autentificare'))
|
||||
->content(fn ($record) => $record?->last_login_at?->diffForHumans() ?? '—'),
|
||||
|
||||
@@ -65,6 +65,7 @@
|
||||
"Actions": "Actions",
|
||||
"Activ": "Active",
|
||||
"Activare": "Activation",
|
||||
"Activat (TOTP)": "Enabled (TOTP)",
|
||||
"Active": "Assets",
|
||||
"Active acum": "Active now",
|
||||
"Activează": "Activate",
|
||||
@@ -618,6 +619,7 @@
|
||||
"Detalii comandă": "Order details",
|
||||
"Deviz": "Estimate",
|
||||
"Dezactivare": "Deactivation",
|
||||
"Dezactivat": "Disabled",
|
||||
"Dezactivează": "Deactivate",
|
||||
"Dezactivează 2FA pentru acest utilizator. Va trebui să re-configureze TOTP la următoarea autentificare.": "Disables 2FA for this user. They will need to re-set up TOTP on the next login.",
|
||||
"Diagnosis": "Diagnosis",
|
||||
@@ -965,6 +967,7 @@
|
||||
"Loading": "Loading...",
|
||||
"Loc.": "Loc.",
|
||||
"Local": "Local",
|
||||
"Locale": "Locale",
|
||||
"Localizare & monedă": "Localization & currency",
|
||||
"Location": "Location",
|
||||
"Locație": "Location",
|
||||
|
||||
@@ -65,6 +65,7 @@
|
||||
"Actions": "Действия",
|
||||
"Activ": "Активный",
|
||||
"Activare": "Активация",
|
||||
"Activat (TOTP)": "Активирован (TOTP)",
|
||||
"Active": "Активы",
|
||||
"Active acum": "В работе сейчас",
|
||||
"Activează": "Активировать",
|
||||
@@ -618,6 +619,7 @@
|
||||
"Detalii comandă": "Данные заказа",
|
||||
"Deviz": "Смета",
|
||||
"Dezactivare": "Деактивация",
|
||||
"Dezactivat": "Отключено",
|
||||
"Dezactivează": "Деактивировать",
|
||||
"Dezactivează 2FA pentru acest utilizator. Va trebui să re-configureze TOTP la următoarea autentificare.": "Отключает 2FA для этого пользователя. Ему потребуется заново настроить TOTP при следующем входе.",
|
||||
"Diagnosis": "Диагноз",
|
||||
@@ -965,6 +967,7 @@
|
||||
"Loading": "Загрузка...",
|
||||
"Loc.": "Loc.",
|
||||
"Local": "Локально",
|
||||
"Locale": "Локаль",
|
||||
"Localizare & monedă": "Локализация и валюта",
|
||||
"Location": "Локация",
|
||||
"Locație": "Локация",
|
||||
|
||||
Reference in New Issue
Block a user