mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
feat: custom view dynamic filter.
This commit is contained in:
@@ -9,8 +9,13 @@ import AccountTypesUtils from 'lib/AccountTypes';
|
||||
import AccountSettings from './Account.Settings';
|
||||
import ModelSettings from './ModelSetting';
|
||||
import { ACCOUNT_TYPES } from 'data/AccountTypes';
|
||||
import CustomViewBaseModel from './CustomViewBaseModel';
|
||||
import { DEFAULT_VIEWS } from 'services/Accounts/constants';
|
||||
|
||||
export default class Account extends mixin(TenantModel, [ModelSettings]) {
|
||||
export default class Account extends mixin(TenantModel, [
|
||||
ModelSettings,
|
||||
CustomViewBaseModel,
|
||||
]) {
|
||||
/**
|
||||
* Table name.
|
||||
*/
|
||||
@@ -135,7 +140,7 @@ export default class Account extends mixin(TenantModel, [ModelSettings]) {
|
||||
*/
|
||||
filterByAccountNormal(query, accountNormal) {
|
||||
const filterTypes = ACCOUNT_TYPES.filter(
|
||||
(accountType) => accountType.normal === accountNormal,
|
||||
(accountType) => accountType.normal === accountNormal
|
||||
).map((accountType) => accountType.key);
|
||||
|
||||
query.whereIn('account_type', filterTypes);
|
||||
@@ -248,4 +253,11 @@ export default class Account extends mixin(TenantModel, [ModelSettings]) {
|
||||
static get meta() {
|
||||
return AccountSettings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the default custom views, roles and columns.
|
||||
*/
|
||||
static get defaultViews() {
|
||||
return DEFAULT_VIEWS;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user