Add customer jobs with numbering, members, tags, links and history

Phase 1, item 4. New Jobs module:
- Customer jobs with the spec's fields except money (phase 2): yearly
  running numbers (2026-0001) from a locked counter row, service units,
  schedule, kind, status, priority, payment basis, estimated hours,
  PO reference, instructions, members (responsible, contact person,
  customer contact, biller, billing unit, other members), tags shared
  across jobs, and links.
- Every change is recorded field by field and shown on the job page with
  names and Finnish dates.
- References to other modules are checked through their query
  contracts: contact and billing unit must be the customer's own;
  service units and users must be in use unless already on the job.
- Job list with search, filters and "my jobs" on by default; job form
  with an accessible customer search and quick add; job page.
- Access: subcontractors see only jobs they are members of, read only;
  billing statuses for management and the job's biller; archiving for
  management.

Related changes:
- Customers: one internal customer (created by a migration) for internal
  work; contacts and billing units used by a job cannot be removed.
- Users and Catalog: batch name lookups and active user options with
  roles for other modules.
- <x-checkbox-group> component; spec and CLAUDE.md updated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-11-23 18:57:18 +02:00
co-authored by Claude Opus 5.5
parent 51b2d4a252
commit 70e107f6e2
95 changed files with 4631 additions and 26 deletions
@@ -0,0 +1,238 @@
<?php
namespace App\Modules\Jobs\Presentation\Livewire\Forms;
use App\Modules\Jobs\Application\DTOs\CustomerJobData;
use App\Modules\Jobs\Application\DTOs\CustomerJobDetails;
use App\Modules\Jobs\Application\DTOs\NamedId;
use App\Modules\Jobs\Domain\Enums\JobKind;
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\DueBeforeStart;
use App\Modules\Jobs\Domain\Exceptions\InvalidEstimatedHours;
use App\Modules\Jobs\Domain\Exceptions\InvalidJobLink;
use App\Modules\Jobs\Domain\Exceptions\InvalidJobName;
use App\Modules\Jobs\Domain\Exceptions\InvalidJobReference;
use App\Modules\Jobs\Domain\Exceptions\InvalidTag;
use App\Modules\Jobs\Domain\Exceptions\PlanEndsBeforeStart;
use App\Modules\Jobs\Domain\Exceptions\ServiceUnitRequired;
use App\Modules\Shared\Domain\Exceptions\DomainException;
use Illuminate\Validation\Rule;
use Livewire\Form;
/**
* Customer job form shared by the create and edit pages. Validates the
* shape of the input; business rules stay in the Domain.
*/
class JobForm extends Form
{
public string $name = '';
public string $description = '';
public string $customer_id = '';
/** @var list<string> */
public array $service_unit_ids = [];
public string $starts_on = '';
public string $due_on = '';
public string $planned_from = '';
public string $planned_to = '';
public string $kind = JobKind::OneOff->value;
public string $status = JobStatus::Tentative->value;
public string $priority = Priority::Normal->value;
public string $payment_basis = '';
public string $estimated_hours = '';
public string $customer_reference = '';
public string $instructions = '';
public string $responsible_user_id = '';
public string $contact_user_id = '';
public string $customer_contact_id = '';
public string $biller_user_id = '';
public string $billing_unit_id = '';
/** @var list<string> */
public array $member_user_ids = [];
/** @var list<string> */
public array $tags = [];
/** @var list<array{title: string, url: string}> */
public array $links = [];
public function fillFromDetails(CustomerJobDetails $job): void
{
$this->name = $job->name;
$this->description = $job->description ?? '';
$this->customer_id = (string) $job->customer->id;
$this->service_unit_ids = array_map(fn (NamedId $unit): string => (string) $unit->id, $job->serviceUnits);
$this->starts_on = $job->startsOn ?? '';
$this->due_on = $job->dueOn ?? '';
$this->planned_from = $job->plannedFrom ?? '';
$this->planned_to = $job->plannedTo ?? '';
$this->kind = $job->kind->value;
$this->status = $job->status->value;
$this->priority = $job->priority->value;
$this->payment_basis = $job->paymentBasis->value ?? '';
$this->estimated_hours = $job->estimatedHours ?? '';
$this->customer_reference = $job->customerReference ?? '';
$this->instructions = $job->instructions ?? '';
$this->responsible_user_id = (string) $job->responsible->id;
$this->contact_user_id = (string) ($job->contactUser->id ?? '');
$this->customer_contact_id = (string) ($job->customerContact->id ?? '');
$this->biller_user_id = (string) ($job->biller->id ?? '');
$this->billing_unit_id = (string) ($job->billingUnit->id ?? '');
$this->member_user_ids = array_map(fn (NamedId $member): string => (string) $member->id, $job->members);
$this->tags = $job->tags;
$this->links = $job->links;
}
public function toData(): CustomerJobData
{
$this->validate();
$id = fn (string $value): ?int => $value === '' ? null : (int) $value;
$text = fn (string $value): ?string => trim($value) === '' ? null : $value;
return new CustomerJobData(
name: $this->name,
customerId: (int) $this->customer_id,
serviceUnitIds: array_map('intval', $this->service_unit_ids),
responsibleUserId: (int) $this->responsible_user_id,
kind: $this->kind,
status: $this->status,
priority: $this->priority,
description: $text($this->description),
startsOn: $text($this->starts_on),
dueOn: $text($this->due_on),
plannedFrom: $text($this->planned_from),
plannedTo: $text($this->planned_to),
paymentBasis: $text($this->payment_basis),
estimatedHours: $text($this->estimated_hours),
customerReference: $text($this->customer_reference),
instructions: $text($this->instructions),
contactUserId: $id($this->contact_user_id),
customerContactId: $id($this->customer_contact_id),
billerUserId: $id($this->biller_user_id),
billingUnitId: $id($this->billing_unit_id),
memberUserIds: array_map('intval', $this->member_user_ids),
tags: $this->tags,
links: array_values(array_filter($this->links, fn (array $link): bool => trim($link['title']) !== '' || trim($link['url']) !== '')),
);
}
/**
* Shows a broken business rule as an error on the field it concerns.
*/
public function showDomainError(DomainException $exception): void
{
[$field, $key] = match (true) {
$exception instanceof InvalidJobName => ['name', 'jobs.errors.invalid_name'],
$exception instanceof ServiceUnitRequired => ['service_unit_ids', 'jobs.errors.service_units_required'],
$exception instanceof DueBeforeStart => ['due_on', 'jobs.errors.due_before_start'],
$exception instanceof PlanEndsBeforeStart => ['planned_to', 'jobs.errors.plan_ends_before_start'],
$exception instanceof InvalidEstimatedHours => ['estimated_hours', 'jobs.errors.invalid_hours'],
$exception instanceof InvalidTag => ['tags', 'jobs.errors.invalid_tag'],
$exception instanceof InvalidJobLink => ['links', 'jobs.errors.invalid_link'],
$exception instanceof InvalidJobReference => [self::referenceField($exception->field), 'jobs.errors.invalid_reference'],
default => throw $exception,
};
$this->addError($field, __($key));
}
private static function referenceField(string $field): string
{
return match ($field) {
'customer' => 'customer_id',
'service_units' => 'service_unit_ids',
'members' => 'member_user_ids',
default => $field.'_id',
};
}
/**
* @return array<string, array<int, mixed>>
*/
protected function rules(): array
{
return [
'name' => ['required', 'string', 'max:255'],
'description' => ['nullable', 'string', 'max:10000'],
'customer_id' => ['required', 'integer'],
'service_unit_ids' => ['required', 'array', 'min:1'],
'service_unit_ids.*' => ['integer'],
'starts_on' => ['nullable', 'date_format:Y-m-d'],
'due_on' => ['nullable', 'date_format:Y-m-d'],
'planned_from' => ['nullable', 'date_format:Y-m-d'],
'planned_to' => ['nullable', 'date_format:Y-m-d'],
'kind' => ['required', Rule::enum(JobKind::class)],
'status' => ['required', Rule::enum(JobStatus::class)],
'priority' => ['required', Rule::enum(Priority::class)],
'payment_basis' => ['nullable', Rule::enum(PaymentBasis::class)],
'estimated_hours' => ['nullable', 'numeric', 'min:0', 'max:99999'],
'customer_reference' => ['nullable', 'string', 'max:255'],
'instructions' => ['nullable', 'string', 'max:10000'],
'responsible_user_id' => ['required', 'integer'],
'contact_user_id' => ['nullable', 'integer'],
'customer_contact_id' => ['nullable', 'integer'],
'biller_user_id' => ['nullable', 'integer'],
'billing_unit_id' => ['nullable', 'integer'],
'member_user_ids' => ['array'],
'member_user_ids.*' => ['integer'],
'tags' => ['array', 'max:30'],
'tags.*' => ['string', 'max:50'],
'links' => ['array', 'max:30'],
'links.*.title' => ['nullable', 'required_with:links.*.url', 'string', 'max:255'],
'links.*.url' => ['nullable', 'required_with:links.*.title', 'url:http,https', 'max:2000'],
];
}
/**
* @return array<string, string>
*/
protected function messages(): array
{
return [
'name.required' => __('jobs.errors.name_required'),
'name.max' => __('jobs.errors.invalid_name'),
'description.max' => __('jobs.errors.too_long', ['max' => 10000]),
'customer_id.required' => __('jobs.errors.customer_required'),
'customer_id.integer' => __('jobs.errors.customer_required'),
'service_unit_ids.required' => __('jobs.errors.service_units_required'),
'service_unit_ids.min' => __('jobs.errors.service_units_required'),
'*.date_format' => __('jobs.errors.invalid_date'),
'starts_on.date_format' => __('jobs.errors.invalid_date'),
'due_on.date_format' => __('jobs.errors.invalid_date'),
'planned_from.date_format' => __('jobs.errors.invalid_date'),
'planned_to.date_format' => __('jobs.errors.invalid_date'),
'estimated_hours.numeric' => __('jobs.errors.invalid_hours'),
'estimated_hours.min' => __('jobs.errors.invalid_hours'),
'estimated_hours.max' => __('jobs.errors.invalid_hours'),
'customer_reference.max' => __('jobs.errors.too_long', ['max' => 255]),
'instructions.max' => __('jobs.errors.too_long', ['max' => 10000]),
'responsible_user_id.required' => __('jobs.errors.responsible_required'),
'tags.*.max' => __('jobs.errors.invalid_tag'),
'links.*.title.required_with' => __('jobs.errors.invalid_link'),
'links.*.url.required_with' => __('jobs.errors.invalid_link'),
'links.*.url.url' => __('jobs.errors.invalid_link'),
];
}
}
@@ -0,0 +1,647 @@
<?php
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;
use App\Modules\Jobs\Application\UseCases\UpdateCustomerJob;
use App\Modules\Jobs\Domain\Enums\JobKind;
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\Forms\JobForm;
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 Illuminate\Support\Facades\Gate;
use Livewire\Attributes\Computed;
use Livewire\Attributes\Locked;
use Livewire\Component;
/**
* Create page (no {job}) and edit page (with {job}) of a customer job.
*/
new class extends Component
{
#[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.
*/
#[Locked]
public ?string $storedStatus = null;
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');
if ($job === null) {
$this->form->responsible_user_id = (string) auth()->id();
return;
}
$details = $jobQueries->findDetails($job);
abort_if($details === null, 404);
$this->jobId = $details->id;
$this->jobNumber = $details->number;
$this->customerName = $details->customer->name;
$this->storedStatus = $details->status->value;
$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}>
*/
#[Computed]
public function serviceUnitOptions(): array
{
$catalog = app(CatalogQueries::class);
$options = [];
foreach ($catalog->activeServiceUnits() as $unit) {
$options[$unit->id] = ['value' => $unit->id, 'label' => $unit->name];
}
// Units already on the job stay visible after being taken out of use.
foreach ($this->form->service_unit_ids as $id) {
if (! isset($options[(int) $id]) && ($unit = $catalog->findServiceUnit((int) $id)) !== null) {
$options[$unit->id] = ['value' => $unit->id, 'label' => $unit->name, 'note' => __('catalog.inactive')];
}
}
return array_values($options);
}
/**
* @return list<UserOption>
*/
#[Computed]
public function users(): array
{
return app(UserAccountQueries::class)->activeUserOptions();
}
/**
* @return list<ContactSummary>
*/
#[Computed]
public function contacts(): array
{
return $this->form->customer_id === '' ? [] : app(CustomerQueries::class)->contactsOf((int) $this->form->customer_id);
}
/**
* @return list<BillingUnitSummary>
*/
#[Computed]
public function billingUnits(): array
{
return $this->form->customer_id === '' ? [] : app(CustomerQueries::class)->billingUnitsOf((int) $this->form->customer_id);
}
/**
* Statuses this user may choose: billing statuses for management and the
* job's biller, archived for management, and always the stored one.
*
* @return list<JobStatus>
*/
#[Computed]
public function statusOptions(): array
{
return array_values(array_filter(
JobStatus::cases(),
fn (JobStatus $status): bool => $status->value === $this->storedStatus || $this->maySetStatus($status),
));
}
/**
* @return list<string>
*/
#[Computed]
public function tagSuggestions(): array
{
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) ?? '');
if ($tag === '' || mb_strlen($tag) > 50) {
$this->addError('newTag', __('jobs.errors.invalid_tag'));
return;
}
$taken = array_map('mb_strtolower', $this->form->tags);
if (! in_array(mb_strtolower($tag), $taken, true)) {
$this->form->tags[] = $tag;
}
$this->newTag = '';
$this->resetErrorBag('newTag');
$this->statusMessage = __('jobs.tags.added', ['tag' => $tag]);
}
public function removeTag(int $index): void
{
$tag = $this->form->tags[$index] ?? null;
if ($tag === null) {
return;
}
unset($this->form->tags[$index]);
$this->form->tags = array_values($this->form->tags);
$this->statusMessage = __('jobs.tags.removed', ['tag' => $tag]);
$this->js("document.getElementById('new-tag')?.focus()");
}
public function addLink(): void
{
$this->form->links[] = ['title' => '', 'url' => ''];
$index = count($this->form->links) - 1;
$this->js("document.getElementById('link-title-{$index}')?.focus()");
}
public function removeLink(int $index): void
{
unset($this->form->links[$index]);
$this->form->links = array_values($this->form->links);
$this->js("document.getElementById('add-link')?.focus()");
}
public function save(CreateCustomerJob $createJob, UpdateCustomerJob $updateJob, CustomerJobQueries $jobQueries): void
{
$this->authorize('jobs.manage');
$status = JobStatus::tryFrom($this->form->status);
if ($status !== null && $status->value !== $this->storedStatus && ! $this->maySetStatus($status)) {
$this->addError('form.status', __('jobs.errors.status_not_allowed'));
return;
}
$data = $this->form->toData();
try {
if ($this->jobId === null) {
$jobId = $createJob->execute($data, (int) auth()->id());
$number = $jobQueries->findDetails($jobId)->number ?? '';
session()->flash('status', __('jobs.created', ['number' => $number, 'name' => trim($data->name)]));
} else {
$updateJob->execute($this->jobId, $data, (int) auth()->id());
$jobId = $this->jobId;
session()->flash('status', __('jobs.updated', ['number' => $this->jobNumber]));
}
} catch (CustomerJobNotFound) {
abort(404);
} catch (DomainException $exception) {
$this->form->showDomainError($exception);
return;
}
$this->redirectRoute('jobs.show', $jobId, navigate: true);
}
public function heading(): string
{
return $this->jobId === null ? __('jobs.create_title') : __('jobs.edit_title').' '.$this->jobNumber;
}
public function render(): mixed
{
return $this->view()->title($this->heading());
}
private function maySetStatus(JobStatus $status): bool
{
if ($status === JobStatus::Archived) {
return Gate::allows('jobs.archive');
}
if ($status->isBillingStatus()) {
$details = $this->jobId === null ? null : app(CustomerJobQueries::class)->findDetails($this->jobId);
return Gate::allows('jobs.set-billing-status', [$details]);
}
return true;
}
private function useCustomer(int $customerId, string $name): 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()");
}
};
?>
@php
$userOptions = collect($this->users)->map(fn ($user) => [
'value' => $user->id,
'label' => $user->name,
'note' => $user->role === Role::Subcontractor ? __('users.roles.subcontractor') : null,
])->all();
$staffOptions = collect($this->users)->reject(fn ($user) => $user->role === Role::Subcontractor);
@endphp
<div class="mx-auto max-w-3xl space-y-6 p-4 sm:p-6">
<h1 class="text-2xl font-semibold">{{ $this->heading() }}</h1>
<p role="status" aria-live="polite" class="text-sm">{{ $statusMessage }}</p>
<form wire:submit="save" class="space-y-8" novalidate>
<fieldset class="space-y-6">
<legend class="text-lg font-semibold">{{ __('jobs.sections.basics') }}</legend>
<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-textarea wire:model="form.description" :label="__('jobs.fields.description')" resize-auto />
<x-checkbox-group
:legend="__('jobs.fields.service_units')"
model="form.service_unit_ids"
:options="$this->serviceUnitOptions"
/>
</fieldset>
<fieldset class="space-y-6">
<legend class="text-lg font-semibold">{{ __('jobs.sections.schedule') }}</legend>
<div class="grid gap-6 sm:grid-cols-2">
<x-input wire:model="form.starts_on" type="date" :label="__('jobs.fields.starts_on')" />
<x-input wire:model="form.due_on" type="date" :label="__('jobs.fields.due_on')" />
<x-input wire:model="form.planned_from" type="date" :label="__('jobs.fields.planned_from')" />
<x-input wire:model="form.planned_to" type="date" :label="__('jobs.fields.planned_to')" />
</div>
</fieldset>
<fieldset class="space-y-6">
<legend class="text-lg font-semibold">{{ __('jobs.sections.classification') }}</legend>
<div class="grid gap-6 sm:grid-cols-2">
{{-- TallStackUI's native select does not tie its label to the control, so aria-label names it. --}}
<x-select.native wire:model="form.status" :label="__('jobs.fields.status')" :aria-label="__('jobs.fields.status')">
@foreach ($this->statusOptions as $status)
<option value="{{ $status->value }}">{{ __('jobs.statuses.'.$status->value) }}</option>
@endforeach
</x-select.native>
<x-select.native wire:model="form.priority" :label="__('jobs.fields.priority')" :aria-label="__('jobs.fields.priority')">
@foreach (Priority::cases() as $priority)
<option value="{{ $priority->value }}">{{ __('jobs.priorities.'.$priority->value) }}</option>
@endforeach
</x-select.native>
<x-select.native wire:model="form.kind" :label="__('jobs.fields.kind')" :aria-label="__('jobs.fields.kind')">
@foreach (JobKind::cases() as $kind)
<option value="{{ $kind->value }}">{{ __('jobs.kinds.'.$kind->value) }}</option>
@endforeach
</x-select.native>
<x-select.native wire:model="form.payment_basis" :label="__('jobs.fields.payment_basis')" :aria-label="__('jobs.fields.payment_basis')">
<option value="">{{ __('jobs.fields.no_payment_basis') }}</option>
@foreach (PaymentBasis::cases() as $basis)
<option value="{{ $basis->value }}">{{ __('jobs.payment_bases.'.$basis->value) }}</option>
@endforeach
</x-select.native>
<x-input
wire:model="form.estimated_hours"
type="number"
step="0.25"
min="0"
inputmode="decimal"
:label="__('jobs.fields.estimated_hours')"
:hint="__('jobs.fields.estimated_hours_description')"
/>
</div>
</fieldset>
<fieldset class="space-y-6">
<legend class="text-lg font-semibold">{{ __('jobs.sections.members') }}</legend>
<div class="grid gap-6 sm:grid-cols-2">
<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 ($staffOptions as $user)
<option value="{{ $user->id }}">{{ $user->name }}</option>
@endforeach
</x-select.native>
<x-select.native wire:model="form.contact_user_id" :label="__('jobs.fields.contact_user')" :aria-label="__('jobs.fields.contact_user')" :hint="__('jobs.fields.contact_user_description')">
<option value="">{{ __('jobs.fields.none_selected') }}</option>
@foreach ($staffOptions as $user)
<option value="{{ $user->id }}">{{ $user->name }}</option>
@endforeach
</x-select.native>
<x-select.native wire:model="form.biller_user_id" :label="__('jobs.fields.biller_user')" :aria-label="__('jobs.fields.biller_user')" :hint="__('jobs.fields.biller_user_description')">
<option value="">{{ __('jobs.fields.none_selected') }}</option>
@foreach ($staffOptions as $user)
<option value="{{ $user->id }}">{{ $user->name }}</option>
@endforeach
</x-select.native>
<x-select.native
wire:model="form.customer_contact_id"
:label="__('jobs.fields.customer_contact')"
:aria-label="__('jobs.fields.customer_contact')"
:hint="$form->customer_id === '' ? __('jobs.customer_picker.choose_customer_first') : null"
:disabled="$form->customer_id === ''"
>
<option value="">{{ __('jobs.fields.none_selected') }}</option>
@foreach ($this->contacts as $contact)
<option wire:key="contact-{{ $contact->id }}" value="{{ $contact->id }}">{{ $contact->name }}</option>
@endforeach
</x-select.native>
<x-select.native
wire:model="form.billing_unit_id"
:label="__('jobs.fields.billing_unit')"
:aria-label="__('jobs.fields.billing_unit')"
:hint="$form->customer_id === '' ? __('jobs.customer_picker.choose_customer_first') : null"
:disabled="$form->customer_id === ''"
>
<option value="">{{ __('jobs.fields.none_selected') }}</option>
@foreach ($this->billingUnits as $billingUnit)
<option wire:key="billing-unit-{{ $billingUnit->id }}" value="{{ $billingUnit->id }}">{{ $billingUnit->name }}</option>
@endforeach
</x-select.native>
</div>
<x-checkbox-group
:legend="__('jobs.fields.members')"
:hint="__('jobs.fields.members_description')"
model="form.member_user_ids"
:options="$userOptions"
/>
</fieldset>
<fieldset class="space-y-6">
<legend class="text-lg font-semibold">{{ __('jobs.sections.extra') }}</legend>
<x-input wire:model="form.customer_reference" :label="__('jobs.fields.customer_reference')" autocomplete="off" />
{{-- Tags: free text with suggestions from earlier tags, added one at a time. --}}
<div class="space-y-3">
<div class="flex flex-wrap items-end gap-3">
<div class="min-w-0 flex-1">
<x-input
id="new-tag"
wire:model.live.debounce.300ms="newTag"
wire:keydown.enter.prevent="addTag"
list="tag-suggestions"
:label="__('jobs.tags.new')"
:hint="__('jobs.tags.new_description')"
autocomplete="off"
/>
<datalist id="tag-suggestions">
@foreach ($this->tagSuggestions as $suggestion)
<option value="{{ $suggestion }}"></option>
@endforeach
</datalist>
</div>
<x-button wire:click="addTag" subtle color="black" icon="plus" :text="__('jobs.tags.add')" />
</div>
<p id="tags-label" class="text-sm font-semibold text-gray-700 dark:text-dark-300">{{ __('jobs.fields.tags') }}</p>
@if ($form->tags === [])
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('jobs.tags.none') }}</p>
@else
<ul aria-labelledby="tags-label" class="flex flex-wrap gap-2">
@foreach ($form->tags as $index => $tag)
<li wire:key="tag-{{ $tag }}" class="inline-flex items-center gap-1 rounded-full border border-zinc-300 py-1 pr-1 pl-3 text-sm dark:border-zinc-600">
{{ $tag }}
<x-button.circle
wire:click="removeTag({{ $index }})"
subtle
color="black"
xs
icon="x-mark"
:aria-label="__('jobs.tags.remove', ['tag' => $tag])"
/>
</li>
@endforeach
</ul>
@endif
@error('form.tags')
<p class="text-sm text-red-700 dark:text-red-400">{{ $message }}</p>
@enderror
</div>
{{-- Links: title and address per row. --}}
<div class="space-y-3">
<p class="text-sm font-semibold text-gray-700 dark:text-dark-300">{{ __('jobs.fields.links') }}</p>
@if ($form->links === [])
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('jobs.links.none') }}</p>
@endif
@foreach ($form->links as $index => $link)
<fieldset wire:key="link-{{ $index }}" class="space-y-3 rounded-lg border border-zinc-200 p-3 dark:border-zinc-700">
<legend class="px-1 text-sm font-medium">{{ __('jobs.links.link_number', ['number' => $index + 1]) }}</legend>
<div class="grid gap-3 sm:grid-cols-2">
<x-input id="link-title-{{ $index }}" wire:model="form.links.{{ $index }}.title" :label="__('jobs.links.title')" autocomplete="off" />
<x-input id="link-url-{{ $index }}" wire:model="form.links.{{ $index }}.url" type="url" :label="__('jobs.links.url')" :hint="__('jobs.links.url_description')" autocomplete="off" />
</div>
<x-button
wire:click="removeLink({{ $index }})"
subtle
color="black"
sm
icon="trash"
:text="__('jobs.links.remove', ['number' => $index + 1])"
/>
</fieldset>
@endforeach
<x-button id="add-link" wire:click="addLink" subtle color="black" sm icon="plus" :text="__('jobs.links.add')" />
@error('form.links')
<p class="text-sm text-red-700 dark:text-red-400">{{ $message }}</p>
@enderror
</div>
<x-textarea wire:model="form.instructions" :label="__('jobs.fields.instructions')" :hint="__('jobs.fields.instructions_description')" resize-auto />
</fieldset>
<div class="flex flex-wrap gap-3">
<x-button submit :text="__('jobs.save')" />
<x-button
:href="$jobId === null ? route('jobs.index') : route('jobs.show', $jobId)"
wire:navigate
subtle
color="black"
:text="__('jobs.cancel')"
/>
</div>
</form>
</div>
@@ -0,0 +1,190 @@
<?php
use App\Modules\Catalog\Application\Contracts\CatalogQueries;
use App\Modules\Jobs\Application\Contracts\CustomerJobQueries;
use App\Modules\Jobs\Application\DTOs\CustomerJobSummary;
use App\Modules\Jobs\Application\DTOs\JobListFilter;
use App\Modules\Jobs\Domain\Enums\JobStatus;
use App\Modules\Jobs\Domain\Enums\Priority;
use App\Modules\Users\Domain\Enums\Role;
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
use Livewire\Attributes\Computed;
use Livewire\Attributes\Url;
use Livewire\Component;
use Livewire\WithPagination;
/**
* The customer job list: search, filters and "my jobs" on by default.
*/
new class extends Component
{
use WithPagination;
#[Url(as: 'q', except: '')]
public string $search = '';
#[Url(except: '')]
public string $status = '';
#[Url(except: '')]
public string $priority = '';
#[Url(as: 'unit', except: '')]
public string $serviceUnit = '';
#[Url(except: true)]
public bool $mine = true;
#[Url(except: false)]
public bool $archived = false;
public function mount(): void
{
$this->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<int, CustomerJobSummary>
*/
#[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<array{index: string, label: string, sortable: bool}>
*/
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'));
}
};
?>
<div class="mx-auto max-w-7xl space-y-6 p-4 sm:p-6">
<div class="flex flex-wrap items-center justify-between gap-4">
<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')" />
@endcan
</div>
@if (session('status'))
<x-alert role="status" color="green" light icon="check-circle" :text="session('status')" />
@endif
@if ($this->isSubcontractor())
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('jobs.list.subcontractor_note') }}</p>
@endif
<div class="grid gap-4 md:grid-cols-2 xl:grid-cols-4">
<div class="md:col-span-2 xl:col-span-4">
<x-input
wire:model.live.debounce.300ms="search"
type="search"
icon="magnifying-glass"
:label="__('jobs.list.search')"
:hint="__('jobs.list.search_description')"
/>
</div>
{{-- TallStackUI's native select does not tie its label to the control, so aria-label names it. --}}
<x-select.native wire:model.live="status" :label="__('jobs.fields.status')" :aria-label="__('jobs.fields.status')">
<option value="">{{ __('jobs.list.all_statuses') }}</option>
@foreach (JobStatus::cases() as $option)
<option value="{{ $option->value }}">{{ __('jobs.statuses.'.$option->value) }}</option>
@endforeach
</x-select.native>
<x-select.native wire:model.live="priority" :label="__('jobs.fields.priority')" :aria-label="__('jobs.fields.priority')">
<option value="">{{ __('jobs.list.all_priorities') }}</option>
@foreach (Priority::cases() as $option)
<option value="{{ $option->value }}">{{ __('jobs.priorities.'.$option->value) }}</option>
@endforeach
</x-select.native>
<x-select.native wire:model.live="serviceUnit" :label="__('jobs.fields.service_units')" :aria-label="__('jobs.fields.service_units')">
<option value="">{{ __('jobs.list.all_service_units') }}</option>
@foreach (app(CatalogQueries::class)->activeServiceUnits() as $unit)
<option value="{{ $unit->id }}">{{ $unit->name }}</option>
@endforeach
</x-select.native>
<div class="space-y-2">
@unless ($this->isSubcontractor())
<x-checkbox id="only-mine" wire:model.live="mine" :label="__('jobs.list.only_mine')" />
@endunless
<x-checkbox id="include-archived" wire:model.live="archived" :label="__('jobs.list.include_archived')" />
</div>
</div>
<p role="status" aria-live="polite" aria-atomic="true" class="text-sm text-zinc-600 dark:text-zinc-300">
{{ trans_choice('jobs.list.result_count', $this->jobs->total(), ['count' => $this->jobs->total()]) }}
@if ($mine && ! $this->isSubcontractor())
– {{ __('jobs.list.only_mine_description') }}
@endif
</p>
@if ($this->jobs->total() === 0)
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('jobs.list.empty') }}</p>
@else
<x-table :headers="$this->headers()" :rows="$this->jobs" paginate>
@interact('column_number', $job)
<span class="whitespace-nowrap">{{ $job->number }}</span>
@endinteract
@interact('column_name', $job)
<x-link :href="route('jobs.show', $job->id)" navigate class="font-medium">{{ $job->name }}</x-link>
@endinteract
@interact('column_status', $job)
{{ __('jobs.statuses.'.$job->status->value) }}
@endinteract
@interact('column_priority', $job)
<x-jobs.priority :priority="$job->priority" />
@endinteract
@interact('column_dueOn', $job)
<x-jobs.due-date :date="$job->dueOn" :status="$job->status" />
@endinteract
</x-table>
@endif
</div>
@@ -0,0 +1,240 @@
<?php
use App\Modules\Catalog\Application\Contracts\CatalogQueries;
use App\Modules\Customers\Application\Contracts\CustomerQueries;
use App\Modules\Jobs\Application\Contracts\CustomerJobQueries;
use App\Modules\Jobs\Application\DTOs\CustomerJobDetails;
use App\Modules\Jobs\Application\DTOs\JobChangeEntry;
use App\Modules\Users\Application\Contracts\UserAccountQueries;
use Carbon\CarbonImmutable;
use Livewire\Attributes\Computed;
use Livewire\Attributes\Locked;
use Livewire\Component;
/**
* A customer job's page: details, members, links, instructions and history.
*/
new class extends Component
{
#[Locked]
public int $jobId;
public function mount(CustomerJobQueries $jobQueries, int $job): void
{
$this->authorize('jobs.view');
abort_if($jobQueries->findDetails($job) === null, 404);
$this->authorize('jobs.view-job', $job);
$this->jobId = $job;
}
#[Computed]
public function job(): CustomerJobDetails
{
return app(CustomerJobQueries::class)->findDetails($this->jobId) ?? abort(404);
}
/**
* @return list<JobChangeEntry>
*/
#[Computed]
public function changes(): array
{
return app(CustomerJobQueries::class)->changes($this->jobId);
}
public function formatDate(?string $date): string
{
return $date === null ? __('jobs.not_set') : CarbonImmutable::parse($date)->format('j.n.Y');
}
/**
* A history value as text: names for ids, labels for enum keys,
* Finnish dates.
*/
public function historyValue(string $field, ?string $value): string
{
if ($value === null || $value === '') {
return __('jobs.not_set');
}
$ids = array_map('intval', explode(',', $value));
$named = fn (array $names): string => implode(', ', array_map(
fn (int $id): string => $names[$id] ?? __('jobs.history.unknown', ['id' => $id]),
$ids,
));
return match ($field) {
'starts_on', 'due_on', 'planned_from', 'planned_to' => $this->formatDate($value),
'kind' => __('jobs.kinds.'.$value),
'status' => __('jobs.statuses.'.$value),
'priority' => __('jobs.priorities.'.$value),
'payment_basis' => __('jobs.payment_bases.'.$value),
'customer' => $named(app(CustomerQueries::class)->namesByIds($ids)),
'service_units' => $named(app(CatalogQueries::class)->serviceUnitNames($ids)),
'responsible_user', 'contact_user', 'biller_user', 'members' => $named(app(UserAccountQueries::class)->namesByIds($ids)),
'customer_contact' => app(CustomerQueries::class)->findContact($this->job->customer->id, $ids[0])->name ?? __('jobs.history.unknown', ['id' => $ids[0]]),
'billing_unit' => app(CustomerQueries::class)->findBillingUnit($this->job->customer->id, $ids[0])->name ?? __('jobs.history.unknown', ['id' => $ids[0]]),
default => $value,
};
}
public function render(): mixed
{
return $this->view()->title($this->job->number.' '.$this->job->name);
}
};
?>
@php($job = $this->job)
<div class="mx-auto max-w-5xl space-y-8 p-4 sm:p-6">
<div class="space-y-4">
<div class="flex flex-wrap items-start justify-between gap-4">
<h1 class="text-2xl font-semibold break-words">
<span class="whitespace-nowrap">{{ $job->number }}</span> {{ $job->name }}
</h1>
@can('jobs.manage')
<x-button :href="route('jobs.edit', $job->id)" wire:navigate subtle color="black" icon="pencil" :text="__('jobs.edit')" />
@endcan
</div>
@if (session('status'))
<x-alert role="status" color="green" light icon="check-circle" :text="session('status')" />
@endif
<dl class="flex flex-wrap gap-x-8 gap-y-2 text-sm">
<div class="flex gap-2"><dt class="font-medium">{{ __('jobs.fields.status') }}:</dt><dd>{{ __('jobs.statuses.'.$job->status->value) }}</dd></div>
<div class="flex gap-2"><dt class="font-medium">{{ __('jobs.fields.priority') }}:</dt><dd><x-jobs.priority :priority="$job->priority" /></dd></div>
<div class="flex gap-2"><dt class="font-medium">{{ __('jobs.fields.due_on') }}:</dt><dd><x-jobs.due-date :date="$job->dueOn" :status="$job->status" /></dd></div>
</dl>
</div>
<section aria-labelledby="basics-heading" class="space-y-3">
<h2 id="basics-heading" class="text-xl font-semibold">{{ __('jobs.sections.basics') }}</h2>
<dl class="grid gap-x-6 gap-y-2 text-sm sm:grid-cols-[max-content_1fr]">
<dt class="font-medium">{{ __('jobs.fields.customer') }}</dt>
<dd>
@can('customers.use')
<x-link :href="route('customers.show', $job->customer->id)" navigate>{{ $job->customer->name }}</x-link>
@else
{{ $job->customer->name }}
@endcan
</dd>
<dt class="font-medium">{{ __('jobs.fields.service_units') }}</dt>
<dd>{{ collect($job->serviceUnits)->pluck('name')->join(', ') }}</dd>
<dt class="font-medium">{{ __('jobs.fields.kind') }}</dt>
<dd>{{ __('jobs.kinds.'.$job->kind->value) }}</dd>
<dt class="font-medium">{{ __('jobs.fields.payment_basis') }}</dt>
<dd>{{ $job->paymentBasis === null ? __('jobs.not_set') : __('jobs.payment_bases.'.$job->paymentBasis->value) }}</dd>
<dt class="font-medium">{{ __('jobs.fields.estimated_hours') }}</dt>
<dd>{{ $job->estimatedHours === null ? __('jobs.not_set') : str_replace('.', ',', $job->estimatedHours).' h' }}</dd>
<dt class="font-medium">{{ __('jobs.fields.customer_reference') }}</dt>
<dd class="break-words">{{ $job->customerReference ?? __('jobs.not_set') }}</dd>
<dt class="font-medium">{{ __('jobs.fields.tags') }}</dt>
<dd>{{ $job->tags === [] ? __('jobs.tags.none') : implode(', ', $job->tags) }}</dd>
<dt class="font-medium">{{ __('jobs.fields.created_at') }}</dt>
<dd>{{ CarbonImmutable::parse($job->createdAt)->format('j.n.Y H.i') }}, {{ $job->createdByName }}</dd>
</dl>
@if ($job->description !== null)
<h3 class="text-base font-semibold">{{ __('jobs.fields.description') }}</h3>
<p class="whitespace-pre-line text-sm">{{ $job->description }}</p>
@endif
</section>
<section aria-labelledby="schedule-heading" class="space-y-3">
<h2 id="schedule-heading" class="text-xl font-semibold">{{ __('jobs.sections.schedule') }}</h2>
<dl class="grid gap-x-6 gap-y-2 text-sm sm:grid-cols-[max-content_1fr]">
<dt class="font-medium">{{ __('jobs.fields.starts_on') }}</dt>
<dd>{{ $this->formatDate($job->startsOn) }}</dd>
<dt class="font-medium">{{ __('jobs.fields.due_on') }}</dt>
<dd><x-jobs.due-date :date="$job->dueOn" :status="$job->status" /></dd>
<dt class="font-medium">{{ __('jobs.fields.planned_from') }}</dt>
<dd>{{ $this->formatDate($job->plannedFrom) }}</dd>
<dt class="font-medium">{{ __('jobs.fields.planned_to') }}</dt>
<dd>{{ $this->formatDate($job->plannedTo) }}</dd>
</dl>
</section>
<section aria-labelledby="members-heading" class="space-y-3">
<h2 id="members-heading" class="text-xl font-semibold">{{ __('jobs.sections.members') }}</h2>
<dl class="grid gap-x-6 gap-y-2 text-sm sm:grid-cols-[max-content_1fr]">
<dt class="font-medium">{{ __('jobs.fields.responsible_user') }}</dt>
<dd>{{ $job->responsible->name }}</dd>
<dt class="font-medium">{{ __('jobs.fields.contact_user') }}</dt>
<dd>{{ $job->contactUser->name ?? __('jobs.not_set') }}</dd>
<dt class="font-medium">{{ __('jobs.fields.customer_contact') }}</dt>
<dd>{{ $job->customerContact->name ?? __('jobs.not_set') }}</dd>
<dt class="font-medium">{{ __('jobs.fields.biller_user') }}</dt>
<dd>{{ $job->biller->name ?? __('jobs.not_set') }}</dd>
<dt class="font-medium">{{ __('jobs.fields.billing_unit') }}</dt>
<dd>{{ $job->billingUnit->name ?? __('jobs.not_set') }}</dd>
<dt class="font-medium">{{ __('jobs.fields.members') }}</dt>
<dd>{{ $job->members === [] ? __('jobs.not_set') : collect($job->members)->pluck('name')->join(', ') }}</dd>
</dl>
</section>
<section aria-labelledby="links-heading" class="space-y-3">
<h2 id="links-heading" class="text-xl font-semibold">{{ __('jobs.sections.links') }}</h2>
@if ($job->links === [])
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('jobs.links.none') }}</p>
@else
<ul class="list-disc space-y-1 pl-5 text-sm">
@foreach ($job->links as $link)
<li class="break-all">
<x-link :href="$link['url']" target="_blank" rel="noopener noreferrer">
{{ $link['title'] }}<span class="sr-only"> ({{ __('jobs.opens_in_new_tab') }})</span>
</x-link>
</li>
@endforeach
</ul>
@endif
</section>
<section aria-labelledby="instructions-heading" class="space-y-3">
<h2 id="instructions-heading" class="text-xl font-semibold">{{ __('jobs.sections.instructions') }}</h2>
<p class="whitespace-pre-line text-sm">{{ $job->instructions ?? __('jobs.not_set') }}</p>
</section>
<section aria-labelledby="history-heading" class="space-y-3">
<h2 id="history-heading" class="text-xl font-semibold">{{ __('jobs.sections.history') }}</h2>
@if ($this->changes === [])
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('jobs.history.empty') }}</p>
@else
<ol class="space-y-2 text-sm">
@foreach ($this->changes as $change)
<li class="border-b border-zinc-200 pb-2 dark:border-zinc-700">
@if ($change->field === 'created')
{{ __('jobs.history.created', ['user' => $change->userName, 'number' => $change->newValue]) }}
@else
<span class="break-words">{{ __('jobs.history.changed', [
'field' => __('jobs.fields.'.$change->field),
'old' => $this->historyValue($change->field, $change->oldValue),
'new' => $this->historyValue($change->field, $change->newValue),
]) }}</span>
@endif
<span class="block text-zinc-600 dark:text-zinc-300">
{{ __('jobs.history.by', ['user' => $change->userName, 'time' => CarbonImmutable::parse($change->changedAt)->format('j.n.Y H.i')]) }}
</span>
</li>
@endforeach
</ol>
@endif
</section>
</div>