feat(labors): trilingual name — add name_en column + Labor::label() helper
- Migration: add nullable `labors.name_en` alongside existing name_ro/
name_ru.
- Labor model: label(?locale) accessor returns name_{locale} with
name_ro fallback.
- LaborResource form: expose 3rd 'Nume (EN)' field.
- Table + Select displays now go through label() so options show the
locale-appropriate name:
/app/labors table column,
WorkOrderResource works Select ('[category] name (Nh)'),
ServiceTemplate items Select,
ServiceComposer WorkOrderWork snapshot on create.
- Snapshot name saved on wo_works.name at creation reflects the
current locale; existing rows keep their stored snapshot untouched.
All 306 tests pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+4
-2
@@ -36,13 +36,15 @@ class ItemsRelationManager extends RelationManager
|
||||
->required(),
|
||||
Forms\Components\Select::make('labor_id')
|
||||
->label(__('Manoperă'))
|
||||
->options(fn () => Labor::where('is_active', true)->pluck('name_ro', 'id'))
|
||||
->options(fn () => Labor::where('is_active', true)->get()
|
||||
->mapWithKeys(fn ($l) => [$l->id => $l->label()])
|
||||
->all())
|
||||
->searchable()
|
||||
->visible(fn (Get $get) => $get('kind') === 'labor')
|
||||
->live()
|
||||
->afterStateUpdated(function ($state, Set $set) {
|
||||
if ($state && $l = Labor::find($state)) {
|
||||
$set('name', $l->name_ro);
|
||||
$set('name', $l->label());
|
||||
$set('hours', $l->hours);
|
||||
}
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user