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,9 +30,19 @@ class OnlineOrderResource extends Resource
|
||||
return __('nav.group.Magazin');
|
||||
}
|
||||
|
||||
protected static ?string $modelLabel = 'comandă';
|
||||
protected static ?string $modelLabel = null;
|
||||
|
||||
protected static ?string $pluralModelLabel = 'comenzi online';
|
||||
public static function getModelLabel(): string
|
||||
{
|
||||
return __('comandă');
|
||||
}
|
||||
|
||||
protected static ?string $pluralModelLabel = null;
|
||||
|
||||
public static function getPluralModelLabel(): string
|
||||
{
|
||||
return __('comenzi online');
|
||||
}
|
||||
|
||||
protected static ?int $navigationSort = 50;
|
||||
|
||||
@@ -50,18 +60,18 @@ class OnlineOrderResource extends Resource
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema->components([
|
||||
Schemas\Components\Section::make('Comandă')
|
||||
Schemas\Components\Section::make(__('Comandă'))
|
||||
->columns(3)
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('number')->label('Nr.')->disabled()->dehydrated(false),
|
||||
Forms\Components\TextInput::make('number')->label(__('Nr.'))->disabled()->dehydrated(false),
|
||||
Forms\Components\Select::make('status')->options(OnlineOrder::STATUSES)->required(),
|
||||
Forms\Components\Select::make('delivery_method')->label('Livrare')->options(OnlineOrder::DELIVERY)->required(),
|
||||
Forms\Components\TextInput::make('customer_name')->label('Client')->required(),
|
||||
Forms\Components\TextInput::make('customer_phone')->label('Telefon')->required(),
|
||||
Forms\Components\TextInput::make('customer_email')->label('Email'),
|
||||
Forms\Components\TextInput::make('address')->label('Adresă')->columnSpan(2),
|
||||
Forms\Components\TextInput::make('delivery_fee')->label('Taxă livrare')->numeric(),
|
||||
Forms\Components\Textarea::make('notes')->label('Observații')->columnSpanFull()->rows(2),
|
||||
Forms\Components\Select::make('delivery_method')->label(__('Livrare'))->options(OnlineOrder::DELIVERY)->required(),
|
||||
Forms\Components\TextInput::make('customer_name')->label(__('Client'))->required(),
|
||||
Forms\Components\TextInput::make('customer_phone')->label(__('Telefon'))->required(),
|
||||
Forms\Components\TextInput::make('customer_email')->label(__('Email')),
|
||||
Forms\Components\TextInput::make('address')->label(__('Adresă'))->columnSpan(2),
|
||||
Forms\Components\TextInput::make('delivery_fee')->label(__('Taxă livrare'))->numeric(),
|
||||
Forms\Components\Textarea::make('notes')->label(__('Observații'))->columnSpanFull()->rows(2),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
@@ -70,12 +80,12 @@ class OnlineOrderResource extends Resource
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('number')->label('Nr.')->searchable()->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_at')->label('Data')->dateTime('d.m.Y H:i')->sortable(),
|
||||
Tables\Columns\TextColumn::make('customer_name')->label('Client')->searchable(),
|
||||
Tables\Columns\TextColumn::make('customer_phone')->label('Telefon')->copyable(),
|
||||
Tables\Columns\TextColumn::make('number')->label(__('Nr.'))->searchable()->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_at')->label(__('Data'))->dateTime('d.m.Y H:i')->sortable(),
|
||||
Tables\Columns\TextColumn::make('customer_name')->label(__('Client'))->searchable(),
|
||||
Tables\Columns\TextColumn::make('customer_phone')->label(__('Telefon'))->copyable(),
|
||||
Tables\Columns\TextColumn::make('delivery_method')
|
||||
->label('Livrare')
|
||||
->label(__('Livrare'))
|
||||
->formatStateUsing(fn ($s) => OnlineOrder::DELIVERY[$s] ?? $s),
|
||||
Tables\Columns\TextColumn::make('status')
|
||||
->formatStateUsing(fn ($s) => OnlineOrder::STATUSES[$s] ?? $s)
|
||||
@@ -94,12 +104,12 @@ class OnlineOrderResource extends Resource
|
||||
])
|
||||
->actions([
|
||||
Actions\Action::make('fulfill')
|
||||
->label('Onorează (scade stoc)')
|
||||
->label(__('Onorează (scade stoc)'))
|
||||
->icon('heroicon-m-check-badge')
|
||||
->color('success')
|
||||
->visible(fn (OnlineOrder $r) => ! in_array($r->status, ['delivered', 'cancelled'], true))
|
||||
->requiresConfirmation()
|
||||
->modalDescription('Scade din stoc piesele legate de catalog (FIFO) și marchează comanda confirmată.')
|
||||
->modalDescription(__('Scade din stoc piesele legate de catalog (FIFO) și marchează comanda confirmată.'))
|
||||
->action(function (OnlineOrder $r) {
|
||||
$svc = app(\App\Services\Warehouse\WarehouseService::class);
|
||||
$issued = 0; $skipped = 0;
|
||||
|
||||
Reference in New Issue
Block a user