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:
@@ -30,31 +30,36 @@ class MarketingChannelResource extends Resource
|
||||
|
||||
protected static ?string $modelLabel = 'canal';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'canale marketing';
|
||||
protected static ?string $pluralModelLabel = null;
|
||||
|
||||
public static function getPluralModelLabel(): string
|
||||
{
|
||||
return __('canale marketing');
|
||||
}
|
||||
|
||||
protected static ?int $navigationSort = 61;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema->components([
|
||||
Schemas\Components\Section::make('Identificare')
|
||||
Schemas\Components\Section::make(__('Identificare'))
|
||||
->columns(3)
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('name')->label('Nume canal')->required()->maxLength(120),
|
||||
Forms\Components\TextInput::make('icon')->label('Iconiță (emoji)')->maxLength(8)->placeholder('🔍 / 📘 / 📸'),
|
||||
Forms\Components\TextInput::make('name')->label(__('Nume canal'))->required()->maxLength(120),
|
||||
Forms\Components\TextInput::make('icon')->label(__('Iconiță (emoji)'))->maxLength(8)->placeholder('🔍 / 📘 / 📸'),
|
||||
Forms\Components\ColorPicker::make('color'),
|
||||
]),
|
||||
Schemas\Components\Section::make('Buget & rezultate (luna curentă)')
|
||||
Schemas\Components\Section::make(__('Buget & rezultate (luna curentă)'))
|
||||
->columns(3)
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('budget_monthly')->label('Buget')->numeric()->default(0),
|
||||
Forms\Components\TextInput::make('spent_monthly')->label('Cheltuit')->numeric()->default(0),
|
||||
Forms\Components\TextInput::make('revenue')->label('Venit generat')->numeric()->default(0),
|
||||
Forms\Components\TextInput::make('leads_count')->label('Lead-uri')->numeric()->default(0),
|
||||
Forms\Components\TextInput::make('converted_count')->label('Convertite')->numeric()->default(0),
|
||||
Forms\Components\Toggle::make('is_active')->label('Activ')->default(true),
|
||||
Forms\Components\TextInput::make('budget_monthly')->label(__('Buget'))->numeric()->default(0),
|
||||
Forms\Components\TextInput::make('spent_monthly')->label(__('Cheltuit'))->numeric()->default(0),
|
||||
Forms\Components\TextInput::make('revenue')->label(__('Venit generat'))->numeric()->default(0),
|
||||
Forms\Components\TextInput::make('leads_count')->label(__('Lead-uri'))->numeric()->default(0),
|
||||
Forms\Components\TextInput::make('converted_count')->label(__('Convertite'))->numeric()->default(0),
|
||||
Forms\Components\Toggle::make('is_active')->label(__('Activ'))->default(true),
|
||||
]),
|
||||
Forms\Components\Textarea::make('notes')->label('Observații')->columnSpanFull()->rows(2),
|
||||
Forms\Components\Textarea::make('notes')->label(__('Observații'))->columnSpanFull()->rows(2),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -65,26 +70,26 @@ class MarketingChannelResource extends Resource
|
||||
Tables\Columns\ColorColumn::make('color')->label(''),
|
||||
Tables\Columns\TextColumn::make('icon')->label('')->width(40),
|
||||
Tables\Columns\TextColumn::make('name')->searchable()->sortable(),
|
||||
Tables\Columns\TextColumn::make('budget_monthly')->label('Buget')->money('MDL')->alignRight(),
|
||||
Tables\Columns\TextColumn::make('spent_monthly')->label('Cheltuit')->money('MDL')->alignRight(),
|
||||
Tables\Columns\TextColumn::make('leads_count')->label('Lead-uri')->alignRight(),
|
||||
Tables\Columns\TextColumn::make('converted_count')->label('Convertite')->alignRight(),
|
||||
Tables\Columns\TextColumn::make('revenue')->label('Venit')->money('MDL')->alignRight()->color('success'),
|
||||
Tables\Columns\TextColumn::make('budget_monthly')->label(__('Buget'))->money('MDL')->alignRight(),
|
||||
Tables\Columns\TextColumn::make('spent_monthly')->label(__('Cheltuit'))->money('MDL')->alignRight(),
|
||||
Tables\Columns\TextColumn::make('leads_count')->label(__('Lead-uri'))->alignRight(),
|
||||
Tables\Columns\TextColumn::make('converted_count')->label(__('Convertite'))->alignRight(),
|
||||
Tables\Columns\TextColumn::make('revenue')->label(__('Venit'))->money('MDL')->alignRight()->color('success'),
|
||||
Tables\Columns\TextColumn::make('roi')
|
||||
->label('ROI')
|
||||
->label(__('ROI'))
|
||||
->state(fn (MarketingChannel $r) => $r->roi)
|
||||
->formatStateUsing(fn ($s) => $s . '%')
|
||||
->color(fn ($s) => $s >= 0 ? 'success' : 'danger')
|
||||
->alignRight(),
|
||||
Tables\Columns\TextColumn::make('cost_per_lead')
|
||||
->label('Cost/lead')
|
||||
->label(__('Cost/lead'))
|
||||
->state(fn (MarketingChannel $r) => $r->cost_per_lead)
|
||||
->money('MDL')
|
||||
->alignRight(),
|
||||
Tables\Columns\IconColumn::make('is_active')->boolean(),
|
||||
])
|
||||
->filters([
|
||||
Tables\Filters\TernaryFilter::make('is_active')->label('Active'),
|
||||
Tables\Filters\TernaryFilter::make('is_active')->label(__('Active')),
|
||||
])
|
||||
->actions([
|
||||
Actions\EditAction::make(),
|
||||
|
||||
Reference in New Issue
Block a user