From d68912487116fc1dc27bb0392be55e3eabe05526 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 15 Nov 2023 20:47:56 +1100 Subject: [PATCH] Invoice task status badges --- app/Models/Task.php | 12 ++++++++++++ .../components/livewire/tasks-table.blade.php | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/Models/Task.php b/app/Models/Task.php index df8fd59603b5..8e5eff798767 100644 --- a/app/Models/Task.php +++ b/app/Models/Task.php @@ -162,6 +162,18 @@ class Task extends BaseModel return $this->belongsTo(TaskStatus::class)->withTrashed(); } + public function stringStatus() + { + if($this->invoice_id) + return '
'.ctrans('texts.invoiced').'
'; + + if($this->status) + return '
' . $this->status?->name ?? ''; + + return ''; + + } + public function invoice() { return $this->belongsTo(Invoice::class)->withTrashed(); diff --git a/resources/views/portal/ninja2020/components/livewire/tasks-table.blade.php b/resources/views/portal/ninja2020/components/livewire/tasks-table.blade.php index 30e3b7b0e5d9..0336ae4575ad 100644 --- a/resources/views/portal/ninja2020/components/livewire/tasks-table.blade.php +++ b/resources/views/portal/ninja2020/components/livewire/tasks-table.blade.php @@ -47,7 +47,7 @@ {{ $task->project?->name }} - {{ $task->status?->name }} + {!! $task->stringStatus() !!} {{ \Carbon\CarbonInterval::seconds($task->calcDuration())->cascade()->forHumans() }}