Compare commits
4
Commits
a4dbe8ce09
...
f3d2b3e39e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f3d2b3e39e | ||
|
|
1d9bcefb41 | ||
|
|
38c5b43018 | ||
|
|
f24bd3cc35 |
+4
-1
@@ -34,7 +34,10 @@ class EloquentExpenseQueries implements ExpenseQueries
|
|||||||
|
|
||||||
return $this->summaries(ExpenseModel::query()
|
return $this->summaries(ExpenseModel::query()
|
||||||
->where('user_id', $userId)
|
->where('user_id', $userId)
|
||||||
->whereBetween('spent_on', [$start->toDateString(), $start->copy()->endOfMonth()->toDateString()]));
|
// An upper bound before the next month: SQLite keeps date casts as "Y-m-d 00:00:00",
|
||||||
|
// which a between ending at the month's last "Y-m-d" would leave out.
|
||||||
|
->where('spent_on', '>=', $start->toDateString())
|
||||||
|
->where('spent_on', '<', $start->copy()->addMonth()->toDateString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function find(int $id): ?ExpenseSummary
|
public function find(int $id): ?ExpenseSummary
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ final class MoveBoardCard
|
|||||||
$jobPositions = [];
|
$jobPositions = [];
|
||||||
$taskPositions = [];
|
$taskPositions = [];
|
||||||
|
|
||||||
foreach (array_values($orderedKeys) as $index => $key) {
|
foreach ($orderedKeys as $index => $key) {
|
||||||
if (preg_match('/^(job|task)-(\d+)$/', $key, $matches) !== 1) {
|
if (preg_match('/^(job|task)-(\d+)$/', $key, $matches) !== 1) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -387,6 +387,7 @@ new class extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->refreshBoard();
|
$this->refreshBoard();
|
||||||
|
$this->dispatch('customer-color-changed', customerId: $customerId);
|
||||||
$this->statusMessage = __('jobs.board.customer_color_saved', ['customer' => $card->customerName ?? '']);
|
$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);
|
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
|
public function canEdit(): bool
|
||||||
{
|
{
|
||||||
return Gate::allows('jobs.manage');
|
return Gate::allows('jobs.manage');
|
||||||
@@ -436,6 +453,7 @@ new class extends Component
|
|||||||
$staff = collect($this->users)->reject(fn ($user) => $user->role === Role::Subcontractor);
|
$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');
|
$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';
|
$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';
|
$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]';
|
$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';
|
$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())
|
@if (Gate::allows('jobs.manage-tasks', [$job->id]) && $this->templates !== [] && $job->status->allowsTasks())
|
||||||
<form wire:submit="applyTemplate" class="flex items-center gap-1.5">
|
<form wire:submit="applyTemplate" class="flex items-center gap-1.5">
|
||||||
<label for="job-editor-template" class="sr-only">{{ __('jobs.editor.template') }}</label>
|
<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>
|
<option value="">{{ __('jobs.editor.template_choose') }}</option>
|
||||||
@foreach ($this->templates as $template)
|
@foreach ($this->templates as $template)
|
||||||
<option value="{{ $template->id }}">{{ $template->name }}</option>
|
<option value="{{ $template->id }}">{{ $template->name }}</option>
|
||||||
@@ -616,7 +634,7 @@ new class extends Component
|
|||||||
<ul class="space-y-2">
|
<ul class="space-y-2">
|
||||||
@foreach ($this->tasks as $task)
|
@foreach ($this->tasks as $task)
|
||||||
@php($canManageTask = Gate::allows('jobs.manage-tasks', [$job->id]))
|
@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="{ checklist: false, extras: 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 flex-wrap items-center justify-between gap-2">
|
||||||
<div class="flex min-w-0 flex-1 items-center gap-2">
|
<div class="flex min-w-0 flex-1 items-center gap-2">
|
||||||
<input
|
<input
|
||||||
@@ -646,20 +664,20 @@ new class extends Component
|
|||||||
@if ($canManageTask)
|
@if ($canManageTask)
|
||||||
<div class="flex flex-wrap items-center gap-1.5">
|
<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>
|
<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)
|
@foreach (TaskStatus::cases() as $taskStatus)
|
||||||
<option value="{{ $taskStatus->value }}" @selected($taskStatus === $task->status)>{{ __('jobs.tasks.statuses.'.$taskStatus->value) }}</option>
|
<option value="{{ $taskStatus->value }}" @selected($taskStatus === $task->status)>{{ __('jobs.tasks.statuses.'.$taskStatus->value) }}</option>
|
||||||
@endforeach
|
@endforeach
|
||||||
</select>
|
</select>
|
||||||
<label for="editor-task-assignee-{{ $task->id }}" class="sr-only">{{ __('jobs.editor.task_assignee', ['task' => $task->title]) }}</label>
|
<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>
|
<option value="">{{ __('jobs.editor.no_assignee') }}</option>
|
||||||
@foreach ($this->users as $user)
|
@foreach ($this->users as $user)
|
||||||
<option value="{{ $user->id }}" @selected($user->id === $task->assignee?->id)>{{ $user->name }}</option>
|
<option value="{{ $user->id }}" @selected($user->id === $task->assignee?->id)>{{ $user->name }}</option>
|
||||||
@endforeach
|
@endforeach
|
||||||
</select>
|
</select>
|
||||||
<label for="editor-task-due-{{ $task->id }}" class="sr-only">{{ __('jobs.editor.task_due', ['task' => $task->title]) }}</label>
|
<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)
|
@if ($job->status === JobStatus::Ongoing)
|
||||||
@php($pinned = $this->pinnedTasks[$task->id] ?? false)
|
@php($pinned = $this->pinnedTasks[$task->id] ?? false)
|
||||||
<button
|
<button
|
||||||
@@ -674,7 +692,8 @@ new class extends Component
|
|||||||
</div>
|
</div>
|
||||||
@error('tasks.'.$task->id) <p class="text-xs font-semibold text-red-700 dark:text-red-200">{{ $message }}</p> @enderror
|
@error('tasks.'.$task->id) <p class="text-xs font-semibold text-red-700 dark:text-red-200">{{ $message }}</p> @enderror
|
||||||
|
|
||||||
<div class="pl-6">
|
<div class="space-y-1 pl-6">
|
||||||
|
<div class="flex flex-wrap gap-3">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
x-on:click="checklist = ! checklist"
|
x-on:click="checklist = ! checklist"
|
||||||
@@ -685,9 +704,37 @@ new class extends Component
|
|||||||
<x-icon name="chevron-right" class="size-3 transition" x-bind:class="checklist && 'rotate-90'" aria-hidden="true" />
|
<x-icon name="chevron-right" class="size-3 transition" x-bind:class="checklist && 'rotate-90'" aria-hidden="true" />
|
||||||
{{ __('jobs.editor.checklist') }}
|
{{ __('jobs.editor.checklist') }}
|
||||||
</button>
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
x-on:click="extras = ! extras"
|
||||||
|
x-bind:aria-expanded="extras.toString()"
|
||||||
|
aria-controls="editor-extras-{{ $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="extras && 'rotate-90'" aria-hidden="true" />
|
||||||
|
{{ __('jobs.editor.extras', ['comments' => $task->commentCount, 'images' => $task->imageCount]) }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
<div id="editor-checklist-{{ $task->id }}" x-show="checklist" x-cloak class="pt-1">
|
<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" />
|
<livewire:jobs::task-checklist :job-id="$job->id" :task-id="$task->id" :task-title="$task->title" :wire:key="'editor-checklist-'.$task->id" />
|
||||||
</div>
|
</div>
|
||||||
|
<div id="editor-extras-{{ $task->id }}" x-show="extras" x-cloak class="pt-1">
|
||||||
|
<x-tabs
|
||||||
|
id="editor-task-{{ $task->id }}-tabs"
|
||||||
|
:label="__('jobs.tasks.tabs.label', ['title' => $task->title])"
|
||||||
|
:tabs="[
|
||||||
|
'comments' => __('jobs.editor.tab_comments', ['count' => $task->commentCount]),
|
||||||
|
'images' => __('jobs.editor.tab_images', ['count' => $task->imageCount]),
|
||||||
|
]"
|
||||||
|
>
|
||||||
|
<x-tabs.panel tabs-id="editor-task-{{ $task->id }}-tabs" name="comments">
|
||||||
|
<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>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
@endforeach
|
@endforeach
|
||||||
@@ -699,7 +746,7 @@ new class extends Component
|
|||||||
<label for="job-editor-new-task" class="sr-only">{{ __('jobs.editor.new_task') }}</label>
|
<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" />
|
<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>
|
<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>
|
<option value="">{{ __('jobs.editor.no_assignee') }}</option>
|
||||||
@foreach ($this->users as $user)
|
@foreach ($this->users as $user)
|
||||||
<option value="{{ $user->id }}">{{ $user->name }}</option>
|
<option value="{{ $user->id }}">{{ $user->name }}</option>
|
||||||
@@ -809,6 +856,7 @@ new class extends Component
|
|||||||
</div>
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
<x-checkbox-group
|
<x-checkbox-group
|
||||||
|
:columns="2"
|
||||||
:legend="__('jobs.fields.members')"
|
:legend="__('jobs.fields.members')"
|
||||||
model="form.member_user_ids"
|
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()"
|
: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 +865,7 @@ new class extends Component
|
|||||||
|
|
||||||
<section aria-labelledby="job-editor-units-heading" class="{{ $boxClass }}">
|
<section aria-labelledby="job-editor-units-heading" class="{{ $boxClass }}">
|
||||||
<h3 id="job-editor-units-heading" class="{{ $boxHeading }}">{{ __('jobs.editor.units_section') }}</h3>
|
<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">
|
<div class="space-y-1.5">
|
||||||
<p id="editor-tags-label" class="{{ $labelClass }}">{{ __('jobs.fields.tags') }}</p>
|
<p id="editor-tags-label" class="{{ $labelClass }}">{{ __('jobs.fields.tags') }}</p>
|
||||||
@if ($form->tags !== [])
|
@if ($form->tags !== [])
|
||||||
|
|||||||
+6
-3
@@ -42,7 +42,8 @@ class EloquentTimeEntryQueries implements TimeEntryQueries
|
|||||||
|
|
||||||
$entries = TimeEntryModel::query()
|
$entries = TimeEntryModel::query()
|
||||||
->where('user_id', $userId)
|
->where('user_id', $userId)
|
||||||
->whereBetween('worked_on', [$days[0], $days[6]])
|
->where('worked_on', '>=', $days[0])
|
||||||
|
->where('worked_on', '<', CarbonImmutable::parse($days[6])->addDay()->toDateString())
|
||||||
->get();
|
->get();
|
||||||
$pinnedIds = $this->pins->pinnedTaskIds($userId);
|
$pinnedIds = $this->pins->pinnedTaskIds($userId);
|
||||||
$scheduledIds = $this->tasks->scheduledTaskIdsFor($userId, $days[0], $days[6]);
|
$scheduledIds = $this->tasks->scheduledTaskIdsFor($userId, $days[0], $days[6]);
|
||||||
@@ -100,7 +101,8 @@ class EloquentTimeEntryQueries implements TimeEntryQueries
|
|||||||
$start = CarbonImmutable::createFromFormat('!Y-m', $month) ?: CarbonImmutable::now()->startOfMonth();
|
$start = CarbonImmutable::createFromFormat('!Y-m', $month) ?: CarbonImmutable::now()->startOfMonth();
|
||||||
$entries = TimeEntryModel::query()
|
$entries = TimeEntryModel::query()
|
||||||
->where('user_id', $userId)
|
->where('user_id', $userId)
|
||||||
->whereBetween('worked_on', [$start->toDateString(), $start->endOfMonth()->toDateString()])
|
->where('worked_on', '>=', $start->toDateString())
|
||||||
|
->where('worked_on', '<', $start->addMonth()->toDateString())
|
||||||
->get();
|
->get();
|
||||||
$paymentBases = [];
|
$paymentBases = [];
|
||||||
|
|
||||||
@@ -135,7 +137,8 @@ class EloquentTimeEntryQueries implements TimeEntryQueries
|
|||||||
|
|
||||||
$entries = TimeEntryModel::query()
|
$entries = TimeEntryModel::query()
|
||||||
->where('user_id', $userId)
|
->where('user_id', $userId)
|
||||||
->whereBetween('worked_on', [$days[0], $days[6]])
|
->where('worked_on', '>=', $days[0])
|
||||||
|
->where('worked_on', '<', CarbonImmutable::parse($days[6])->addDay()->toDateString())
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
$taskIds = array_values(array_unique(array_merge(
|
$taskIds = array_values(array_unique(array_merge(
|
||||||
|
|||||||
+3
-1
@@ -55,7 +55,9 @@ class EloquentTimeEntryRepository implements TimeEntryRepository
|
|||||||
{
|
{
|
||||||
return TimeEntryModel::query()
|
return TimeEntryModel::query()
|
||||||
->where('user_id', $userId)
|
->where('user_id', $userId)
|
||||||
->whereBetween('worked_on', [$from->format('Y-m-d'), $to->format('Y-m-d')])
|
// Exclusive upper bound: SQLite keeps date casts as "Y-m-d 00:00:00".
|
||||||
|
->where('worked_on', '>=', $from->format('Y-m-d'))
|
||||||
|
->where('worked_on', '<', $to->modify('+1 day')->format('Y-m-d'))
|
||||||
->orderBy('worked_on')
|
->orderBy('worked_on')
|
||||||
->get()
|
->get()
|
||||||
->map(fn (TimeEntryModel $model): TimeEntry => $this->toEntity($model))
|
->map(fn (TimeEntryModel $model): TimeEntry => $this->toEntity($model))
|
||||||
|
|||||||
@@ -308,6 +308,9 @@ return [
|
|||||||
],
|
],
|
||||||
|
|
||||||
'editor' => [
|
'editor' => [
|
||||||
|
'extras' => 'Comments and images (comments :comments, images :images)',
|
||||||
|
'tab_comments' => 'Comments (:count)',
|
||||||
|
'tab_images' => 'Images (:count)',
|
||||||
'heading' => 'Customer job :number',
|
'heading' => 'Customer job :number',
|
||||||
'close' => 'Close the card',
|
'close' => 'Close the card',
|
||||||
'color' => 'Colour',
|
'color' => 'Colour',
|
||||||
|
|||||||
@@ -308,6 +308,9 @@ return [
|
|||||||
],
|
],
|
||||||
|
|
||||||
'editor' => [
|
'editor' => [
|
||||||
|
'extras' => 'Kommentit ja kuvat (kommentit :comments, kuvat :images)',
|
||||||
|
'tab_comments' => 'Kommentit (:count)',
|
||||||
|
'tab_images' => 'Kuvat (:count)',
|
||||||
'heading' => 'Asiakastyö :number',
|
'heading' => 'Asiakastyö :number',
|
||||||
'close' => 'Sulje kortti',
|
'close' => 'Sulje kortti',
|
||||||
'color' => 'Väri',
|
'color' => 'Väri',
|
||||||
|
|||||||
@@ -60,6 +60,15 @@ html {
|
|||||||
overflow-y: scroll;
|
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] {
|
[x-cloak] {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
'model',
|
'model',
|
||||||
'options',
|
'options',
|
||||||
'hint' => null,
|
'hint' => null,
|
||||||
'columns' => true,
|
'columns' => true, // true: 2 from sm and 3 from lg; 2: always two; false: one
|
||||||
])
|
])
|
||||||
|
|
||||||
@php
|
@php
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
<p id="{{ $id }}-hint" class="text-sm text-zinc-600 dark:text-zinc-200">{{ $hint }}</p>
|
<p id="{{ $id }}-hint" class="text-sm text-zinc-600 dark:text-zinc-200">{{ $hint }}</p>
|
||||||
@endif
|
@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)
|
@foreach ($options as $option)
|
||||||
<label wire:key="{{ $id }}-{{ $option['value'] }}" class="flex min-h-6 cursor-pointer items-start gap-2 text-sm">
|
<label wire:key="{{ $id }}-{{ $option['value'] }}" class="flex min-h-6 cursor-pointer items-start gap-2 text-sm">
|
||||||
<input
|
<input
|
||||||
|
|||||||
@@ -254,7 +254,7 @@
|
|||||||
wire:change="saveCell({{ $taskId }}, '{{ $day }}', $event.target.value)"
|
wire:change="saveCell({{ $taskId }}, '{{ $day }}', $event.target.value)"
|
||||||
@error($errorKey) aria-invalid="true" aria-describedby="{{ $fieldId }}-error" @enderror
|
@error($errorKey) aria-invalid="true" aria-describedby="{{ $fieldId }}-error" @enderror
|
||||||
@class([
|
@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-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,
|
'border-slate-400 bg-slate-50 text-slate-700 dark:border-[#5a5e66] dark:bg-[#1b1d20] dark:text-zinc-200' => $quarters === 0,
|
||||||
])
|
])
|
||||||
|
|||||||
@@ -160,6 +160,9 @@ it('has no accessibility issues in the job editor and the quick intake dialog',
|
|||||||
$visit->click('#card-job-'.$this->job->id.'-open')
|
$visit->click('#card-job-'.$this->job->id.'-open')
|
||||||
->assertScript('document.getElementById("job-editor-dialog").open', true)
|
->assertScript('document.getElementById("job-editor-dialog").open', true)
|
||||||
->assertSee('Kuvauspäivä')
|
->assertSee('Kuvauspäivä')
|
||||||
|
->click('#job-editor-dialog [aria-controls^="editor-checklist-"]')
|
||||||
|
->click('#job-editor-dialog [aria-controls^="editor-extras-"]')
|
||||||
|
->assertSee('Kuvat (0)')
|
||||||
->assertNoJavaScriptErrors()
|
->assertNoJavaScriptErrors()
|
||||||
->assertNoAccessibilityIssues(level: 2)
|
->assertNoAccessibilityIssues(level: 2)
|
||||||
->keys('#job-editor-name', 'Escape')
|
->keys('#job-editor-name', 'Escape')
|
||||||
|
|||||||
@@ -178,3 +178,15 @@ it('links the job page to its expenses and shows the own expenses by month', fun
|
|||||||
->assertSee('Lokakuu 2026')
|
->assertSee('Lokakuu 2026')
|
||||||
->assertSee('Lokakuun hankinta');
|
->assertSee('Lokakuun hankinta');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('lists an expense of the month\'s last day on the own expenses page', function () {
|
||||||
|
$user = User::factory()->create();
|
||||||
|
ExpenseModel::factory()->create(['customer_job_id' => $this->job->id, 'user_id' => $user->id, 'description' => 'Helmikuun viimeinen hankinta', 'spent_on' => '2026-02-28']);
|
||||||
|
ExpenseModel::factory()->create(['customer_job_id' => $this->job->id, 'user_id' => $user->id, 'description' => 'Maaliskuun hankinta', 'spent_on' => '2026-03-01']);
|
||||||
|
|
||||||
|
$this->actingAs($user)
|
||||||
|
->get(route('expenses.mine', ['kuukausi' => '2026-02']))
|
||||||
|
->assertOk()
|
||||||
|
->assertSee('Helmikuun viimeinen hankinta')
|
||||||
|
->assertDontSee('Maaliskuun hankinta');
|
||||||
|
});
|
||||||
|
|||||||
@@ -126,3 +126,30 @@ it('lets a subcontractor only look at their own job and tick its tasks', functio
|
|||||||
|
|
||||||
expect($task->fresh()->status->value)->toBe('done');
|
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('Tarkistuslista')
|
||||||
|
->assertSee('Kommentit ja kuvat (kommentit 0, kuvat 0)')
|
||||||
|
->assertSeeLivewire('jobs::task-checklist')
|
||||||
|
->assertSeeLivewire('jobs::task-comments')
|
||||||
|
->assertSeeLivewire('jobs::task-images')
|
||||||
|
->assertSeeHtml('editor-task-'.$task->id.'-tabs-tab-comments')
|
||||||
|
->assertSeeHtml('editor-task-'.$task->id.'-tabs-tab-images');
|
||||||
|
});
|
||||||
|
|||||||
@@ -166,3 +166,13 @@ it('keeps subcontractors to their own jobs and blocks removing tasks with hours'
|
|||||||
$this->actingAs(User::factory()->subcontractor()->create());
|
$this->actingAs(User::factory()->subcontractor()->create());
|
||||||
$this->get(route('time.task', $this->task->id))->assertForbidden();
|
$this->get(route('time.task', $this->task->id))->assertForbidden();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('counts the hours of Sunday in the week', function () {
|
||||||
|
$sunday = now()->startOfWeek()->addDays(6)->toDateString();
|
||||||
|
TimeEntryModel::factory()->create(['task_id' => $this->task->id, 'user_id' => $this->employee->id, 'worked_on' => $sunday, 'hours' => 2]);
|
||||||
|
|
||||||
|
$sheet = Livewire::test('time::week')->instance()->sheet;
|
||||||
|
|
||||||
|
expect($sheet->totalQuarters)->toBe(8)
|
||||||
|
->and($sheet->dayTotals[$sunday])->toBe(8);
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user