feat(i18n): wrap 1103 hardcoded UI strings across Filament with __()
- Convert static $modelLabel/$pluralModelLabel/$title to getter methods - Wrap ->label()/->placeholder()/->helperText()/->description()/->title()/->body() args - Wrap Section::make()/Fieldset::make()/Notification::make()->title() args - Fix RelationManagers::getTitle() signature to match parent (Model, string) - Fix Pages::getTitle() to instance method (BasePage::getTitle is non-static) - Extend lang/ru.json + lang/en.json with 700+ common terms; identity fallback for the rest - Remove duplicate getters in 5 resources that had manual getModelLabel already All 306 tests pass. Missing translations fall back to the RO key so the UI never breaks. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -19,7 +19,12 @@ class PaymentSettings extends Page
|
||||
return __('nav.label.Setări plăți');
|
||||
}
|
||||
|
||||
protected static ?string $title = 'Integrări de plată';
|
||||
protected static ?string $title = null;
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return __('Integrări de plată');
|
||||
}
|
||||
|
||||
protected static ?int $navigationSort = 90;
|
||||
|
||||
@@ -84,132 +89,132 @@ class PaymentSettings extends Page
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
Schemas\Components\Section::make('General')
|
||||
Schemas\Components\Section::make(__('General'))
|
||||
->columns(3)
|
||||
->schema([
|
||||
Forms\Components\Select::make('platform_currency')
|
||||
->label('Monedă platformă')
|
||||
->label(__('Monedă platformă'))
|
||||
->options(['MDL' => 'MDL', 'EUR' => 'EUR', 'USD' => 'USD'])
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('invoice_prefix')
|
||||
->label('Prefix facturi')->maxLength(10)->default('INV'),
|
||||
->label(__('Prefix facturi'))->maxLength(10)->default('INV'),
|
||||
Forms\Components\Textarea::make('terms')
|
||||
->label('Termeni de plată')->rows(2)->columnSpanFull(),
|
||||
->label(__('Termeni de plată'))->rows(2)->columnSpanFull(),
|
||||
]),
|
||||
Schemas\Components\Section::make('Date legale (apar pe facturi)')
|
||||
Schemas\Components\Section::make(__('Date legale (apar pe facturi)'))
|
||||
->columns(2)
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('legal_name')->label('Denumire companie')->maxLength(160),
|
||||
Forms\Components\TextInput::make('legal_idno')->label('IDNO / CUI')->maxLength(40),
|
||||
Forms\Components\TextInput::make('legal_address')->label('Adresă')->columnSpanFull()->maxLength(255),
|
||||
Forms\Components\TextInput::make('legal_phone')->label('Telefon')->tel()->maxLength(40),
|
||||
Forms\Components\TextInput::make('legal_email')->label('Email')->email()->maxLength(120),
|
||||
Forms\Components\TextInput::make('legal_name')->label(__('Denumire companie'))->maxLength(160),
|
||||
Forms\Components\TextInput::make('legal_idno')->label(__('IDNO / CUI'))->maxLength(40),
|
||||
Forms\Components\TextInput::make('legal_address')->label(__('Adresă'))->columnSpanFull()->maxLength(255),
|
||||
Forms\Components\TextInput::make('legal_phone')->label(__('Telefon'))->tel()->maxLength(40),
|
||||
Forms\Components\TextInput::make('legal_email')->label(__('Email'))->email()->maxLength(120),
|
||||
]),
|
||||
Schemas\Components\Section::make('💳 Stripe')
|
||||
->description('Procesare carduri online. Funcționează în 30+ țări. Comision ~2.9% + 0.30€/tranzacție.')
|
||||
Schemas\Components\Section::make(__('💳 Stripe'))
|
||||
->description(__('Procesare carduri online. Funcționează în 30+ țări. Comision ~2.9% + 0.30€/tranzacție.'))
|
||||
->columns(3)
|
||||
->collapsible()
|
||||
->collapsed(fn (Get $get) => ! $get('stripe_enabled'))
|
||||
->schema([
|
||||
Forms\Components\Toggle::make('stripe_enabled')->label('Activează Stripe')->default(false)->live(),
|
||||
Forms\Components\Toggle::make('stripe_enabled')->label(__('Activează Stripe'))->default(false)->live(),
|
||||
Forms\Components\Select::make('stripe_mode')
|
||||
->label('Mod')
|
||||
->label(__('Mod'))
|
||||
->options(['test' => '🧪 Test', 'live' => '🟢 Live'])
|
||||
->default('test')
|
||||
->required(fn (Get $get) => $get('stripe_enabled'))
|
||||
->visible(fn (Get $get) => $get('stripe_enabled')),
|
||||
Forms\Components\TextInput::make('stripe_publishable')
|
||||
->label('Publishable key')->placeholder('pk_test_...')
|
||||
->label(__('Publishable key'))->placeholder('pk_test_...')
|
||||
->visible(fn (Get $get) => $get('stripe_enabled')),
|
||||
Forms\Components\TextInput::make('stripe_secret')
|
||||
->label('Secret key')->password()->revealable()->placeholder('sk_test_...')
|
||||
->label(__('Secret key'))->password()->revealable()->placeholder('sk_test_...')
|
||||
->visible(fn (Get $get) => $get('stripe_enabled')),
|
||||
Forms\Components\TextInput::make('stripe_webhook')
|
||||
->label('Webhook secret')->password()->revealable()->placeholder('whsec_...')
|
||||
->label(__('Webhook secret'))->password()->revealable()->placeholder('whsec_...')
|
||||
->columnSpanFull()
|
||||
->helperText('Endpoint webhook: https://service.mir.md/payments/stripe/webhook')
|
||||
->helperText(__('Endpoint webhook: https://service.mir.md/payments/stripe/webhook'))
|
||||
->visible(fn (Get $get) => $get('stripe_enabled')),
|
||||
]),
|
||||
Schemas\Components\Section::make('🅿️ PayPal')
|
||||
->description('Plăți internaționale. Mai potrivit pentru clienți din afara MD.')
|
||||
Schemas\Components\Section::make(__('🅿️ PayPal'))
|
||||
->description(__('Plăți internaționale. Mai potrivit pentru clienți din afara MD.'))
|
||||
->columns(3)
|
||||
->collapsible()
|
||||
->collapsed(fn (Get $get) => ! $get('paypal_enabled'))
|
||||
->schema([
|
||||
Forms\Components\Toggle::make('paypal_enabled')->label('Activează PayPal')->default(false)->live(),
|
||||
Forms\Components\Toggle::make('paypal_enabled')->label(__('Activează PayPal'))->default(false)->live(),
|
||||
Forms\Components\Select::make('paypal_mode')
|
||||
->label('Mod')
|
||||
->label(__('Mod'))
|
||||
->options(['sandbox' => '🧪 Sandbox', 'live' => '🟢 Live'])
|
||||
->default('sandbox')
|
||||
->visible(fn (Get $get) => $get('paypal_enabled')),
|
||||
Forms\Components\Placeholder::make('paypal_webhook_info')
|
||||
->label('Webhook')
|
||||
->label(__('Webhook'))
|
||||
->content('https://service.mir.md/payments/paypal/webhook')
|
||||
->visible(fn (Get $get) => $get('paypal_enabled')),
|
||||
Forms\Components\TextInput::make('paypal_client_id')
|
||||
->label('Client ID')->placeholder('AYS...')
|
||||
->label(__('Client ID'))->placeholder(__('AYS...'))
|
||||
->visible(fn (Get $get) => $get('paypal_enabled')),
|
||||
Forms\Components\TextInput::make('paypal_secret')
|
||||
->label('Secret')->password()->revealable()->placeholder('EJk...')
|
||||
->label(__('Secret'))->password()->revealable()->placeholder(__('EJk...'))
|
||||
->visible(fn (Get $get) => $get('paypal_enabled')),
|
||||
]),
|
||||
Schemas\Components\Section::make('🇲🇩 Paynet (Moldova)')
|
||||
->description('Procesator de plăți Moldova. Acceptă carduri MAIB, MICB, Victoriabank, OTP, MD Cash, Bitcoin, e-money. Comision negociabil ~1.8-2.5%.')
|
||||
Schemas\Components\Section::make(__('🇲🇩 Paynet (Moldova)'))
|
||||
->description(__('Procesator de plăți Moldova. Acceptă carduri MAIB, MICB, Victoriabank, OTP, MD Cash, Bitcoin, e-money. Comision negociabil ~1.8-2.5%.'))
|
||||
->columns(3)
|
||||
->collapsible()
|
||||
->collapsed(fn (Get $get) => ! $get('paynet_enabled'))
|
||||
->schema([
|
||||
Forms\Components\Toggle::make('paynet_enabled')->label('Activează Paynet')->default(false)->live(),
|
||||
Forms\Components\Toggle::make('paynet_enabled')->label(__('Activează Paynet'))->default(false)->live(),
|
||||
Forms\Components\Select::make('paynet_mode')
|
||||
->label('Mod')
|
||||
->label(__('Mod'))
|
||||
->options(['test' => '🧪 Test', 'live' => '🟢 Live'])
|
||||
->default('test')
|
||||
->visible(fn (Get $get) => $get('paynet_enabled')),
|
||||
Forms\Components\Placeholder::make('paynet_webhook_info')
|
||||
->label('Webhook (Notify URL)')
|
||||
->label(__('Webhook (Notify URL)'))
|
||||
->content('https://service.mir.md/payments/paynet/webhook')
|
||||
->visible(fn (Get $get) => $get('paynet_enabled')),
|
||||
Forms\Components\TextInput::make('paynet_merchant_code')
|
||||
->label('Merchant Code')
|
||||
->placeholder('AUTOCRM_001')
|
||||
->label(__('Merchant Code'))
|
||||
->placeholder(__('AUTOCRM_001'))
|
||||
->visible(fn (Get $get) => $get('paynet_enabled')),
|
||||
Forms\Components\TextInput::make('paynet_service_id')
|
||||
->label('Service ID')
|
||||
->label(__('Service ID'))
|
||||
->numeric()
|
||||
->placeholder('12345')
|
||||
->visible(fn (Get $get) => $get('paynet_enabled')),
|
||||
Forms\Components\TextInput::make('paynet_user')
|
||||
->label('User API')
|
||||
->label(__('User API'))
|
||||
->visible(fn (Get $get) => $get('paynet_enabled')),
|
||||
Forms\Components\TextInput::make('paynet_password')
|
||||
->label('Parolă API')->password()->revealable()
|
||||
->label(__('Parolă API'))->password()->revealable()
|
||||
->visible(fn (Get $get) => $get('paynet_enabled')),
|
||||
Forms\Components\TextInput::make('paynet_secret')
|
||||
->label('Secret semnătură')->password()->revealable()
|
||||
->label(__('Secret semnătură'))->password()->revealable()
|
||||
->columnSpanFull()
|
||||
->helperText('Cheia HMAC pentru semnarea cererilor + verificarea webhook-urilor de la Paynet.')
|
||||
->helperText(__('Cheia HMAC pentru semnarea cererilor + verificarea webhook-urilor de la Paynet.'))
|
||||
->visible(fn (Get $get) => $get('paynet_enabled')),
|
||||
]),
|
||||
Schemas\Components\Section::make('🏦 Transfer bancar (manual)')
|
||||
->description('Datele apar pe facturi și pe pagina de plată a tenant-ului. Confirmarea o faci manual.')
|
||||
Schemas\Components\Section::make(__('🏦 Transfer bancar (manual)'))
|
||||
->description(__('Datele apar pe facturi și pe pagina de plată a tenant-ului. Confirmarea o faci manual.'))
|
||||
->columns(2)
|
||||
->collapsible()
|
||||
->schema([
|
||||
Forms\Components\Toggle::make('bank_enabled')->label('Activează plata prin transfer')->default(true)->live(),
|
||||
Forms\Components\Toggle::make('bank_enabled')->label(__('Activează plata prin transfer'))->default(true)->live(),
|
||||
Forms\Components\TextInput::make('bank_beneficiary')
|
||||
->label('Beneficiar')->placeholder('AutoCRM SRL')
|
||||
->label(__('Beneficiar'))->placeholder(__('AutoCRM SRL'))
|
||||
->visible(fn (Get $get) => $get('bank_enabled')),
|
||||
Forms\Components\TextInput::make('bank_iban')
|
||||
->label('IBAN')->placeholder('MD00 AG00 0000 ...')
|
||||
->label(__('IBAN'))->placeholder(__('MD00 AG00 0000 ...'))
|
||||
->visible(fn (Get $get) => $get('bank_enabled')),
|
||||
Forms\Components\TextInput::make('bank_bic')
|
||||
->label('BIC / SWIFT')->placeholder('AGRNMD2X')
|
||||
->label(__('BIC / SWIFT'))->placeholder(__('AGRNMD2X'))
|
||||
->visible(fn (Get $get) => $get('bank_enabled')),
|
||||
Forms\Components\TextInput::make('bank_name')
|
||||
->label('Banca')->placeholder('Moldova-Agroindbank')
|
||||
->label(__('Banca'))->placeholder(__('Moldova-Agroindbank'))
|
||||
->visible(fn (Get $get) => $get('bank_enabled')),
|
||||
Forms\Components\Textarea::make('bank_instructions')
|
||||
->label('Instrucțiuni adiționale')->rows(2)->columnSpanFull()
|
||||
->label(__('Instrucțiuni adiționale'))->rows(2)->columnSpanFull()
|
||||
->visible(fn (Get $get) => $get('bank_enabled')),
|
||||
]),
|
||||
])
|
||||
@@ -266,14 +271,14 @@ class PaymentSettings extends Page
|
||||
'instructions' => $data['bank_instructions'] ?? null,
|
||||
]);
|
||||
|
||||
Notification::make()->title('Setări plăți salvate')->success()->send();
|
||||
Notification::make()->title(__('Setări plăți salvate'))->success()->send();
|
||||
}
|
||||
|
||||
protected function getFormActions(): array
|
||||
{
|
||||
return [
|
||||
\Filament\Actions\Action::make('save')
|
||||
->label('Salvează')
|
||||
->label(__('Salvează'))
|
||||
->submit('save'),
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user