added multi-select filters everywhere

This commit is contained in:
denisdulici
2018-11-02 11:32:42 +03:00
parent b0a7e98e4e
commit 9a85bb9f5a
25 changed files with 202 additions and 86 deletions

View File

@ -14,8 +14,8 @@ class Reconciliations extends ModelFilter
*/
public $relations = [];
public function account($account)
public function accounts($accounts)
{
return $this->where('account_id', $account);
return $this->whereIn('account_id', (array) $accounts);
}
}

View File

@ -14,19 +14,19 @@ class Transactions extends ModelFilter
*/
public $relations = [];
public function account($account_id)
public function accounts($accounts)
{
return $this->where('account_id', $account_id);
return $this->whereIn('account_id', (array) $accounts);
}
public function category($category_id)
public function categories($categories)
{
// No category for bills/invoices
if (in_array($this->getModel()->getTable(), ['bill_payments', 'invoice_payments'])) {
return $this;
}
return $this->where('category_id', $category_id);
return $this->whereIn('category_id', (array) $categories);
}
public function date($date)

View File

@ -19,8 +19,8 @@ class Items extends ModelFilter
return $this->whereLike('name', $query);
}
public function category($id)
public function categories($ids)
{
return $this->where('category_id', $id);
return $this->whereIn('category_id', (array) $ids);
}
}

View File

@ -19,14 +19,19 @@ class Bills extends ModelFilter
return $this->whereLike('vendor_name', $query);
}
public function vendor($vendor)
public function vendors($vendors)
{
return $this->where('vendor_id', $vendor);
return $this->whereIn('vendor_id', (array) $vendors);
}
public function status($status)
public function categories($categories)
{
return $this->where('bill_status_code', $status);
return $this->whereIn('category_id', (array) $categories);
}
public function statuses($statuses)
{
return $this->whereIn('bill_status_code', (array) $statuses);
}
public function billDate($date)

View File

@ -19,19 +19,19 @@ class Payments extends ModelFilter
return $this->whereLike('description', $query);
}
public function vendor($vendor)
public function vendors($vendors)
{
return $this->where('vendor_id', $vendor);
return $this->whereIn('vendor_id', (array) $vendors);
}
public function category($category)
public function categories($categories)
{
return $this->where('category_id', $category);
return $this->whereIn('category_id', (array) $categories);
}
public function account($account)
public function accounts($accounts)
{
return $this->where('account_id', $account);
return $this->whereIn('account_id', (array) $accounts);
}
public function date($date)

View File

@ -19,14 +19,19 @@ class Invoices extends ModelFilter
return $this->whereLike('customer_name', $query);
}
public function customer($customer)
public function customers($customers)
{
return $this->where('customer_id', $customer);
return $this->whereIn('customer_id', (array) $customers);
}
public function status($status)
public function categories($categories)
{
return $this->where('invoice_status_code', $status);
return $this->whereIn('category_id', (array) $categories);
}
public function statuses($statuses)
{
return $this->whereIn('invoice_status_code', (array) $statuses);
}
public function invoiceDate($date)

View File

@ -19,19 +19,19 @@ class Revenues extends ModelFilter
return $this->whereLike('description', $query);
}
public function customer($customer)
public function customers($customers)
{
return $this->where('customer_id', $customer);
return $this->whereIn('customer_id', (array) $customers);
}
public function category($category)
public function categories($categories)
{
return $this->where('category_id', $category);
return $this->whereIn('category_id', (array) $categories);
}
public function account($account)
public function accounts($accounts)
{
return $this->where('account_id', $account);
return $this->whereIn('account_id', (array) $accounts);
}
public function date($date)

View File

@ -19,8 +19,8 @@ class Categories extends ModelFilter
return $this->whereLike('name', $query);
}
public function type($type)
public function types($types)
{
return $this->where('type', $type);
return $this->whereIn('type', (array) $types);
}
}