From 6ee51e87bc664fdba826e4d403c85faf68f76345 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Mon, 6 Sep 2021 17:39:25 +0200 Subject: [PATCH] Tasks --- app/Http/Livewire/DocumentsTable.php | 13 +++++++++++++ .../components/livewire/documents-table.blade.php | 6 ++++++ 2 files changed, 19 insertions(+) diff --git a/app/Http/Livewire/DocumentsTable.php b/app/Http/Livewire/DocumentsTable.php index faac2a8463f0..633fb6fe0afa 100644 --- a/app/Http/Livewire/DocumentsTable.php +++ b/app/Http/Livewire/DocumentsTable.php @@ -22,6 +22,7 @@ use App\Models\Payment; use App\Models\Project; use App\Models\Quote; use App\Models\RecurringInvoice; +use App\Models\Task; use App\Utils\Traits\WithSorting; use Livewire\Component; use Livewire\WithPagination; @@ -93,6 +94,10 @@ class DocumentsTable extends Component $this->query = $this->recurringInvoices(); break; + case 'tasks': + $this->query = $this->tasks(); + break; + default: $this->query = $this->documents(); break; @@ -159,4 +164,12 @@ class DocumentsTable extends Component $query->where('client_id', $this->client->id); }); } + + protected function tasks() + { + return Document::query() + ->whereHasMorph('documentable', [Task::class], function ($query) { + $query->where('client_id', $this->client->id); + }); + } } diff --git a/resources/views/portal/ninja2020/components/livewire/documents-table.blade.php b/resources/views/portal/ninja2020/components/livewire/documents-table.blade.php index d226bbcaddce..88a081f31ee8 100644 --- a/resources/views/portal/ninja2020/components/livewire/documents-table.blade.php +++ b/resources/views/portal/ninja2020/components/livewire/documents-table.blade.php @@ -47,6 +47,12 @@ wire:click="updateResources('recurringInvoices')" /> {{ ctrans('texts.recurring_invoices') }} + +