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