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:
@@ -33,12 +33,12 @@ class EditWorkOrder extends EditRecord
|
||||
{
|
||||
return [
|
||||
Actions\Action::make('apply_template')
|
||||
->label('Aplică șablon')
|
||||
->label(__('Aplică șablon'))
|
||||
->icon('heroicon-m-clipboard-document-list')
|
||||
->color('gray')
|
||||
->schema([
|
||||
\Filament\Forms\Components\Select::make('template_id')
|
||||
->label('Șablon serviciu')
|
||||
->label(__('Șablon serviciu'))
|
||||
->options(fn () => \App\Models\Tenant\ServiceTemplate::where('is_active', true)->pluck('name', 'id'))
|
||||
->searchable()
|
||||
->required(),
|
||||
@@ -53,11 +53,11 @@ class EditWorkOrder extends EditRecord
|
||||
->success()->send();
|
||||
}),
|
||||
Actions\Action::make('ai_diagnose')
|
||||
->label('AI: sugerează diagnostic')
|
||||
->label(__('AI: sugerează diagnostic'))
|
||||
->icon('heroicon-m-sparkles')
|
||||
->color('primary')
|
||||
->visible(fn () => ! empty($this->record->complaint))
|
||||
->modalHeading('Diagnostic AI bazat pe plângerea clientului')
|
||||
->modalHeading(__('Diagnostic AI bazat pe plângerea clientului'))
|
||||
->modalSubmitAction(false)
|
||||
->modalCancelActionLabel('Închide')
|
||||
->modalContent(function () {
|
||||
@@ -66,7 +66,7 @@ class EditWorkOrder extends EditRecord
|
||||
return view('filament.tenant.ai-reply', ['reply' => $reply, 'meta' => $meta]);
|
||||
}),
|
||||
Actions\Action::make('tracking')
|
||||
->label('Link client (QR)')
|
||||
->label(__('Link client (QR)'))
|
||||
->icon('heroicon-m-qr-code')
|
||||
->color('primary')
|
||||
->modalHeading(fn () => 'Tracking client — WO #' . $this->record->number)
|
||||
@@ -76,7 +76,7 @@ class EditWorkOrder extends EditRecord
|
||||
'wo' => $this->record,
|
||||
])),
|
||||
Actions\Action::make('pdf')
|
||||
->label('Descarcă PDF')
|
||||
->label(__('Descarcă PDF'))
|
||||
->icon('heroicon-m-document-arrow-down')
|
||||
->color('gray')
|
||||
->action(function () {
|
||||
|
||||
+26
-21
@@ -19,13 +19,18 @@ class PartsRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'parts';
|
||||
|
||||
protected static ?string $title = 'Piese';
|
||||
protected static ?string $title = null;
|
||||
|
||||
public static function getTitle(\Illuminate\Database\Eloquent\Model $ownerRecord, string $pageClass): string
|
||||
{
|
||||
return __('Piese');
|
||||
}
|
||||
|
||||
public function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema->components([
|
||||
Forms\Components\Select::make('part_id')
|
||||
->label('Din catalog (lasă gol pentru text liber)')
|
||||
->label(__('Din catalog (lasă gol pentru text liber)'))
|
||||
->options(fn () => Part::where('is_active', true)
|
||||
->get()
|
||||
->mapWithKeys(fn ($p) => [$p->id => "{$p->name} " . ($p->article ? "[{$p->article}] " : '') . "(stoc: {$p->qty})"])
|
||||
@@ -43,20 +48,20 @@ class PartsRelationManager extends RelationManager
|
||||
}
|
||||
})
|
||||
->columnSpanFull(),
|
||||
Forms\Components\TextInput::make('name')->label('Denumire')->required()->columnSpanFull(),
|
||||
Forms\Components\TextInput::make('article')->label('Cod articol')->maxLength(64),
|
||||
Forms\Components\TextInput::make('name')->label(__('Denumire'))->required()->columnSpanFull(),
|
||||
Forms\Components\TextInput::make('article')->label(__('Cod articol'))->maxLength(64),
|
||||
Forms\Components\TextInput::make('brand')->maxLength(64),
|
||||
Forms\Components\TextInput::make('qty')->label('Cantitate')->numeric()->default(1)->required(),
|
||||
Forms\Components\TextInput::make('unit')->label('UM')->maxLength(16)->default('buc'),
|
||||
Forms\Components\TextInput::make('buy_price')->label('Preț achiziție')->numeric()->default(0),
|
||||
Forms\Components\TextInput::make('sell_price')->label('Preț vânzare')->numeric()->required(),
|
||||
Forms\Components\TextInput::make('discount_pct')->label('Discount %')->numeric()->default(0),
|
||||
Forms\Components\TextInput::make('qty')->label(__('Cantitate'))->numeric()->default(1)->required(),
|
||||
Forms\Components\TextInput::make('unit')->label(__('UM'))->maxLength(16)->default('buc'),
|
||||
Forms\Components\TextInput::make('buy_price')->label(__('Preț achiziție'))->numeric()->default(0),
|
||||
Forms\Components\TextInput::make('sell_price')->label(__('Preț vânzare'))->numeric()->required(),
|
||||
Forms\Components\TextInput::make('discount_pct')->label(__('Discount %'))->numeric()->default(0),
|
||||
Forms\Components\Select::make('status')
|
||||
->options(WorkOrderPart::STATUSES)
|
||||
->default('needed')
|
||||
->required()
|
||||
->helperText('La trecere pe „Montată" se scade automat din stoc.'),
|
||||
Forms\Components\Textarea::make('notes')->label('Observații')->columnSpanFull()->rows(2),
|
||||
->helperText(__('La trecere pe „Montată" se scade automat din stoc.')),
|
||||
Forms\Components\Textarea::make('notes')->label(__('Observații'))->columnSpanFull()->rows(2),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -65,11 +70,11 @@ class PartsRelationManager extends RelationManager
|
||||
return $table
|
||||
->recordTitleAttribute('name')
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('name')->label('Piesă')->wrap(),
|
||||
Tables\Columns\TextColumn::make('article')->label('Cod')->placeholder('—'),
|
||||
Tables\Columns\TextColumn::make('name')->label(__('Piesă'))->wrap(),
|
||||
Tables\Columns\TextColumn::make('article')->label(__('Cod'))->placeholder('—'),
|
||||
Tables\Columns\TextColumn::make('brand')->placeholder('—'),
|
||||
Tables\Columns\TextColumn::make('qty')->label('Cant.')->alignRight(),
|
||||
Tables\Columns\TextColumn::make('sell_price')->label('Preț')->money('MDL')->alignRight(),
|
||||
Tables\Columns\TextColumn::make('qty')->label(__('Cant.'))->alignRight(),
|
||||
Tables\Columns\TextColumn::make('sell_price')->label(__('Preț'))->money('MDL')->alignRight(),
|
||||
Tables\Columns\TextColumn::make('total')->money('MDL')->alignRight(),
|
||||
Tables\Columns\TextColumn::make('status')
|
||||
->formatStateUsing(fn ($s) => WorkOrderPart::STATUSES[$s] ?? $s)
|
||||
@@ -86,11 +91,11 @@ class PartsRelationManager extends RelationManager
|
||||
])
|
||||
->actions([
|
||||
Actions\Action::make('smart_price')
|
||||
->label('Preț inteligent')
|
||||
->label(__('Preț inteligent'))
|
||||
->icon('heroicon-m-sparkles')
|
||||
->color('primary')
|
||||
->visible(fn (WorkOrderPart $r) => (bool) $r->part_id)
|
||||
->modalHeading('Preț contextual')
|
||||
->modalHeading(__('Preț contextual'))
|
||||
->modalSubmitActionLabel('Aplică prețul')
|
||||
->modalContent(function (WorkOrderPart $r) {
|
||||
$wo = $r->workOrder;
|
||||
@@ -112,7 +117,7 @@ class PartsRelationManager extends RelationManager
|
||||
->success()->send();
|
||||
}),
|
||||
Actions\Action::make('issue_now')
|
||||
->label('Eliberează')
|
||||
->label(__('Eliberează'))
|
||||
->icon('heroicon-m-arrow-up-on-square')
|
||||
->color('warning')
|
||||
->visible(fn (WorkOrderPart $r) => $r->part_id
|
||||
@@ -128,7 +133,7 @@ class PartsRelationManager extends RelationManager
|
||||
->success()->send();
|
||||
}),
|
||||
Actions\Action::make('return_part')
|
||||
->label('Restituire')
|
||||
->label(__('Restituire'))
|
||||
->icon('heroicon-m-arrow-uturn-left')
|
||||
->color('gray')
|
||||
->visible(fn (WorkOrderPart $r) => $r->part_id
|
||||
@@ -137,12 +142,12 @@ class PartsRelationManager extends RelationManager
|
||||
->exists())
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('qty')
|
||||
->label('Cantitate restituită')
|
||||
->label(__('Cantitate restituită'))
|
||||
->numeric()
|
||||
->required()
|
||||
->minValue(0.001)
|
||||
->default(fn (WorkOrderPart $r) => (float) $r->qty),
|
||||
Forms\Components\Textarea::make('notes')->rows(2)->label('Observații'),
|
||||
Forms\Components\Textarea::make('notes')->rows(2)->label(__('Observații')),
|
||||
])
|
||||
->action(function (WorkOrderPart $r, array $data) {
|
||||
$batch = app(WarehouseService::class)->returnPart(
|
||||
|
||||
+12
-7
@@ -14,19 +14,24 @@ class PaymentsRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'payments';
|
||||
|
||||
protected static ?string $title = 'Plăți';
|
||||
protected static ?string $title = null;
|
||||
|
||||
public static function getTitle(\Illuminate\Database\Eloquent\Model $ownerRecord, string $pageClass): string
|
||||
{
|
||||
return __('Plăți');
|
||||
}
|
||||
|
||||
public function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema->components([
|
||||
Forms\Components\DatePicker::make('paid_at')->label('Data')->default(today())->required(),
|
||||
Forms\Components\TextInput::make('amount')->label('Sumă')->numeric()->required(),
|
||||
Forms\Components\DatePicker::make('paid_at')->label(__('Data'))->default(today())->required(),
|
||||
Forms\Components\TextInput::make('amount')->label(__('Sumă'))->numeric()->required(),
|
||||
Forms\Components\Select::make('method')
|
||||
->options(Payment::METHODS)
|
||||
->default('cash')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('reference')->label('Referință')->maxLength(64),
|
||||
Forms\Components\Textarea::make('notes')->label('Notițe')->columnSpanFull()->rows(2),
|
||||
Forms\Components\TextInput::make('reference')->label(__('Referință'))->maxLength(64),
|
||||
Forms\Components\Textarea::make('notes')->label(__('Notițe'))->columnSpanFull()->rows(2),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -35,9 +40,9 @@ class PaymentsRelationManager extends RelationManager
|
||||
return $table
|
||||
->recordTitleAttribute('amount')
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('paid_at')->label('Data')->date('d.m.Y'),
|
||||
Tables\Columns\TextColumn::make('paid_at')->label(__('Data'))->date('d.m.Y'),
|
||||
Tables\Columns\TextColumn::make('amount')->money('MDL')->alignRight()
|
||||
->summarize(Tables\Columns\Summarizers\Sum::make()->money('MDL')->label('Plătit')),
|
||||
->summarize(Tables\Columns\Summarizers\Sum::make()->money('MDL')->label(__('Plătit'))),
|
||||
Tables\Columns\TextColumn::make('method')
|
||||
->formatStateUsing(fn ($s) => Payment::METHODS[$s] ?? $s)
|
||||
->badge(),
|
||||
|
||||
+18
-13
@@ -15,27 +15,32 @@ class SubcontractJobsRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'subcontractJobs';
|
||||
|
||||
protected static ?string $title = 'Lucrări la terți';
|
||||
protected static ?string $title = null;
|
||||
|
||||
public static function getTitle(\Illuminate\Database\Eloquent\Model $ownerRecord, string $pageClass): string
|
||||
{
|
||||
return __('Lucrări la terți');
|
||||
}
|
||||
|
||||
public function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema->components([
|
||||
Forms\Components\Select::make('subcontractor_id')
|
||||
->label('Subcontractor')
|
||||
->label(__('Subcontractor'))
|
||||
->options(fn () => Subcontractor::where('is_active', true)->pluck('name', 'id'))
|
||||
->searchable()
|
||||
->columnSpanFull(),
|
||||
Forms\Components\Select::make('category')
|
||||
->label('Categorie')
|
||||
->label(__('Categorie'))
|
||||
->options(array_combine(Subcontractor::SPECIALTIES, Subcontractor::SPECIALTIES))
|
||||
->searchable(),
|
||||
Forms\Components\Select::make('status')->options(SubcontractJob::STATUSES)->default('sent')->required(),
|
||||
Forms\Components\Textarea::make('description')->label('Descriere')->rows(2)->columnSpanFull(),
|
||||
Forms\Components\TextInput::make('cost')->label('Cost (terț)')->numeric()->default(0)->required(),
|
||||
Forms\Components\TextInput::make('markup_pct')->label('Markup %')->numeric()->default(0),
|
||||
Forms\Components\TextInput::make('client_price')->label('Preț client')->numeric()->default(0)
|
||||
->helperText('Folosit dacă markup = 0.'),
|
||||
Forms\Components\DatePicker::make('eta')->label('ETA'),
|
||||
Forms\Components\Textarea::make('description')->label(__('Descriere'))->rows(2)->columnSpanFull(),
|
||||
Forms\Components\TextInput::make('cost')->label(__('Cost (terț)'))->numeric()->default(0)->required(),
|
||||
Forms\Components\TextInput::make('markup_pct')->label(__('Markup %'))->numeric()->default(0),
|
||||
Forms\Components\TextInput::make('client_price')->label(__('Preț client'))->numeric()->default(0)
|
||||
->helperText(__('Folosit dacă markup = 0.')),
|
||||
Forms\Components\DatePicker::make('eta')->label(__('ETA')),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -44,13 +49,13 @@ class SubcontractJobsRelationManager extends RelationManager
|
||||
return $table
|
||||
->recordTitleAttribute('number')
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('number')->label('Nr.'),
|
||||
Tables\Columns\TextColumn::make('subcontractor.name')->label('Terț')->placeholder('—'),
|
||||
Tables\Columns\TextColumn::make('number')->label(__('Nr.')),
|
||||
Tables\Columns\TextColumn::make('subcontractor.name')->label(__('Terț'))->placeholder('—'),
|
||||
Tables\Columns\TextColumn::make('category')->badge()->placeholder('—'),
|
||||
Tables\Columns\TextColumn::make('cost')->money('MDL')->alignRight(),
|
||||
Tables\Columns\TextColumn::make('client_price')->label('Preț client')->money('MDL')->alignRight(),
|
||||
Tables\Columns\TextColumn::make('client_price')->label(__('Preț client'))->money('MDL')->alignRight(),
|
||||
Tables\Columns\TextColumn::make('margin')
|
||||
->label('Marjă')
|
||||
->label(__('Marjă'))
|
||||
->state(fn (SubcontractJob $r) => $r->margin())
|
||||
->money('MDL')->alignRight()
|
||||
->color(fn ($s) => (float) $s > 0 ? 'success' : ((float) $s < 0 ? 'danger' : 'gray')),
|
||||
|
||||
+17
-12
@@ -17,13 +17,18 @@ class WorksRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'works';
|
||||
|
||||
protected static ?string $title = 'Manopere';
|
||||
protected static ?string $title = null;
|
||||
|
||||
public static function getTitle(\Illuminate\Database\Eloquent\Model $ownerRecord, string $pageClass): string
|
||||
{
|
||||
return __('Manopere');
|
||||
}
|
||||
|
||||
public function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema->components([
|
||||
Forms\Components\Select::make('labor_id')
|
||||
->label('Catalog manoperă')
|
||||
->label(__('Catalog manoperă'))
|
||||
->options(fn () => Labor::where('is_active', true)
|
||||
->get()
|
||||
->mapWithKeys(fn ($l) => [$l->id => "[{$l->category}] {$l->name_ro} ({$l->hours}h)"])
|
||||
@@ -38,18 +43,18 @@ class WorksRelationManager extends RelationManager
|
||||
}
|
||||
})
|
||||
->columnSpanFull(),
|
||||
Forms\Components\TextInput::make('name')->label('Nume')->required()->columnSpanFull(),
|
||||
Forms\Components\TextInput::make('hours')->label('Ore')->numeric()->default(1)->required(),
|
||||
Forms\Components\TextInput::make('price_per_hour')->label('Preț/h')->numeric()->required(),
|
||||
Forms\Components\TextInput::make('name')->label(__('Nume'))->required()->columnSpanFull(),
|
||||
Forms\Components\TextInput::make('hours')->label(__('Ore'))->numeric()->default(1)->required(),
|
||||
Forms\Components\TextInput::make('price_per_hour')->label(__('Preț/h'))->numeric()->required(),
|
||||
Forms\Components\Select::make('master_id')
|
||||
->label('Maistru')
|
||||
->label(__('Maistru'))
|
||||
->options(fn () => User::pluck('name', 'id'))
|
||||
->searchable(),
|
||||
Forms\Components\Select::make('status')
|
||||
->options(WorkOrderWork::STATUSES)
|
||||
->default('todo')
|
||||
->required(),
|
||||
Forms\Components\Textarea::make('notes')->label('Notițe')->columnSpanFull()->rows(2),
|
||||
Forms\Components\Textarea::make('notes')->label(__('Notițe'))->columnSpanFull()->rows(2),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -68,11 +73,11 @@ class WorksRelationManager extends RelationManager
|
||||
return $table
|
||||
->recordTitleAttribute('name')
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('name')->label('Manoperă')->wrap(),
|
||||
Tables\Columns\TextColumn::make('hours')->label('Ore')->numeric(decimalPlaces: 2)->alignRight(),
|
||||
Tables\Columns\TextColumn::make('price_per_hour')->label('Preț/h')->money('MDL')->alignRight(),
|
||||
Tables\Columns\TextColumn::make('name')->label(__('Manoperă'))->wrap(),
|
||||
Tables\Columns\TextColumn::make('hours')->label(__('Ore'))->numeric(decimalPlaces: 2)->alignRight(),
|
||||
Tables\Columns\TextColumn::make('price_per_hour')->label(__('Preț/h'))->money('MDL')->alignRight(),
|
||||
Tables\Columns\TextColumn::make('total')
|
||||
->label('Total')
|
||||
->label(__('Total'))
|
||||
->money('MDL')
|
||||
->alignRight()
|
||||
->description(function ($record) {
|
||||
@@ -82,7 +87,7 @@ class WorksRelationManager extends RelationManager
|
||||
if ((float) $record->applied_margin_pct === 0.0) return null;
|
||||
return 'Bază salariu: ' . number_format((float) $record->salary_base, 2) . ' MDL · marjă ' . rtrim(rtrim(number_format((float) $record->applied_margin_pct, 2), '0'), '.') . '%';
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('master.name')->label('Maistru')->placeholder('—'),
|
||||
Tables\Columns\TextColumn::make('master.name')->label(__('Maistru'))->placeholder('—'),
|
||||
Tables\Columns\TextColumn::make('status')
|
||||
->formatStateUsing(fn ($s) => WorkOrderWork::STATUSES[$s] ?? $s)
|
||||
->badge()
|
||||
|
||||
Reference in New Issue
Block a user