Fix status filters (#3700)

This commit is contained in:
Benjamin Beganović 2020-05-14 03:05:18 +02:00 committed by GitHub
parent a613cfed7c
commit 5d54d4313a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View File

@ -31,7 +31,6 @@ class InvoicesTable extends Component
public function render()
{
$query = Invoice::query()
->where('company_id', auth('contact')->user()->company->id)
->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc');
if (in_array('paid', $this->status)) {
@ -48,7 +47,9 @@ class InvoicesTable extends Component
->orWhere('partial_due_date', '<', Carbon::now());
}
$query = $query->paginate($this->per_page);
$query = $query
->where('company_id', auth('contact')->user()->company->id)
->paginate($this->per_page);
return render('components.livewire.invoices-table', [
'invoices' => $query,

View File

@ -27,9 +27,8 @@ class QuotesTable extends Component
public function render()
{
$query = Quote::query()
->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc')
->where('company_id', auth('contact')->user()->company->id);
->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc');
if (in_array('draft', $this->status)) {
$query = $query->orWhere('status_id', Quote::STATUS_DRAFT);
}
@ -46,7 +45,9 @@ class QuotesTable extends Component
$query = $query->orWhere('status_id', Quote::STATUS_EXPIRED);
}
$query = $query->paginate($this->per_page);
$query = $query
->where('company_id', auth('contact')->user()->company->id)
->paginate($this->per_page);
return render('components.livewire.quotes-table', [
'quotes' => $query