salix/client/client/src/index/index.js

47 lines
1.1 KiB
JavaScript
Raw Normal View History

2017-06-03 11:01:47 +00:00
import ngModule from '../module';
2017-02-21 10:36:43 +00:00
import './item-client';
2017-06-03 11:01:47 +00:00
export default class Controller {
constructor($scope) {
this.$ = $scope;
this.clientSelected = null;
2017-07-03 12:23:53 +00:00
}
exprBuilder(param, value) {
switch (param) {
case 'search':
2018-07-03 15:41:41 +00:00
return /^\d+$/.test(value)
? {id: value}
: {name: {regexp: value}};
case 'phone':
return {
or: [
{phone: value},
{mobile: value}
]
};
case 'name':
case 'socialName':
case 'city':
return {[param]: {regexp: value}};
case 'id':
case 'fi':
case 'postcode':
case 'email':
case 'salesPersonFk':
return {[param]: value};
}
}
openSummary(client) {
this.clientSelected = client;
this.$.dialogSummaryClient.show();
}
}
Controller.$inject = ['$scope'];
2017-06-03 11:01:47 +00:00
ngModule.component('vnClientIndex', {
template: require('./index.html'),
controller: Controller
2017-06-03 11:01:47 +00:00
});