From d5326f4873f4b6fa121b2bade976fb97dc454a1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Mon, 6 Sep 2021 17:36:58 +0200 Subject: [PATCH] Quotes --- 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 5453aa3eee14..8b5dd48a84ae 100644 --- a/app/Http/Livewire/DocumentsTable.php +++ b/app/Http/Livewire/DocumentsTable.php @@ -20,6 +20,7 @@ use App\Models\Expense; use App\Models\Invoice; use App\Models\Payment; use App\Models\Project; +use App\Models\Quote; use App\Utils\Traits\WithSorting; use Livewire\Component; use Livewire\WithPagination; @@ -83,6 +84,10 @@ class DocumentsTable extends Component $this->query = $this->projects(); break; + case 'quotes': + $this->query = $this->quotes(); + break; + default: $this->query = $this->documents(); break; @@ -133,4 +138,12 @@ class DocumentsTable extends Component $query->where('client_id', $this->client->id); }); } + + protected function quotes() + { + return Document::query() + ->whereHasMorph('documentable', [Quote::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 33af7b57f83d..3d0ae7ac2465 100644 --- a/resources/views/portal/ninja2020/components/livewire/documents-table.blade.php +++ b/resources/views/portal/ninja2020/components/livewire/documents-table.blade.php @@ -35,6 +35,12 @@ wire:click="updateResources('projects')" /> {{ ctrans('texts.projects') }} + +