salix/modules/supplier/front/address/index/index.js

47 lines
1.1 KiB
JavaScript

import ngModule from '../../module';
import Section from 'salix/components/section';
import './style.scss';
class Controller extends Section {
constructor($element, $) {
super($element, $);
this.filter = {
fields: [
'id',
'nickname',
'street',
'city',
'provinceFk',
'phone',
'mobile',
'postalCode'
],
order: ['nickname ASC'],
include: [{
relation: 'province',
scope: {
fields: ['id', 'name']
}
}]
};
}
exprBuilder(param, value) {
switch (param) {
case 'search':
return /^\d+$/.test(value)
? {id: value}
: {nickname: {like: `%${value}%`}};
}
}
}
Controller.$inject = ['$element', '$scope'];
ngModule.vnComponent('vnSupplierAddressIndex', {
template: require('./index.html'),
controller: Controller,
bindings: {
supplier: '<'
}
});