Darken the dark canvas, add customer colours, the ongoing status and the board model

- Dark theme page background is #5a5e60; text on it is lifted to zinc-200 /
  primary-100 and TallStackUI's dark labels, hints and checkbox labels are
  lightened so everything stays at 4.5:1.
- Shared HexColor picks white or black text by the higher WCAG contrast; a
  native-dialog colour picker and a large work dialog component.
- Customers get a header colour (customers.header_color), set on the
  customer page.
- New job status Jatkuvat / Kausi (ongoing): open, never late, billed
  monthly like running jobs.
- Kanban model: board columns and views, urgent threshold, per-user board
  preferences (density, column colours and sort), card positions, tasks of
  continuing jobs pinned to the board, MoveBoardCard and board queries with
  logged hours from TimeTracking.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-11-30 06:11:49 +02:00
co-authored by Claude Opus 5.5
parent de168619b3
commit f4b58f6b1d
140 changed files with 2845 additions and 170 deletions
@@ -28,6 +28,22 @@ interface TimeEntryQueries
public function hasEntries(int $taskId): bool;
/**
* Recorded quarter-hours of all users by job id.
*
* @param list<int> $jobIds
* @return array<int, int>
*/
public function quartersByJobs(array $jobIds): array;
/**
* Recorded quarter-hours of all users by task id.
*
* @param list<int> $taskIds
* @return array<int, int>
*/
public function quartersByTasks(array $taskIds): array;
/**
* Unapproved hours by user and week (Monday to Sunday), oldest week first.
*
@@ -0,0 +1,24 @@
<?php
namespace App\Modules\TimeTracking\Infrastructure;
use App\Modules\Jobs\Application\Contracts\LoggedJobHours;
use App\Modules\TimeTracking\Application\Contracts\TimeEntryQueries;
/**
* Tells the Jobs module's Kanban cards how many hours are recorded.
*/
class LoggedHoursFromTimeEntries implements LoggedJobHours
{
public function __construct(private TimeEntryQueries $entries) {}
public function quartersByJobs(array $jobIds): array
{
return $this->entries->quartersByJobs($jobIds);
}
public function quartersByTasks(array $taskIds): array
{
return $this->entries->quartersByTasks($taskIds);
}
}
@@ -114,6 +114,35 @@ class EloquentTimeEntryQueries implements TimeEntryQueries
return TimeEntryModel::query()->where('task_id', $taskId)->exists();
}
public function quartersByJobs(array $jobIds): array
{
return $this->quartersBy('customer_job_id', $jobIds);
}
public function quartersByTasks(array $taskIds): array
{
return $this->quartersBy('task_id', $taskIds);
}
/**
* @param list<int> $ids
* @return array<int, int>
*/
private function quartersBy(string $column, array $ids): array
{
if ($ids === []) {
return [];
}
return TimeEntryModel::query()
->whereIn($column, $ids)
->groupBy($column)
->selectRaw("{$column} as id, sum(hours) as total")
->pluck('total', 'id')
->map(fn ($total): int => (int) round(((float) $total) * 4))
->all();
}
public function pendingWeeks(?int $userId = null): array
{
$entries = TimeEntryModel::query()
@@ -4,10 +4,12 @@ namespace App\Modules\TimeTracking\Infrastructure\Providers;
use App\Models\User;
use App\Modules\Jobs\Application\Contracts\CustomerJobQueries;
use App\Modules\Jobs\Application\Contracts\LoggedJobHours;
use App\Modules\Jobs\Application\Contracts\TaskUsage;
use App\Modules\TimeTracking\Application\Contracts\TimeEntryQueries;
use App\Modules\TimeTracking\Application\Contracts\TimeReportQueries;
use App\Modules\TimeTracking\Domain\Contracts\TimeEntryRepository;
use App\Modules\TimeTracking\Infrastructure\LoggedHoursFromTimeEntries;
use App\Modules\TimeTracking\Infrastructure\Persistence\Repositories\EloquentTimeEntryQueries;
use App\Modules\TimeTracking\Infrastructure\Persistence\Repositories\EloquentTimeEntryRepository;
use App\Modules\TimeTracking\Infrastructure\Persistence\Repositories\EloquentTimeReportQueries;
@@ -30,6 +32,7 @@ class TimeTrackingServiceProvider extends ServiceProvider
TimeEntryQueries::class => EloquentTimeEntryQueries::class,
TimeReportQueries::class => EloquentTimeReportQueries::class,
TaskUsage::class => TaskUsageFromTimeEntries::class,
LoggedJobHours::class => LoggedHoursFromTimeEntries::class,
];
public function boot(): void
@@ -129,7 +129,7 @@ new class extends Component
<div class="mx-auto max-w-5xl space-y-6 p-4 sm:p-6">
<div class="space-y-2">
<x-page-title icon="check-badge">{{ __('time.approvals.title') }}</x-page-title>
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('time.approvals.intro') }}</p>
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('time.approvals.intro') }}</p>
</div>
<div class="max-w-sm">
@@ -247,7 +247,7 @@ new class extends Component
<h2 id="entries-heading" tabindex="-1" class="text-xl font-semibold focus:outline-none">{{ __('time.task_page.own_entries') }}</h2>
@if ($this->entries === [])
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('time.task_page.no_entries') }}</p>
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('time.task_page.no_entries') }}</p>
@else
<ul class="divide-y divide-zinc-200 rounded-lg border border-zinc-200 text-sm dark:divide-zinc-700 dark:border-zinc-700">
@foreach ($this->entries as $entry)
@@ -267,7 +267,7 @@ new class extends Component
<div>
<p class="font-medium">{{ $this->dayLabel($entry->workedOn) }}: {{ __('time.hours_suffix', ['hours' => WorkedHours::formatQuarters($entry->quarters)]) }}</p>
@if ($entry->note !== null)
<p class="whitespace-pre-line text-zinc-700 dark:text-zinc-300">{{ $entry->note }}</p>
<p class="whitespace-pre-line text-zinc-700 dark:text-zinc-200">{{ $entry->note }}</p>
@endif
</div>
@if ($entry->isApproved)
@@ -346,10 +346,10 @@ new class extends Component
<div class="space-y-2">
<x-page-title icon="clock">{{ $this->heading() }}</x-page-title>
@if ($this->isReadOnly())
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('time.other_intro') }}</p>
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('time.other_intro') }}</p>
<x-link :href="route('time.approvals')" navigate class="text-sm">{{ __('time.approval.back_to_list') }}</x-link>
@else
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('time.intro') }}</p>
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('time.intro') }}</p>
@endif
</div>
@@ -386,9 +386,9 @@ new class extends Component
<tr wire:key="row-{{ $row->task->taskId }}" class="border-b border-zinc-200 align-top dark:border-zinc-700">
<th scope="row" class="py-2 pr-3 text-left font-normal">
<x-link :href="route('time.task', $row->task->taskId)" navigate class="font-medium">{{ $row->task->label() }}</x-link>
<span class="block text-zinc-600 dark:text-zinc-300">{{ $row->task->workTypeName }}</span>
<span class="block text-zinc-600 dark:text-zinc-200">{{ $row->task->workTypeName }}</span>
@if ($row->task->isLocked())
<span class="mt-1 inline-flex items-center gap-1 text-zinc-700 dark:text-zinc-300">
<span class="mt-1 inline-flex items-center gap-1 text-zinc-700 dark:text-zinc-200">
<x-icon name="lock-closed" class="size-4" aria-hidden="true" /> {{ __('time.locked') }}
</span>
@endif
@@ -462,7 +462,7 @@ new class extends Component
@foreach ($sheet->rows as $row)
<li wire:key="mrow-{{ $row->task->taskId }}" class="rounded-xl border border-zinc-200 bg-white p-3 text-sm shadow-sm dark:border-zinc-700 dark:bg-zinc-900">
<x-link :href="route('time.task', $row->task->taskId)" navigate class="font-medium break-words">{{ $row->task->label() }}</x-link>
<span class="block text-zinc-600 dark:text-zinc-300">{{ $row->task->workTypeName }}</span>
<span class="block text-zinc-600 dark:text-zinc-200">{{ $row->task->workTypeName }}</span>
@if ($row->isApprovedOn($selectedDay))
<p class="mt-2 inline-flex items-center gap-1">
@@ -561,7 +561,7 @@ new class extends Component
/>
@if (mb_strlen(trim($taskSearch)) >= 2)
<p role="status" aria-live="polite" class="text-sm text-zinc-600 dark:text-zinc-300">
<p role="status" aria-live="polite" class="text-sm text-zinc-600 dark:text-zinc-200">
{{ trans_choice('time.add.results', count($this->searchResults), ['count' => count($this->searchResults)]) }}
</p>
<ul class="space-y-1">
@@ -574,7 +574,7 @@ new class extends Component
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-primary-600 dark:focus-visible:outline-primary-300 dark:hover:bg-zinc-700"
>
<span class="font-medium">{{ $task->label() }}</span>
<span class="text-zinc-600 dark:text-zinc-300">{{ $task->workTypeName }}</span>
<span class="text-zinc-600 dark:text-zinc-200">{{ $task->workTypeName }}</span>
</button>
</li>
@endforeach