This commit is contained in:
Benjamin Beganović 2021-09-06 17:39:25 +02:00
parent f179831e06
commit 6ee51e87bc
2 changed files with 19 additions and 0 deletions

View File

@ -22,6 +22,7 @@ use App\Models\Payment;
use App\Models\Project; use App\Models\Project;
use App\Models\Quote; use App\Models\Quote;
use App\Models\RecurringInvoice; use App\Models\RecurringInvoice;
use App\Models\Task;
use App\Utils\Traits\WithSorting; use App\Utils\Traits\WithSorting;
use Livewire\Component; use Livewire\Component;
use Livewire\WithPagination; use Livewire\WithPagination;
@ -93,6 +94,10 @@ class DocumentsTable extends Component
$this->query = $this->recurringInvoices(); $this->query = $this->recurringInvoices();
break; break;
case 'tasks':
$this->query = $this->tasks();
break;
default: default:
$this->query = $this->documents(); $this->query = $this->documents();
break; break;
@ -159,4 +164,12 @@ class DocumentsTable extends Component
$query->where('client_id', $this->client->id); $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);
});
}
} }

View File

@ -47,6 +47,12 @@
wire:click="updateResources('recurringInvoices')" /> wire:click="updateResources('recurringInvoices')" />
{{ ctrans('texts.recurring_invoices') }} {{ ctrans('texts.recurring_invoices') }}
</button> </button>
<button
class="button border border-transparent hover:border-gray-600 {{ $tab === 'tasks' ? 'border-gray-600' : '' }}"ž
wire:click="updateResources('tasks')" />
{{ ctrans('texts.tasks') }}
</button>
</div> </div>
<div class="flex items-center justify-between mt-6"> <div class="flex items-center justify-between mt-6">