Add comments to tasks
Everyone who may change a task's status (attached subcontractors too) comments on it on the job page. Authors edit and remove their own comments; admin and management may remove anyone's (jobs.remove-any-task-comment). Edited comments show when they were edited, and task cards show the number of comments. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
@@ -18,6 +18,7 @@ use Illuminate\Support\Facades\Gate;
|
||||
use App\Modules\Shared\Domain\ValueObjects\Money;
|
||||
use Livewire\Attributes\Computed;
|
||||
use Livewire\Attributes\Locked;
|
||||
use Livewire\Attributes\On;
|
||||
use Livewire\Component;
|
||||
|
||||
/**
|
||||
@@ -79,6 +80,15 @@ new class extends Component
|
||||
return app(TaskQueries::class)->tasksOf($this->jobId);
|
||||
}
|
||||
|
||||
/**
|
||||
* A task's comments changed: the task cards show their number.
|
||||
*/
|
||||
#[On('task-comments-changed')]
|
||||
public function refreshTasks(): void
|
||||
{
|
||||
unset($this->tasks);
|
||||
}
|
||||
|
||||
public function changeTaskStatus(int $taskId, string $status, ChangeTaskStatus $changeStatus): void
|
||||
{
|
||||
$this->authorize('jobs.update-task-status', $this->jobId);
|
||||
@@ -403,6 +413,12 @@ new class extends Component
|
||||
<dt class="font-medium">{{ __('jobs.tasks.fields.status') }}:</dt>
|
||||
<dd>{{ __('jobs.tasks.statuses.'.$task->status->value) }}</dd>
|
||||
</div>
|
||||
@if ($task->commentCount > 0)
|
||||
<div class="flex flex-wrap gap-x-1">
|
||||
<dt class="font-medium">{{ __('jobs.tasks.comments.title') }}:</dt>
|
||||
<dd>{{ $task->commentCount }}</dd>
|
||||
</div>
|
||||
@endif
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
@@ -438,6 +454,8 @@ new class extends Component
|
||||
|
||||
<livewire:jobs::task-checklist :job-id="$job->id" :task-id="$task->id" :task-title="$task->title" :wire:key="'checklist-'.$task->id" />
|
||||
|
||||
<livewire:jobs::task-comments :job-id="$job->id" :task-id="$task->id" :task-title="$task->title" :wire:key="'comments-'.$task->id" />
|
||||
|
||||
<div class="flex flex-wrap items-end gap-3">
|
||||
@if ($canChangeStatus)
|
||||
<div class="w-full sm:w-56">
|
||||
|
||||
Reference in New Issue
Block a user