Fix editor colour refresh, task row layout, dark date icons and time cell width

- The job editor redraws its customer-coloured header when the board saves
  a customer colour (customer-color-changed).
- Service units and members in the editor's sidebar are in two columns.
- Native controls follow the dark theme (color-scheme), so the date
  picker's calendar icon is light.
- Task status, assignee and due date sit side by side in the editor.
- Each task in the editor has its checklist, comments and images.
- The time sheet's time field shows five characters (00:00).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-11-30 11:00:53 +02:00
co-authored by Claude Opus 5.5
parent 38c5b43018
commit 1d9bcefb41
9 changed files with 89 additions and 17 deletions
@@ -130,6 +130,23 @@ new class extends Component
return $this->jobId === null ? [] : app(TaskQueries::class)->pinnedTaskIds($this->jobId);
}
/**
* The colour picker lives on the board, so the board tells the editor
* when a customer's colour changed; the header colour is read on render.
*/
#[On('customer-color-changed')]
public function customerColorChanged(): void
{
unset($this->job);
}
#[On('task-comments-changed')]
#[On('task-images-changed')]
public function refreshTasks(): void
{
unset($this->tasks);
}
public function canEdit(): bool
{
return Gate::allows('jobs.manage');
@@ -436,6 +453,7 @@ new class extends Component
$staff = collect($this->users)->reject(fn ($user) => $user->role === Role::Subcontractor);
$headerColor = new HexColor($job?->customer->id !== null ? (app(\App\Modules\Customers\Application\Contracts\CustomerQueries::class)->headerColorsByIds([$job->customer->id])[$job->customer->id] ?? '#23476a') : '#23476a');
$fieldClass = 'w-full rounded-lg border border-neutral-400 bg-white px-2.5 py-1.5 text-xs text-neutral-900 focus-visible:outline-2 focus-visible:outline-primary-600 dark:border-[#6b7079] dark:bg-[#24262a] dark:text-white dark:focus-visible:outline-primary-300';
$controlClass = 'w-auto max-w-full rounded-lg border border-neutral-400 bg-white px-2.5 py-1.5 text-xs text-neutral-900 focus-visible:outline-2 focus-visible:outline-primary-600 dark:border-[#6b7079] dark:bg-[#24262a] dark:text-white dark:focus-visible:outline-primary-300';
$labelClass = 'mb-1 block text-[11px] font-semibold text-neutral-800 dark:text-neutral-100';
$boxClass = 'space-y-2.5 rounded-xl border border-neutral-200 bg-neutral-100 p-3.5 dark:border-[#36393f] dark:bg-[#18191b]';
$boxHeading = 'text-[10px] font-extrabold tracking-wider text-neutral-700 uppercase dark:text-neutral-200';
@@ -598,7 +616,7 @@ new class extends Component
@if (Gate::allows('jobs.manage-tasks', [$job->id]) && $this->templates !== [] && $job->status->allowsTasks())
<form wire:submit="applyTemplate" class="flex items-center gap-1.5">
<label for="job-editor-template" class="sr-only">{{ __('jobs.editor.template') }}</label>
<select id="job-editor-template" wire:model="templateId" class="{{ $fieldClass }} w-auto py-1 text-[11px]">
<select id="job-editor-template" wire:model="templateId" class="{{ $controlClass }} py-1 text-[11px]">
<option value="">{{ __('jobs.editor.template_choose') }}</option>
@foreach ($this->templates as $template)
<option value="{{ $template->id }}">{{ $template->name }}</option>
@@ -616,7 +634,7 @@ new class extends Component
<ul class="space-y-2">
@foreach ($this->tasks as $task)
@php($canManageTask = Gate::allows('jobs.manage-tasks', [$job->id]))
<li wire:key="editor-task-{{ $task->id }}" x-data="{ checklist: false }" class="space-y-2 rounded-xl border border-neutral-200 bg-white p-2.5 text-xs dark:border-[#36393f] dark:bg-[#25272b]">
<li wire:key="editor-task-{{ $task->id }}" x-data="{ details: false }" class="space-y-2 rounded-xl border border-neutral-200 bg-white p-2.5 text-xs dark:border-[#36393f] dark:bg-[#25272b]">
<div class="flex flex-wrap items-center justify-between gap-2">
<div class="flex min-w-0 flex-1 items-center gap-2">
<input
@@ -646,20 +664,20 @@ new class extends Component
@if ($canManageTask)
<div class="flex flex-wrap items-center gap-1.5">
<label for="editor-task-status-{{ $task->id }}" class="sr-only">{{ __('jobs.editor.task_status', ['task' => $task->title]) }}</label>
<select id="editor-task-status-{{ $task->id }}" wire:change="updateTaskField({{ $task->id }}, 'status', $event.target.value)" class="{{ $fieldClass }} w-auto py-0.5 text-[11px]">
<select id="editor-task-status-{{ $task->id }}" wire:change="updateTaskField({{ $task->id }}, 'status', $event.target.value)" class="{{ $controlClass }} py-0.5 text-[11px]">
@foreach (TaskStatus::cases() as $taskStatus)
<option value="{{ $taskStatus->value }}" @selected($taskStatus === $task->status)>{{ __('jobs.tasks.statuses.'.$taskStatus->value) }}</option>
@endforeach
</select>
<label for="editor-task-assignee-{{ $task->id }}" class="sr-only">{{ __('jobs.editor.task_assignee', ['task' => $task->title]) }}</label>
<select id="editor-task-assignee-{{ $task->id }}" wire:change="updateTaskField({{ $task->id }}, 'assignee', $event.target.value)" class="{{ $fieldClass }} w-auto py-0.5 text-[11px]">
<select id="editor-task-assignee-{{ $task->id }}" wire:change="updateTaskField({{ $task->id }}, 'assignee', $event.target.value)" class="{{ $controlClass }} py-0.5 text-[11px]">
<option value="">{{ __('jobs.editor.no_assignee') }}</option>
@foreach ($this->users as $user)
<option value="{{ $user->id }}" @selected($user->id === $task->assignee?->id)>{{ $user->name }}</option>
@endforeach
</select>
<label for="editor-task-due-{{ $task->id }}" class="sr-only">{{ __('jobs.editor.task_due', ['task' => $task->title]) }}</label>
<input id="editor-task-due-{{ $task->id }}" type="date" value="{{ $task->dueOn }}" wire:change="updateTaskField({{ $task->id }}, 'due_on', $event.target.value)" class="{{ $fieldClass }} w-auto py-0.5 text-[11px]" />
<input id="editor-task-due-{{ $task->id }}" type="date" value="{{ $task->dueOn }}" wire:change="updateTaskField({{ $task->id }}, 'due_on', $event.target.value)" class="{{ $controlClass }} py-0.5 text-[11px]" />
@if ($job->status === JobStatus::Ongoing)
@php($pinned = $this->pinnedTasks[$task->id] ?? false)
<button
@@ -677,16 +695,31 @@ new class extends Component
<div class="pl-6">
<button
type="button"
x-on:click="checklist = ! checklist"
x-bind:aria-expanded="checklist.toString()"
aria-controls="editor-checklist-{{ $task->id }}"
x-on:click="details = ! details"
x-bind:aria-expanded="details.toString()"
aria-controls="editor-details-{{ $task->id }}"
class="inline-flex min-h-6 items-center gap-1 rounded text-[11px] font-semibold text-indigo-800 hover:underline focus-visible:outline-2 focus-visible:outline-primary-600 dark:text-indigo-100 dark:focus-visible:outline-primary-300"
>
<x-icon name="chevron-right" class="size-3 transition" x-bind:class="checklist && 'rotate-90'" aria-hidden="true" />
{{ __('jobs.editor.checklist') }}
<x-icon name="chevron-right" class="size-3 transition" x-bind:class="details && 'rotate-90'" aria-hidden="true" />
{{ __('jobs.editor.details', ['comments' => $task->commentCount, 'images' => $task->imageCount]) }}
</button>
<div id="editor-checklist-{{ $task->id }}" x-show="checklist" x-cloak class="pt-1">
<livewire:jobs::task-checklist :job-id="$job->id" :task-id="$task->id" :task-title="$task->title" :wire:key="'editor-checklist-'.$task->id" />
<div id="editor-details-{{ $task->id }}" x-show="details" x-cloak class="pt-1">
<x-tabs
id="editor-task-{{ $task->id }}-tabs"
:label="__('jobs.tasks.tabs.label', ['title' => $task->title])"
:tabs="[
'notes' => __('jobs.tasks.tabs.notes'),
'images' => __('jobs.tasks.tabs.images'),
]"
>
<x-tabs.panel tabs-id="editor-task-{{ $task->id }}-tabs" name="notes" class="space-y-3">
<livewire:jobs::task-checklist :job-id="$job->id" :task-id="$task->id" :task-title="$task->title" :wire:key="'editor-checklist-'.$task->id" />
<livewire:jobs::task-comments :job-id="$job->id" :task-id="$task->id" :task-title="$task->title" :wire:key="'editor-comments-'.$task->id" />
</x-tabs.panel>
<x-tabs.panel tabs-id="editor-task-{{ $task->id }}-tabs" name="images">
<livewire:jobs::task-images :job-id="$job->id" :task-id="$task->id" :task-title="$task->title" :wire:key="'editor-images-'.$task->id" />
</x-tabs.panel>
</x-tabs>
</div>
</div>
</li>
@@ -699,7 +732,7 @@ new class extends Component
<label for="job-editor-new-task" class="sr-only">{{ __('jobs.editor.new_task') }}</label>
<input id="job-editor-new-task" type="text" wire:model="newTaskTitle" maxlength="255" placeholder="{{ __('jobs.editor.new_task_placeholder') }}" class="{{ $fieldClass }} min-w-[200px] flex-1 placeholder:text-neutral-600 dark:placeholder:text-neutral-300" />
<label for="job-editor-new-task-assignee" class="sr-only">{{ __('jobs.editor.new_task_assignee') }}</label>
<select id="job-editor-new-task-assignee" wire:model="newTaskAssignee" class="{{ $fieldClass }} w-auto">
<select id="job-editor-new-task-assignee" wire:model="newTaskAssignee" class="{{ $controlClass }}">
<option value="">{{ __('jobs.editor.no_assignee') }}</option>
@foreach ($this->users as $user)
<option value="{{ $user->id }}">{{ $user->name }}</option>
@@ -809,6 +842,7 @@ new class extends Component
</div>
@endforeach
<x-checkbox-group
:columns="2"
:legend="__('jobs.fields.members')"
model="form.member_user_ids"
:options="collect($this->users)->map(fn ($user) => ['value' => $user->id, 'label' => $user->name, 'note' => $user->role === Role::Subcontractor ? __('users.roles.subcontractor') : null])->all()"
@@ -817,7 +851,7 @@ new class extends Component
<section aria-labelledby="job-editor-units-heading" class="{{ $boxClass }}">
<h3 id="job-editor-units-heading" class="{{ $boxHeading }}">{{ __('jobs.editor.units_section') }}</h3>
<x-checkbox-group :legend="__('jobs.fields.service_units')" model="form.service_unit_ids" :options="$this->serviceUnitOptions" />
<x-checkbox-group :columns="2" :legend="__('jobs.fields.service_units')" model="form.service_unit_ids" :options="$this->serviceUnitOptions" />
<div class="space-y-1.5">
<p id="editor-tags-label" class="{{ $labelClass }}">{{ __('jobs.fields.tags') }}</p>
@if ($form->tags !== [])