47 lines
1.1 KiB
JavaScript
47 lines
1.1 KiB
JavaScript
import ngModule from '../module';
|
|
import './item-client';
|
|
|
|
export default class Controller {
|
|
constructor($scope, $stateParams) {
|
|
this.$ = $scope;
|
|
this.clientSelected = null;
|
|
}
|
|
|
|
exprBuilder(param, value) {
|
|
switch (param) {
|
|
case 'search':
|
|
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', '$stateParams'];
|
|
|
|
ngModule.component('vnClientIndex', {
|
|
template: require('./index.html'),
|
|
controller: Controller
|
|
});
|