improve WO form: inline client/vehicle create, mechanic filter, category translation, PDF emoji fix

- client_id field: switched to relationship() with createOptionForm so new clients
  can be created inline (name, phone, email); search also matches by phone
- vehicle_id field: added createOptionForm (make, model, plate, year, VIN); newly
  created vehicle is automatically linked to the currently selected client
- master_id field: now shows only active users with role mechanic/master
- WorksRelationManager: labor catalog select marked optional; added createOptionForm
  so new catalog entries can be added without leaving the WO form
- SubcontractJobsRelationManager: category table column now translates value via __()
  and shows explicit label(__('Categorie'))
- PDF work-order: replaced 📞 / ✉ / ⚠ emojis with plain-text equivalents so
  DomPDF/DejaVu Sans renders them correctly instead of showing "????"

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-09-04 19:56:40 +00:00
parent 2ca6ab58a1
commit 3c7e5fffbf
4 changed files with 46 additions and 9 deletions
@@ -28,7 +28,7 @@ class WorksRelationManager extends RelationManager
{
return $schema->components([
Forms\Components\Select::make('labor_id')
->label(__('Catalog manoperă'))
->label(__('Catalog manoperă') . ' (' . __('opțional') . ')')
->options(fn () => Labor::where('is_active', true)
->get()
->mapWithKeys(fn ($l) => [$l->id => '[' . __($l->category) . '] ' . $l->label() . ' (' . $l->hours . __('h') . ')'])
@@ -42,6 +42,18 @@ class WorksRelationManager extends RelationManager
$set('price_per_hour', $labor->hours > 0 ? round($labor->price / max((float) $labor->hours, 1), 2) : 0);
}
})
->createOptionForm([
Forms\Components\Select::make('category')->label(__('Categorie'))
->options(\App\Support\I18n::opts(array_combine(Labor::CATEGORIES, Labor::CATEGORIES)))
->required(),
Forms\Components\TextInput::make('name_ro')->label(__('Denumire'))->required(),
Forms\Components\TextInput::make('hours')->label(__('Ore normate'))->numeric()->default(1)->required(),
Forms\Components\TextInput::make('price')->label(__('Preț total (MDL)'))->numeric()->default(0)->required(),
])
->createOptionUsing(function (array $data) {
$data['is_active'] = true;
return Labor::create($data)->id;
})
->columnSpanFull(),
Forms\Components\TextInput::make('name')->label(__('Nume'))->required()->columnSpanFull(),
Forms\Components\TextInput::make('hours')->label(__('Ore'))->numeric()->default(1)->required(),