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:
@@ -31,20 +31,30 @@ class MarkupRuleResource extends Resource
|
||||
return __('nav.group.Depozit');
|
||||
}
|
||||
|
||||
protected static ?string $modelLabel = 'regulă';
|
||||
protected static ?string $modelLabel = null;
|
||||
|
||||
protected static ?string $pluralModelLabel = 'reguli markup';
|
||||
public static function getModelLabel(): string
|
||||
{
|
||||
return __('regulă');
|
||||
}
|
||||
|
||||
protected static ?string $pluralModelLabel = null;
|
||||
|
||||
public static function getPluralModelLabel(): string
|
||||
{
|
||||
return __('reguli markup');
|
||||
}
|
||||
|
||||
protected static ?int $navigationSort = 44;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema->components([
|
||||
Schemas\Components\Section::make('Regulă')
|
||||
Schemas\Components\Section::make(__('Regulă'))
|
||||
->columns(2)
|
||||
->schema([
|
||||
Forms\Components\Select::make('type')
|
||||
->label('Tip')
|
||||
->label(__('Tip'))
|
||||
->options(MarkupRule::TYPES)
|
||||
->default('category')
|
||||
->required()
|
||||
@@ -58,25 +68,25 @@ class MarkupRuleResource extends Resource
|
||||
->searchable()
|
||||
->required(fn (Get $get) => in_array($get('type'), ['category', 'brand'], true)),
|
||||
Forms\Components\TextInput::make('range_from')
|
||||
->label('De la (preț achiziție)')
|
||||
->label(__('De la (preț achiziție)'))
|
||||
->numeric()
|
||||
->visible(fn (Get $get) => $get('type') === 'range'),
|
||||
Forms\Components\TextInput::make('range_to')
|
||||
->label('Până la (gol = ∞)')
|
||||
->label(__('Până la (gol = ∞)'))
|
||||
->numeric()
|
||||
->visible(fn (Get $get) => $get('type') === 'range'),
|
||||
Forms\Components\TextInput::make('markup_pct')
|
||||
->label('Markup %')
|
||||
->label(__('Markup %'))
|
||||
->numeric()
|
||||
->required()
|
||||
->suffix('%')
|
||||
->helperText('Ex 30 → preț vânzare = preț achiziție × 1.30'),
|
||||
->helperText(__('Ex 30 → preț vânzare = preț achiziție × 1.30')),
|
||||
Forms\Components\TextInput::make('priority')
|
||||
->label('Prioritate')
|
||||
->label(__('Prioritate'))
|
||||
->numeric()
|
||||
->default(100)
|
||||
->helperText('Mai mic = aplicat primul.'),
|
||||
Forms\Components\Toggle::make('is_active')->label('Activă')->default(true),
|
||||
->helperText(__('Mai mic = aplicat primul.')),
|
||||
Forms\Components\Toggle::make('is_active')->label(__('Activă'))->default(true),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
@@ -89,11 +99,11 @@ class MarkupRuleResource extends Resource
|
||||
Tables\Columns\TextColumn::make('type')
|
||||
->formatStateUsing(fn ($s) => MarkupRule::TYPES[$s] ?? $s)
|
||||
->badge(),
|
||||
Tables\Columns\TextColumn::make('key')->label('Cheie')->placeholder('—'),
|
||||
Tables\Columns\TextColumn::make('range_from')->label('De la')->placeholder('—'),
|
||||
Tables\Columns\TextColumn::make('range_to')->label('Până la')->placeholder('∞'),
|
||||
Tables\Columns\TextColumn::make('key')->label(__('Cheie'))->placeholder('—'),
|
||||
Tables\Columns\TextColumn::make('range_from')->label(__('De la'))->placeholder('—'),
|
||||
Tables\Columns\TextColumn::make('range_to')->label(__('Până la'))->placeholder('∞'),
|
||||
Tables\Columns\TextColumn::make('markup_pct')
|
||||
->label('Markup')
|
||||
->label(__('Markup'))
|
||||
->formatStateUsing(fn ($s) => '+' . $s . '%')
|
||||
->color('success')
|
||||
->weight('bold'),
|
||||
@@ -104,11 +114,11 @@ class MarkupRuleResource extends Resource
|
||||
])
|
||||
->headerActions([
|
||||
Actions\Action::make('apply_all')
|
||||
->label('Aplică toate regulile la stoc')
|
||||
->label(__('Aplică toate regulile la stoc'))
|
||||
->icon('heroicon-m-bolt')
|
||||
->color('warning')
|
||||
->requiresConfirmation()
|
||||
->modalDescription('Va recalcula sell_price pentru TOATE piesele active. Continui?')
|
||||
->modalDescription(__('Va recalcula sell_price pentru TOATE piesele active. Continui?'))
|
||||
->action(function () {
|
||||
$count = 0;
|
||||
Part::where('is_active', true)->where('buy_price', '>', 0)->chunk(100, function ($parts) use (&$count) {
|
||||
|
||||
Reference in New Issue
Block a user