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

51 lines
1.1 KiB
JavaScript

import ngModule from '../module';
class Controller {
constructor($http, $state) {
this.$state = $state;
this.$http = $http;
}
set client(value) {
this._client = value;
if (!value) return;
this._quicklinks = {
btnOne: {
icon: 'icon-ticket',
state: `ticket.index({q: '{"clientFk": ${value.id}}'})`,
tooltip: 'Client ticket list'
},
btnTwo: {
icon: 'shopping_cart',
state: `order.create({clientFk: ${value.id}})`,
tooltip: 'New order'
}
};
}
get client() {
return this._client;
}
set quicklinks(value = {}) {
this._quicklinks = Object.assign(value, this._quicklinks);
}
get quicklinks() {
return this._quicklinks;
}
}
Controller.$inject = ['$http', '$state'];
ngModule.component('vnClientDescriptor', {
template: require('./index.html'),
bindings: {
client: '<',
quicklinks: '<'
},
controller: Controller
});