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:
@@ -387,6 +387,7 @@ new class extends Component
|
||||
}
|
||||
|
||||
$this->refreshBoard();
|
||||
$this->dispatch('customer-color-changed', customerId: $customerId);
|
||||
$this->statusMessage = __('jobs.board.customer_color_saved', ['customer' => $card->customerName ?? '']);
|
||||
}
|
||||
|
||||
|
||||
@@ -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">
|
||||
<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 !== [])
|
||||
|
||||
@@ -308,6 +308,7 @@ return [
|
||||
],
|
||||
|
||||
'editor' => [
|
||||
'details' => 'Details (comments :comments, images :images)',
|
||||
'heading' => 'Customer job :number',
|
||||
'close' => 'Close the card',
|
||||
'color' => 'Colour',
|
||||
|
||||
@@ -308,6 +308,7 @@ return [
|
||||
],
|
||||
|
||||
'editor' => [
|
||||
'details' => 'Lisätiedot (kommentit :comments, kuvat :images)',
|
||||
'heading' => 'Asiakastyö :number',
|
||||
'close' => 'Sulje kortti',
|
||||
'color' => 'Väri',
|
||||
|
||||
@@ -60,6 +60,15 @@ html {
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
/*
|
||||
* Native controls (the date picker's calendar icon and popup, select arrows,
|
||||
* scrollbars) follow the page theme. html.dark, not .dark: the header always
|
||||
* carries .dark.
|
||||
*/
|
||||
html.dark {
|
||||
color-scheme: dark;
|
||||
}
|
||||
|
||||
[x-cloak] {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
'model',
|
||||
'options',
|
||||
'hint' => null,
|
||||
'columns' => true,
|
||||
'columns' => true, // true: 2 from sm and 3 from lg; 2: always two; false: one
|
||||
])
|
||||
|
||||
@php
|
||||
@@ -28,7 +28,7 @@
|
||||
<p id="{{ $id }}-hint" class="text-sm text-zinc-600 dark:text-zinc-200">{{ $hint }}</p>
|
||||
@endif
|
||||
|
||||
<div @class(['grid gap-2', 'sm:grid-cols-2 lg:grid-cols-3' => $columns])>
|
||||
<div @class(['grid gap-2', 'grid-cols-2' => $columns === 2, 'sm:grid-cols-2 lg:grid-cols-3' => $columns === true])>
|
||||
@foreach ($options as $option)
|
||||
<label wire:key="{{ $id }}-{{ $option['value'] }}" class="flex min-h-6 cursor-pointer items-start gap-2 text-sm">
|
||||
<input
|
||||
|
||||
@@ -254,7 +254,7 @@
|
||||
wire:change="saveCell({{ $taskId }}, '{{ $day }}', $event.target.value)"
|
||||
@error($errorKey) aria-invalid="true" aria-describedby="{{ $fieldId }}-error" @enderror
|
||||
@class([
|
||||
'h-6 w-11 rounded border text-center font-mono text-[11px] focus-visible:outline-2 focus-visible:outline-primary-600 aria-invalid:border-red-700 dark:focus-visible:outline-primary-300 dark:aria-invalid:border-red-300',
|
||||
'h-6 w-12 rounded border px-0.5 text-center font-mono text-[11px] tabular-nums focus-visible:outline-2 focus-visible:outline-primary-600 aria-invalid:border-red-700 dark:focus-visible:outline-primary-300 dark:aria-invalid:border-red-300',
|
||||
'border-emerald-600 bg-emerald-50 font-semibold text-emerald-900 dark:border-emerald-500/50 dark:bg-emerald-950/50 dark:text-emerald-100' => $quarters > 0,
|
||||
'border-slate-400 bg-slate-50 text-slate-700 dark:border-[#5a5e66] dark:bg-[#1b1d20] dark:text-zinc-200' => $quarters === 0,
|
||||
])
|
||||
|
||||
@@ -160,6 +160,8 @@ it('has no accessibility issues in the job editor and the quick intake dialog',
|
||||
$visit->click('#card-job-'.$this->job->id.'-open')
|
||||
->assertScript('document.getElementById("job-editor-dialog").open', true)
|
||||
->assertSee('Kuvauspäivä')
|
||||
->click('#job-editor-dialog [aria-controls^="editor-details-"]')
|
||||
->assertSee('Kuvat')
|
||||
->assertNoJavaScriptErrors()
|
||||
->assertNoAccessibilityIssues(level: 2)
|
||||
->keys('#job-editor-name', 'Escape')
|
||||
|
||||
@@ -126,3 +126,27 @@ it('lets a subcontractor only look at their own job and tick its tasks', functio
|
||||
|
||||
expect($task->fresh()->status->value)->toBe('done');
|
||||
});
|
||||
|
||||
it('shows a new customer colour at once when the board saves it', function () {
|
||||
$editor = Livewire::test('jobs::job-editor')
|
||||
->dispatch('open-job-editor', jobId: $this->job->id)
|
||||
->assertSeeHtml('background-color: #23476a');
|
||||
|
||||
Livewire::test('jobs::board')
|
||||
->call('setCustomerColor', $this->job->customer_id, '#991b1b')
|
||||
->assertDispatched('customer-color-changed', customerId: $this->job->customer_id);
|
||||
|
||||
$editor->dispatch('customer-color-changed', customerId: $this->job->customer_id)
|
||||
->assertSeeHtml('background-color: #991b1b');
|
||||
});
|
||||
|
||||
it('has comments and images for each task', function () {
|
||||
$task = TaskModel::factory()->create(['customer_job_id' => $this->job->id, 'title' => 'Vedos']);
|
||||
|
||||
Livewire::test('jobs::job-editor')
|
||||
->dispatch('open-job-editor', jobId: $this->job->id)
|
||||
->assertSee('Lisätiedot (kommentit 0, kuvat 0)')
|
||||
->assertSeeLivewire('jobs::task-comments')
|
||||
->assertSeeLivewire('jobs::task-images')
|
||||
->assertSeeHtml('editor-task-'.$task->id.'-tabs-tab-images');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user