authorize('jobs.view'); } public function updated(string $property): void { if (in_array($property, ['search', 'status', 'priority', 'serviceUnit', 'mine', 'archived'], true)) { $this->resetPage(); } } public function isSubcontractor(): bool { return auth()->user()?->role === Role::Subcontractor; } /** * @return LengthAwarePaginator */ #[Computed] public function jobs(): LengthAwarePaginator { $userId = (int) auth()->id(); return app(CustomerJobQueries::class)->paginate(new JobListFilter( search: $this->search, status: JobStatus::tryFrom($this->status)?->value, priority: Priority::tryFrom($this->priority)?->value, serviceUnitId: $this->serviceUnit === '' ? null : (int) $this->serviceUnit, mineForUserId: $this->mine && ! $this->isSubcontractor() ? $userId : null, onlyMemberUserId: $this->isSubcontractor() ? $userId : null, includeArchived: $this->archived, )); } /** * @return list */ public function headers(): array { return [ ['index' => 'number', 'label' => __('jobs.fields.number'), 'sortable' => false], ['index' => 'name', 'label' => __('jobs.fields.name'), 'sortable' => false], ['index' => 'customerName', 'label' => __('jobs.fields.customer'), 'sortable' => false], ['index' => 'status', 'label' => __('jobs.fields.status'), 'sortable' => false], ['index' => 'priority', 'label' => __('jobs.fields.priority'), 'sortable' => false], ['index' => 'dueOn', 'label' => __('jobs.fields.due_on'), 'sortable' => false], ['index' => 'responsibleName', 'label' => __('jobs.fields.responsible_user'), 'sortable' => false], ]; } public function render(): mixed { return $this->view()->title(__('jobs.title')); } }; ?>

{{ __('jobs.title') }}

@can('jobs.manage') @endcan
@if (session('status')) @endif @if ($this->isSubcontractor())

{{ __('jobs.list.subcontractor_note') }}

@endif
{{-- TallStackUI's native select does not tie its label to the control, so aria-label names it. --}} @foreach (JobStatus::cases() as $option) @endforeach @foreach (Priority::cases() as $option) @endforeach @foreach (app(CatalogQueries::class)->activeServiceUnits() as $unit) @endforeach
@unless ($this->isSubcontractor()) @endunless

{{ trans_choice('jobs.list.result_count', $this->jobs->total(), ['count' => $this->jobs->total()]) }} @if ($mine && ! $this->isSubcontractor()) – {{ __('jobs.list.only_mine_description') }} @endif

@if ($this->jobs->total() === 0)

{{ __('jobs.list.empty') }}

@else @interact('column_number', $job) {{ $job->number }} @endinteract @interact('column_name', $job) {{ $job->name }} @endinteract @interact('column_status', $job) {{ __('jobs.statuses.'.$job->status->value) }} @endinteract @interact('column_priority', $job) @endinteract @interact('column_dueOn', $job) @endinteract @endif