authorize('jobs.manage'); $this->form->responsible_user_id = (string) auth()->id(); } /** * @return list */ #[Computed] public function serviceUnits(): array { return app(CatalogQueries::class)->activeServiceUnits(); } /** * Users who can be responsible for a job (not subcontractors). * * @return list */ #[Computed] public function staff(): array { return array_values(array_filter( app(UserAccountQueries::class)->activeUserOptions(), fn (UserOption $user): bool => $user->role !== Role::Subcontractor, )); } public function save(CreateCustomerJob $createJob, CustomerJobQueries $jobQueries): void { $this->authorize('jobs.manage'); $data = $this->form->toData(); try { $jobId = $createJob->execute($data, (int) auth()->id()); } catch (DomainException $exception) { $this->form->showDomainError($exception); return; } $this->createdJobId = $jobId; $this->createdNumber = $jobQueries->findDetails($jobId)->number ?? ''; $this->createdMessage = __('jobs.created', ['number' => $this->createdNumber, 'name' => trim($data->name)]); $this->form->clearForNextJob(); $this->customerName = ''; $this->customerSearch = ''; $this->statusMessage = ''; $this->js("document.getElementById('quick-created')?.focus()"); } public function render(): mixed { return $this->view()->title(__('jobs.quick.title')); } }; ?>
{{ __('jobs.quick.title') }}

{{ __('jobs.quick.intro') }}

@if ($createdJobId !== null)

{{ __('jobs.quick.open', ['number' => $createdNumber]) }} {{ __('jobs.quick.complete') }}

@endif

{{ $statusMessage }}

{{-- TallStackUI's native select does not tie its label to the control, so aria-label names it. --}} @foreach ($this->serviceUnits as $unit) @endforeach @foreach ($this->staff as $user) @endforeach