fix: revert client_id to options() — relationship() broke initial list loading

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-09-04 20:09:44 +00:00
parent 3c7e5fffbf
commit 0af8f2a755
@@ -84,18 +84,14 @@ class WorkOrderResource extends Resource
Forms\Components\Select::make('urgency')->label(__('Urgență'))
->options(\App\Support\I18n::opts(\App\Models\Tenant\PricingCoefficient::URGENCY))->default('normal')->required(),
Forms\Components\Select::make('client_id')->label(__('Client'))
->relationship('client', 'name')
->getSearchResultsUsing(fn (string $query) =>
Client::where(fn ($q) => $q
->where('name', 'like', "%{$query}%")
->orWhere('phone', 'like', "%{$query}%"))
->limit(30)->pluck('name', 'id'))
->options(fn () => Client::orderBy('name')->pluck('name', 'id'))
->searchable()->live()->required()->columnSpan(2)
->createOptionForm([
Forms\Components\TextInput::make('name')->label(__('Nume'))->required(),
Forms\Components\TextInput::make('phone')->label(__('Telefon')),
Forms\Components\TextInput::make('email')->label(__('Email'))->email(),
]),
])
->createOptionUsing(fn (array $data) => Client::create($data)->id),
Forms\Components\Select::make('vehicle_id')->label(__('Auto'))
->options(fn (Get $get) => $get('client_id')
? Vehicle::where('client_id', $get('client_id'))->get()