i18n(wo relations): translated snapshot names + explicit empty states
- WorksRelationManager Name column: getStateUsing(labor?->label()) so the row shows the labor's localized name (not the raw snapshot); fallback to stored snapshot when labor is missing. - 4 explicit empty states with helper description + icon on Works, Parts, SubcontractJobs, Payments — replaces Filament's auto-generated 'Не найдено X / Создать X для старта.' - 4 CreateAction titles / modal headings for all four relation managers. - Notification 'Piesa returnată în stoc' / 'Nimic de restituit' wrapped. - +11 translation keys. All 306 tests pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+8
-3
@@ -87,7 +87,9 @@ class PartsRelationManager extends RelationManager
|
||||
]),
|
||||
])
|
||||
->headerActions([
|
||||
Actions\CreateAction::make(),
|
||||
Actions\CreateAction::make()
|
||||
->label(__('Adaugă piesă'))
|
||||
->modalHeading(__('Adaugă piesă în fișă')),
|
||||
])
|
||||
->actions([
|
||||
Actions\Action::make('smart_price')
|
||||
@@ -154,12 +156,15 @@ class PartsRelationManager extends RelationManager
|
||||
$r, (float) $data['qty'], $data['notes'] ?? null
|
||||
);
|
||||
Notification::make()
|
||||
->title($batch ? 'Piesa returnată în stoc' : 'Nimic de restituit')
|
||||
->title($batch ? __('Piesa returnată în stoc') : __('Nimic de restituit'))
|
||||
->{$batch ? 'success' : 'warning'}()
|
||||
->send();
|
||||
}),
|
||||
Actions\EditAction::make(),
|
||||
Actions\DeleteAction::make(),
|
||||
]);
|
||||
])
|
||||
->emptyStateHeading(__('Nicio piesă montată.'))
|
||||
->emptyStateDescription(__('Adaugă piesele necesare din catalog. Stocul se rezervă automat, iar la marcarea „Montată" scade FIFO.'))
|
||||
->emptyStateIcon('heroicon-o-cube');
|
||||
}
|
||||
}
|
||||
|
||||
+12
-6
@@ -49,17 +49,23 @@ class PaymentsRelationManager extends RelationManager
|
||||
Tables\Columns\TextColumn::make('reference')->placeholder('—'),
|
||||
])
|
||||
->headerActions([
|
||||
Actions\CreateAction::make()->mutateFormDataUsing(function (array $data, RelationManager $livewire): array {
|
||||
$wo = $livewire->getOwnerRecord();
|
||||
$data['client_id'] = $wo->client_id;
|
||||
$data['user_id'] = auth()->id();
|
||||
return $data;
|
||||
}),
|
||||
Actions\CreateAction::make()
|
||||
->label(__('Adaugă plată'))
|
||||
->modalHeading(__('Adaugă plată la fișă'))
|
||||
->mutateFormDataUsing(function (array $data, RelationManager $livewire): array {
|
||||
$wo = $livewire->getOwnerRecord();
|
||||
$data['client_id'] = $wo->client_id;
|
||||
$data['user_id'] = auth()->id();
|
||||
return $data;
|
||||
}),
|
||||
])
|
||||
->actions([
|
||||
Actions\EditAction::make(),
|
||||
Actions\DeleteAction::make(),
|
||||
])
|
||||
->emptyStateHeading(__('Nicio plată'))
|
||||
->emptyStateDescription(__('Adaugă plățile parțiale sau totale primite pentru această fișă. Statusul plății se actualizează automat.'))
|
||||
->emptyStateIcon('heroicon-o-banknotes')
|
||||
->defaultSort('paid_at', 'desc');
|
||||
}
|
||||
}
|
||||
|
||||
+9
-2
@@ -64,7 +64,14 @@ class SubcontractJobsRelationManager extends RelationManager
|
||||
->badge()
|
||||
->colors(['warning' => ['sent', 'in_progress'], 'success' => ['done', 'returned'], 'danger' => ['cancelled']]),
|
||||
])
|
||||
->headerActions([Actions\CreateAction::make()])
|
||||
->actions([Actions\EditAction::make(), Actions\DeleteAction::make()]);
|
||||
->headerActions([
|
||||
Actions\CreateAction::make()
|
||||
->label(__('Adaugă lucrare terți'))
|
||||
->modalHeading(__('Adaugă lucrare la subcontractor')),
|
||||
])
|
||||
->actions([Actions\EditAction::make(), Actions\DeleteAction::make()])
|
||||
->emptyStateHeading(__('Nicio lucrare la terți'))
|
||||
->emptyStateDescription(__('Adaugă lucrări trimise la ateliere externe (turbo, cutii, vopsitorie). Costul + markup intră automat în totalul fișei.'))
|
||||
->emptyStateIcon('heroicon-o-arrow-top-right-on-square');
|
||||
}
|
||||
}
|
||||
|
||||
+6
-2
@@ -73,7 +73,8 @@ class WorksRelationManager extends RelationManager
|
||||
return $table
|
||||
->recordTitleAttribute('name')
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('name')->label(__('Manoperă'))->wrap(),
|
||||
Tables\Columns\TextColumn::make('name')->label(__('Manoperă'))->wrap()
|
||||
->getStateUsing(fn ($record) => $record->labor?->label() ?: $record->name),
|
||||
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')
|
||||
@@ -117,6 +118,9 @@ class WorksRelationManager extends RelationManager
|
||||
->actions([
|
||||
Actions\EditAction::make(),
|
||||
Actions\DeleteAction::make(),
|
||||
]);
|
||||
])
|
||||
->emptyStateHeading(__('Nicio manoperă efectuată.'))
|
||||
->emptyStateDescription(__('Adaugă manopere din catalog — piesele implicite se adaugă automat în tab-ul Piese.'))
|
||||
->emptyStateIcon('heroicon-o-wrench');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user