Add quick job intake for phones
Phase 1, item 5: - New page /jobs/quick (Pikavastaanotto): customer (search or quick add), name, short description, service unit, responsible person and starting status (Alustava or Prospekti) in one column. The job is created with CreateCustomerJob, so numbering, reference checks and history are the same as on the full form. - After saving, the form clears for the next job (responsible person and status stay), and a status message with the job number and links to the job and its edit page takes focus. - The customer search of the job form moves to a PicksCustomer trait and an <x-jobs.customer-picker> component shared by both pages. - Menu link and a list button for users who may open jobs; nav items accept several route patterns. - PHPStan ignores unused-trait only for Livewire Concerns, which are used from excluded single-file components. - Spec and CLAUDE.md updated. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Jobs\Presentation\Livewire\Concerns;
|
||||
|
||||
use App\Modules\Customers\Application\Contracts\CustomerQueries;
|
||||
use App\Modules\Customers\Application\DTOs\CustomerDetailsData;
|
||||
use App\Modules\Customers\Application\DTOs\CustomerSummary;
|
||||
use App\Modules\Customers\Application\UseCases\RegisterCustomer;
|
||||
use App\Modules\Customers\Domain\Enums\CustomerType;
|
||||
use App\Modules\Shared\Domain\Exceptions\DomainException;
|
||||
use Livewire\Attributes\Computed;
|
||||
use Livewire\Attributes\Locked;
|
||||
|
||||
/**
|
||||
* Customer choice for job pages, rendered with <x-jobs.customer-picker>:
|
||||
* a search field whose results are buttons, and a quick add by name. The
|
||||
* page has a form object with a `customer_id` string and may override
|
||||
* customerChosen() to clear fields that depend on the customer.
|
||||
*
|
||||
* @property-read list<CustomerSummary> $customerResults
|
||||
*/
|
||||
trait PicksCustomer
|
||||
{
|
||||
public string $customerSearch = '';
|
||||
|
||||
#[Locked]
|
||||
public string $customerName = '';
|
||||
|
||||
public string $statusMessage = '';
|
||||
|
||||
/**
|
||||
* @return list<CustomerSummary>
|
||||
*/
|
||||
#[Computed]
|
||||
public function customerResults(): array
|
||||
{
|
||||
$term = trim($this->customerSearch);
|
||||
|
||||
return mb_strlen($term) < 2 ? [] : app(CustomerQueries::class)->search($term, 8);
|
||||
}
|
||||
|
||||
public function selectCustomer(int $customerId): void
|
||||
{
|
||||
$this->authorize('jobs.manage');
|
||||
|
||||
$customer = app(CustomerQueries::class)->findSummary($customerId);
|
||||
|
||||
if ($customer !== null) {
|
||||
$this->useCustomer($customer->id, $customer->name);
|
||||
}
|
||||
}
|
||||
|
||||
public function createCustomer(RegisterCustomer $registerCustomer): void
|
||||
{
|
||||
$this->authorize('jobs.manage');
|
||||
$this->authorize('customers.use');
|
||||
|
||||
$name = trim($this->customerSearch);
|
||||
|
||||
try {
|
||||
$customerId = $registerCustomer->execute(new CustomerDetailsData($name, CustomerType::Company));
|
||||
} catch (DomainException) {
|
||||
$this->addError('customerSearch', __('customers.errors.invalid_name'));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->useCustomer($customerId, $name);
|
||||
$this->statusMessage = __('jobs.customer_picker.created', ['name' => $name]);
|
||||
}
|
||||
|
||||
public function clearCustomer(): void
|
||||
{
|
||||
$this->form->customer_id = '';
|
||||
$this->customerName = '';
|
||||
$this->statusMessage = '';
|
||||
$this->customerChosen(null);
|
||||
|
||||
$this->js("document.getElementById('customer-search')?.focus()");
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the customer changes; null when it was cleared.
|
||||
*/
|
||||
protected function customerChosen(?int $customerId): void {}
|
||||
|
||||
private function useCustomer(int $customerId, string $name): void
|
||||
{
|
||||
$changed = (string) $customerId !== $this->form->customer_id;
|
||||
|
||||
$this->form->customer_id = (string) $customerId;
|
||||
$this->customerName = $name;
|
||||
$this->customerSearch = '';
|
||||
$this->resetErrorBag(['customerSearch', 'form.customer_id']);
|
||||
|
||||
if ($changed) {
|
||||
$this->customerChosen($customerId);
|
||||
}
|
||||
|
||||
$this->js("document.getElementById('change-customer')?.focus()");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Jobs\Presentation\Livewire\Forms;
|
||||
|
||||
use App\Modules\Jobs\Application\DTOs\CustomerJobData;
|
||||
use App\Modules\Jobs\Domain\Enums\JobKind;
|
||||
use App\Modules\Jobs\Domain\Enums\JobStatus;
|
||||
use App\Modules\Jobs\Domain\Enums\Priority;
|
||||
use App\Modules\Jobs\Domain\Exceptions\InvalidJobName;
|
||||
use App\Modules\Jobs\Domain\Exceptions\InvalidJobReference;
|
||||
use App\Modules\Jobs\Domain\Exceptions\ServiceUnitRequired;
|
||||
use App\Modules\Shared\Domain\Exceptions\DomainException;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Livewire\Form;
|
||||
|
||||
/**
|
||||
* Quick job intake on a phone: only what is needed to open a job (spec 6).
|
||||
* Everything else gets the defaults and is filled in later.
|
||||
*/
|
||||
class QuickJobForm extends Form
|
||||
{
|
||||
public string $customer_id = '';
|
||||
|
||||
public string $name = '';
|
||||
|
||||
public string $description = '';
|
||||
|
||||
public string $service_unit_id = '';
|
||||
|
||||
public string $responsible_user_id = '';
|
||||
|
||||
public string $status = JobStatus::Tentative->value;
|
||||
|
||||
public function toData(): CustomerJobData
|
||||
{
|
||||
$this->validate();
|
||||
|
||||
return new CustomerJobData(
|
||||
name: $this->name,
|
||||
customerId: (int) $this->customer_id,
|
||||
serviceUnitIds: [(int) $this->service_unit_id],
|
||||
responsibleUserId: (int) $this->responsible_user_id,
|
||||
kind: JobKind::OneOff->value,
|
||||
status: $this->status,
|
||||
priority: Priority::Normal->value,
|
||||
description: trim($this->description) === '' ? null : $this->description,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Empties the form for the next job; responsible person and status stay.
|
||||
*/
|
||||
public function clearForNextJob(): void
|
||||
{
|
||||
$this->reset('customer_id', 'name', 'description', 'service_unit_id');
|
||||
$this->resetErrorBag();
|
||||
}
|
||||
|
||||
public function showDomainError(DomainException $exception): void
|
||||
{
|
||||
[$field, $key] = match (true) {
|
||||
$exception instanceof InvalidJobName => ['name', 'jobs.errors.invalid_name'],
|
||||
$exception instanceof ServiceUnitRequired => ['service_unit_id', 'jobs.errors.service_units_required'],
|
||||
$exception instanceof InvalidJobReference => [match ($exception->field) {
|
||||
'customer' => 'customer_id',
|
||||
'service_units' => 'service_unit_id',
|
||||
default => 'responsible_user_id',
|
||||
}, 'jobs.errors.invalid_reference'],
|
||||
default => throw $exception,
|
||||
};
|
||||
|
||||
$this->addError($field, __($key));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, array<int, mixed>>
|
||||
*/
|
||||
protected function rules(): array
|
||||
{
|
||||
return [
|
||||
'customer_id' => ['required', 'integer'],
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'description' => ['nullable', 'string', 'max:2000'],
|
||||
'service_unit_id' => ['required', 'integer'],
|
||||
'responsible_user_id' => ['required', 'integer'],
|
||||
'status' => ['required', Rule::in([JobStatus::Tentative->value, JobStatus::Prospect->value])],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function messages(): array
|
||||
{
|
||||
return [
|
||||
'customer_id.required' => __('jobs.errors.customer_required'),
|
||||
'name.required' => __('jobs.errors.name_required'),
|
||||
'name.max' => __('jobs.errors.invalid_name'),
|
||||
'description.max' => __('jobs.errors.too_long', ['max' => 2000]),
|
||||
'service_unit_id.required' => __('jobs.quick.service_unit_required'),
|
||||
'responsible_user_id.required' => __('jobs.errors.responsible_required'),
|
||||
'status.in' => __('jobs.errors.status_not_allowed'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,6 @@ use App\Modules\Catalog\Application\Contracts\CatalogQueries;
|
||||
use App\Modules\Customers\Application\Contracts\CustomerQueries;
|
||||
use App\Modules\Customers\Application\DTOs\BillingUnitSummary;
|
||||
use App\Modules\Customers\Application\DTOs\ContactSummary;
|
||||
use App\Modules\Customers\Application\DTOs\CustomerDetailsData;
|
||||
use App\Modules\Customers\Application\DTOs\CustomerSummary;
|
||||
use App\Modules\Customers\Application\UseCases\RegisterCustomer;
|
||||
use App\Modules\Customers\Domain\Enums\CustomerType;
|
||||
use App\Modules\Jobs\Application\Contracts\CustomerJobQueries;
|
||||
use App\Modules\Jobs\Application\DTOs\CustomerJobDetails;
|
||||
use App\Modules\Jobs\Application\UseCases\CreateCustomerJob;
|
||||
@@ -17,6 +13,7 @@ use App\Modules\Jobs\Domain\Enums\JobStatus;
|
||||
use App\Modules\Jobs\Domain\Enums\PaymentBasis;
|
||||
use App\Modules\Jobs\Domain\Enums\Priority;
|
||||
use App\Modules\Jobs\Domain\Exceptions\CustomerJobNotFound;
|
||||
use App\Modules\Jobs\Presentation\Livewire\Concerns\PicksCustomer;
|
||||
use App\Modules\Jobs\Presentation\Livewire\Forms\JobForm;
|
||||
use App\Modules\Shared\Domain\Exceptions\DomainException;
|
||||
use App\Modules\Users\Application\Contracts\UserAccountQueries;
|
||||
@@ -32,15 +29,14 @@ use Livewire\Component;
|
||||
*/
|
||||
new class extends Component
|
||||
{
|
||||
use PicksCustomer;
|
||||
|
||||
#[Locked]
|
||||
public ?int $jobId = null;
|
||||
|
||||
#[Locked]
|
||||
public string $jobNumber = '';
|
||||
|
||||
#[Locked]
|
||||
public string $customerName = '';
|
||||
|
||||
/**
|
||||
* The status stored before this edit: always offered, even when the
|
||||
* user could not set it themselves.
|
||||
@@ -50,12 +46,8 @@ new class extends Component
|
||||
|
||||
public JobForm $form;
|
||||
|
||||
public string $customerSearch = '';
|
||||
|
||||
public string $newTag = '';
|
||||
|
||||
public string $statusMessage = '';
|
||||
|
||||
public function mount(CustomerJobQueries $jobQueries, ?int $job = null): void
|
||||
{
|
||||
$this->authorize('jobs.manage');
|
||||
@@ -77,17 +69,6 @@ new class extends Component
|
||||
$this->form->fillFromDetails($details);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<CustomerSummary>
|
||||
*/
|
||||
#[Computed]
|
||||
public function customerResults(): array
|
||||
{
|
||||
$term = trim($this->customerSearch);
|
||||
|
||||
return mb_strlen($term) < 2 ? [] : app(CustomerQueries::class)->search($term, 8);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<array{value: int, label: string}>
|
||||
*/
|
||||
@@ -162,49 +143,6 @@ new class extends Component
|
||||
return array_values(array_diff(app(CustomerJobQueries::class)->tagSuggestions($this->newTag), $this->form->tags));
|
||||
}
|
||||
|
||||
public function selectCustomer(int $customerId): void
|
||||
{
|
||||
$this->authorize('jobs.manage');
|
||||
|
||||
$customer = app(CustomerQueries::class)->findSummary($customerId);
|
||||
|
||||
if ($customer === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->useCustomer($customer->id, $customer->name);
|
||||
}
|
||||
|
||||
public function createCustomer(RegisterCustomer $registerCustomer): void
|
||||
{
|
||||
$this->authorize('jobs.manage');
|
||||
$this->authorize('customers.use');
|
||||
|
||||
$name = trim($this->customerSearch);
|
||||
|
||||
try {
|
||||
$customerId = $registerCustomer->execute(new CustomerDetailsData($name, CustomerType::Company));
|
||||
} catch (DomainException) {
|
||||
$this->addError('customerSearch', __('customers.errors.invalid_name'));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->useCustomer($customerId, $name);
|
||||
$this->statusMessage = __('jobs.customer_picker.created', ['name' => $name]);
|
||||
}
|
||||
|
||||
public function clearCustomer(): void
|
||||
{
|
||||
$this->form->customer_id = '';
|
||||
$this->form->customer_contact_id = '';
|
||||
$this->form->billing_unit_id = '';
|
||||
$this->customerName = '';
|
||||
$this->statusMessage = '';
|
||||
|
||||
$this->js("document.getElementById('customer-search')?.focus()");
|
||||
}
|
||||
|
||||
public function addTag(): void
|
||||
{
|
||||
$tag = trim(preg_replace('/\s+/u', ' ', $this->newTag) ?? '');
|
||||
@@ -317,19 +255,13 @@ new class extends Component
|
||||
return true;
|
||||
}
|
||||
|
||||
private function useCustomer(int $customerId, string $name): void
|
||||
/**
|
||||
* A contact or billing unit of another customer no longer fits.
|
||||
*/
|
||||
protected function customerChosen(?int $customerId): void
|
||||
{
|
||||
if ((string) $customerId !== $this->form->customer_id) {
|
||||
$this->form->customer_contact_id = '';
|
||||
$this->form->billing_unit_id = '';
|
||||
}
|
||||
|
||||
$this->form->customer_id = (string) $customerId;
|
||||
$this->customerName = $name;
|
||||
$this->customerSearch = '';
|
||||
$this->resetErrorBag(['customerSearch', 'form.customer_id']);
|
||||
|
||||
$this->js("document.getElementById('change-customer')?.focus()");
|
||||
$this->form->customer_contact_id = '';
|
||||
$this->form->billing_unit_id = '';
|
||||
}
|
||||
};
|
||||
?>
|
||||
@@ -354,74 +286,12 @@ new class extends Component
|
||||
|
||||
<x-input wire:model="form.name" :label="__('jobs.fields.name')" autocomplete="off" required />
|
||||
|
||||
{{-- Customer: search field and results as buttons, or the chosen customer. --}}
|
||||
<div class="space-y-2">
|
||||
@if ($form->customer_id !== '')
|
||||
<p class="text-sm font-semibold text-gray-700 dark:text-dark-300">{{ __('jobs.fields.customer') }}</p>
|
||||
<div class="flex flex-wrap items-center gap-3">
|
||||
<span class="font-medium">{{ $customerName }}</span>
|
||||
<x-button
|
||||
id="change-customer"
|
||||
wire:click="clearCustomer"
|
||||
subtle
|
||||
color="black"
|
||||
sm
|
||||
:text="__('jobs.customer_picker.change')"
|
||||
:aria-label="__('jobs.customer_picker.change').': '.$customerName"
|
||||
/>
|
||||
</div>
|
||||
@else
|
||||
<x-input
|
||||
id="customer-search"
|
||||
wire:model.live.debounce.300ms="customerSearch"
|
||||
type="search"
|
||||
icon="magnifying-glass"
|
||||
:label="__('jobs.customer_picker.search')"
|
||||
:hint="__('jobs.customer_picker.search_description')"
|
||||
autocomplete="off"
|
||||
required
|
||||
/>
|
||||
|
||||
@error('form.customer_id')
|
||||
<p class="text-sm text-red-700 dark:text-red-400">{{ $message }}</p>
|
||||
@enderror
|
||||
|
||||
@if (mb_strlen(trim($customerSearch)) >= 2)
|
||||
<p role="status" aria-live="polite" class="text-sm text-zinc-600 dark:text-zinc-300">
|
||||
{{ trans_choice('jobs.customer_picker.results', count($this->customerResults), ['count' => count($this->customerResults)]) }}
|
||||
</p>
|
||||
|
||||
<ul class="space-y-1">
|
||||
@foreach ($this->customerResults as $customer)
|
||||
<li wire:key="customer-result-{{ $customer->id }}">
|
||||
<button
|
||||
type="button"
|
||||
wire:click="selectCustomer({{ $customer->id }})"
|
||||
class="w-full rounded-md px-3 py-2 text-left text-sm hover:bg-zinc-100 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-700 dark:hover:bg-zinc-700"
|
||||
aria-label="{{ __('jobs.customer_picker.choose', ['name' => $customer->name]) }}"
|
||||
>
|
||||
<span class="font-medium">{{ $customer->name }}</span>
|
||||
@if ($customer->businessId !== null)
|
||||
<span class="text-zinc-600 dark:text-zinc-300">{{ $customer->businessId }}</span>
|
||||
@endif
|
||||
</button>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
|
||||
@can('customers.use')
|
||||
<x-button
|
||||
wire:click="createCustomer"
|
||||
subtle
|
||||
color="black"
|
||||
sm
|
||||
icon="plus"
|
||||
:text="__('jobs.customer_picker.create', ['name' => trim($customerSearch)])"
|
||||
/>
|
||||
@endcan
|
||||
@endif
|
||||
@endif
|
||||
</div>
|
||||
<x-jobs.customer-picker
|
||||
:customer-id="$form->customer_id"
|
||||
:customer-name="$customerName"
|
||||
:search="$customerSearch"
|
||||
:results="$this->customerResults"
|
||||
/>
|
||||
|
||||
<x-textarea wire:model="form.description" :label="__('jobs.fields.description')" resize-auto />
|
||||
|
||||
|
||||
@@ -102,7 +102,10 @@ new class extends Component
|
||||
<h1 class="text-2xl font-semibold">{{ __('jobs.title') }}</h1>
|
||||
|
||||
@can('jobs.manage')
|
||||
<x-button :href="route('jobs.create')" wire:navigate icon="plus" :text="__('jobs.new')" />
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<x-button :href="route('jobs.quick')" wire:navigate subtle color="black" icon="bolt" :text="__('jobs.quick.link')" />
|
||||
<x-button :href="route('jobs.create')" wire:navigate icon="plus" :text="__('jobs.new')" />
|
||||
</div>
|
||||
@endcan
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
<?php
|
||||
|
||||
use App\Modules\Catalog\Application\Contracts\CatalogQueries;
|
||||
use App\Modules\Catalog\Application\DTOs\ServiceUnitSummary;
|
||||
use App\Modules\Jobs\Application\Contracts\CustomerJobQueries;
|
||||
use App\Modules\Jobs\Application\UseCases\CreateCustomerJob;
|
||||
use App\Modules\Jobs\Domain\Enums\JobStatus;
|
||||
use App\Modules\Jobs\Presentation\Livewire\Concerns\PicksCustomer;
|
||||
use App\Modules\Jobs\Presentation\Livewire\Forms\QuickJobForm;
|
||||
use App\Modules\Shared\Domain\Exceptions\DomainException;
|
||||
use App\Modules\Users\Application\Contracts\UserAccountQueries;
|
||||
use App\Modules\Users\Application\DTOs\UserOption;
|
||||
use App\Modules\Users\Domain\Enums\Role;
|
||||
use Livewire\Attributes\Computed;
|
||||
use Livewire\Attributes\Locked;
|
||||
use Livewire\Component;
|
||||
|
||||
/**
|
||||
* Quick job intake (pikavastaanotto), made for phones: customer, name,
|
||||
* short description, service unit and responsible person. The page stays
|
||||
* open for the next job and links to the one just created.
|
||||
*/
|
||||
new class extends Component
|
||||
{
|
||||
use PicksCustomer;
|
||||
|
||||
public QuickJobForm $form;
|
||||
|
||||
/**
|
||||
* The job created last on this page, shown with links to it.
|
||||
*/
|
||||
#[Locked]
|
||||
public ?int $createdJobId = null;
|
||||
|
||||
#[Locked]
|
||||
public string $createdMessage = '';
|
||||
|
||||
#[Locked]
|
||||
public string $createdNumber = '';
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
$this->authorize('jobs.manage');
|
||||
|
||||
$this->form->responsible_user_id = (string) auth()->id();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<ServiceUnitSummary>
|
||||
*/
|
||||
#[Computed]
|
||||
public function serviceUnits(): array
|
||||
{
|
||||
return app(CatalogQueries::class)->activeServiceUnits();
|
||||
}
|
||||
|
||||
/**
|
||||
* Users who can be responsible for a job (not subcontractors).
|
||||
*
|
||||
* @return list<UserOption>
|
||||
*/
|
||||
#[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'));
|
||||
}
|
||||
};
|
||||
?>
|
||||
|
||||
<div class="mx-auto max-w-lg space-y-6 p-4 sm:p-6">
|
||||
<div class="space-y-1">
|
||||
<h1 class="text-2xl font-semibold">{{ __('jobs.quick.title') }}</h1>
|
||||
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('jobs.quick.intro') }}</p>
|
||||
</div>
|
||||
|
||||
<div id="quick-created" tabindex="-1" role="status" aria-live="polite" class="focus:outline-none">
|
||||
@if ($createdJobId !== null)
|
||||
<div class="space-y-2 rounded-lg border border-green-700 bg-green-50 p-4 text-sm text-green-900 dark:border-green-500 dark:bg-green-950 dark:text-green-100">
|
||||
<p class="flex items-start gap-2 font-medium">
|
||||
<x-icon name="check-circle" class="size-5 shrink-0" aria-hidden="true" />
|
||||
{{ $createdMessage }}
|
||||
</p>
|
||||
<p class="flex flex-wrap gap-x-4 gap-y-1">
|
||||
<x-link :href="route('jobs.show', $createdJobId)" navigate>{{ __('jobs.quick.open', ['number' => $createdNumber]) }}</x-link>
|
||||
<x-link :href="route('jobs.edit', $createdJobId)" navigate>{{ __('jobs.quick.complete') }}</x-link>
|
||||
</p>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<p role="status" aria-live="polite" class="text-sm">{{ $statusMessage }}</p>
|
||||
|
||||
<form wire:submit="save" class="space-y-6" novalidate>
|
||||
<x-jobs.customer-picker
|
||||
:customer-id="$form->customer_id"
|
||||
:customer-name="$customerName"
|
||||
:search="$customerSearch"
|
||||
:results="$this->customerResults"
|
||||
/>
|
||||
|
||||
<x-input wire:model="form.name" :label="__('jobs.fields.name')" autocomplete="off" required />
|
||||
|
||||
<x-textarea wire:model="form.description" :label="__('jobs.quick.description')" rows="3" />
|
||||
|
||||
{{-- TallStackUI's native select does not tie its label to the control, so aria-label names it. --}}
|
||||
<x-select.native wire:model="form.service_unit_id" :label="__('jobs.quick.service_unit')" :aria-label="__('jobs.quick.service_unit')" required>
|
||||
<option value="">{{ __('jobs.fields.none_selected') }}</option>
|
||||
@foreach ($this->serviceUnits as $unit)
|
||||
<option value="{{ $unit->id }}">{{ $unit->name }}</option>
|
||||
@endforeach
|
||||
</x-select.native>
|
||||
|
||||
<x-select.native wire:model="form.responsible_user_id" :label="__('jobs.fields.responsible_user')" :aria-label="__('jobs.fields.responsible_user')" required>
|
||||
<option value="">{{ __('jobs.fields.none_selected') }}</option>
|
||||
@foreach ($this->staff as $user)
|
||||
<option value="{{ $user->id }}">{{ $user->name }}</option>
|
||||
@endforeach
|
||||
</x-select.native>
|
||||
|
||||
<x-radio.group
|
||||
wire:model="form.status"
|
||||
:label="__('jobs.fields.status')"
|
||||
:options="[
|
||||
['label' => __('jobs.statuses.'.JobStatus::Tentative->value), 'value' => JobStatus::Tentative->value],
|
||||
['label' => __('jobs.statuses.'.JobStatus::Prospect->value), 'value' => JobStatus::Prospect->value],
|
||||
]"
|
||||
/>
|
||||
|
||||
<x-button submit lg class="w-full" :text="__('jobs.quick.save')" />
|
||||
</form>
|
||||
</div>
|
||||
Reference in New Issue
Block a user