salix/modules/client/front/descriptor/index.js

51 lines
1.1 KiB
JavaScript
Raw Normal View History

2017-06-03 11:01:47 +00:00
import ngModule from '../module';
2018-05-23 12:26:51 +00:00
class Controller {
constructor($http, $state) {
this.$state = $state;
this.$http = $http;
2018-08-02 08:06:11 +00:00
}
set client(value) {
this._client = value;
if (!value) return;
this._quicklinks = {
btnOne: {
icon: 'icon-ticket',
2018-09-04 09:49:00 +00:00
state: `ticket.index({q: '{"clientFk": ${value.id}}'})`,
tooltip: 'Client ticket list'
},
btnTwo: {
icon: 'shopping_cart',
state: `order.create({clientFk: ${value.id}})`,
tooltip: 'New order'
}
};
}
2018-08-02 08:06:11 +00:00
get client() {
return this._client;
}
set quicklinks(value = {}) {
2018-08-02 08:06:11 +00:00
this._quicklinks = Object.assign(value, this._quicklinks);
}
get quicklinks() {
return this._quicklinks;
}
}
2018-05-31 06:57:25 +00:00
Controller.$inject = ['$http', '$state'];
ngModule.component('vnClientDescriptor', {
2018-05-23 12:26:51 +00:00
template: require('./index.html'),
bindings: {
client: '<',
quicklinks: '<'
},
2018-05-23 12:26:51 +00:00
controller: Controller
2017-06-03 11:01:47 +00:00
});