- 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]>
54 lines
1.9 KiB
PHP
54 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Modules\Jobs\Infrastructure\Persistence\Repositories;
|
|
|
|
use App\Modules\Jobs\Domain\Contracts\BoardRepository;
|
|
use App\Modules\Jobs\Domain\ValueObjects\BoardPreferences;
|
|
use App\Modules\Jobs\Infrastructure\Persistence\Eloquent\JobBoardPreferenceModel;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
/**
|
|
* Card order and pins are plain column updates: they are board state, not
|
|
* job details, so they bypass the job entity and its change history.
|
|
*/
|
|
class EloquentBoardRepository implements BoardRepository
|
|
{
|
|
public function setJobPositions(array $positions): void
|
|
{
|
|
foreach ($positions as $jobId => $position) {
|
|
DB::table('customer_jobs')->where('id', $jobId)->update(['board_position' => $position]);
|
|
}
|
|
}
|
|
|
|
public function setTaskPositions(array $positions): void
|
|
{
|
|
foreach ($positions as $taskId => $position) {
|
|
DB::table('tasks')->where('id', $taskId)->update(['board_position' => $position]);
|
|
}
|
|
}
|
|
|
|
public function setTaskPinned(int $taskId, bool $pinned): void
|
|
{
|
|
DB::table('tasks')->where('id', $taskId)->update(['is_pinned_to_board' => $pinned]);
|
|
}
|
|
|
|
public function preferencesOf(int $userId): BoardPreferences
|
|
{
|
|
$model = JobBoardPreferenceModel::query()->where('user_id', $userId)->first();
|
|
|
|
return $model === null
|
|
? BoardPreferences::defaults()
|
|
: BoardPreferences::fromStored($model->density, $model->urgent_threshold, $model->column_colors ?? [], $model->column_sorts ?? []);
|
|
}
|
|
|
|
public function savePreferences(int $userId, BoardPreferences $preferences): void
|
|
{
|
|
JobBoardPreferenceModel::query()->updateOrCreate(['user_id' => $userId], [
|
|
'density' => $preferences->density->value,
|
|
'urgent_threshold' => $preferences->urgentThreshold->value,
|
|
'column_colors' => $preferences->colorValues(),
|
|
'column_sorts' => $preferences->sortValues(),
|
|
]);
|
|
}
|
|
}
|