feat: services quick search.

This commit is contained in:
a.bouhuolia
2021-08-07 20:37:11 +02:00
parent fad9052da8
commit 1b90610cec
39 changed files with 380 additions and 204 deletions

View File

@@ -5,10 +5,12 @@ import ModelSetting from './ModelSetting';
import SaleInvoiceMeta from './SaleInvoice.Settings';
import CustomViewBaseModel from './CustomViewBaseModel';
import { DEFAULT_VIEWS } from 'services/Sales/constants';
import ModelSearchable from './ModelSearchable';
export default class SaleInvoice extends mixin(TenantModel, [
ModelSetting,
CustomViewBaseModel,
ModelSearchable,
]) {
/**
* Table name
@@ -371,4 +373,22 @@ export default class SaleInvoice extends mixin(TenantModel, [
static get defaultViews() {
return DEFAULT_VIEWS;
}
}
/**
* Model searchable.
*/
static get searchable() {
return true;
}
/**
* Model search attributes.
*/
static get searchRoles() {
return [
{ fieldKey: 'invoice_no', comparator: 'contains' },
{ condition: 'or', fieldKey: 'reference_no', comparator: 'contains' },
{ condition: 'or', fieldKey: 'amount', comparator: 'equals' },
];
}
}