diff --git a/app/Modules/Jobs/Presentation/Livewire/⚡board.blade.php b/app/Modules/Jobs/Presentation/Livewire/⚡board.blade.php index 08fd041..4bfab05 100644 --- a/app/Modules/Jobs/Presentation/Livewire/⚡board.blade.php +++ b/app/Modules/Jobs/Presentation/Livewire/⚡board.blade.php @@ -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 ?? '']); } diff --git a/app/Modules/Jobs/Presentation/Livewire/⚡job-editor.blade.php b/app/Modules/Jobs/Presentation/Livewire/⚡job-editor.blade.php index 8cc3a06..6e2b7a5 100644 --- a/app/Modules/Jobs/Presentation/Livewire/⚡job-editor.blade.php +++ b/app/Modules/Jobs/Presentation/Livewire/⚡job-editor.blade.php @@ -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())