2018-04-26 14:41:08 +00:00
|
|
|
import ngModule from '../module';
|
|
|
|
import Component from 'core/src/lib/component';
|
|
|
|
import './style.scss';
|
|
|
|
|
|
|
|
class Controller extends Component {
|
2018-08-08 12:45:29 +00:00
|
|
|
constructor($element, $scope, $http) {
|
2018-04-26 14:41:08 +00:00
|
|
|
super($element, $scope);
|
|
|
|
this.$http = $http;
|
2018-08-02 08:06:11 +00:00
|
|
|
this._quicklinks = {};
|
2018-04-26 14:41:08 +00:00
|
|
|
this.isTooltip = true;
|
|
|
|
this.clear();
|
|
|
|
}
|
|
|
|
|
2018-08-08 12:45:29 +00:00
|
|
|
set itemFk(id) {
|
|
|
|
this._itemFk = id;
|
|
|
|
|
|
|
|
if (id) {
|
|
|
|
this._getItem();
|
|
|
|
} else
|
|
|
|
this.clear();
|
|
|
|
}
|
|
|
|
|
2018-08-01 10:15:09 +00:00
|
|
|
set quicklinks(value = {}) {
|
2018-08-02 08:06:11 +00:00
|
|
|
this._quicklinks = Object.assign(value, this._quicklinks);
|
2018-08-01 10:15:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
get quicklinks() {
|
|
|
|
return this._quicklinks;
|
|
|
|
}
|
|
|
|
|
2018-04-26 14:41:08 +00:00
|
|
|
clear() {
|
|
|
|
this.item = null;
|
|
|
|
this.tags = {};
|
|
|
|
this.itemTags = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
show() {
|
|
|
|
this.$.popover.parent = this.parent;
|
|
|
|
this.$.popover.show();
|
|
|
|
}
|
|
|
|
_getItem() {
|
2018-08-08 12:45:29 +00:00
|
|
|
this.$http.get(`/item/api/Items/${this._itemFk}/getCard`).then(response => {
|
|
|
|
this.item = response.data;
|
|
|
|
});
|
2018-04-26 14:41:08 +00:00
|
|
|
}
|
|
|
|
}
|
2018-08-08 12:45:29 +00:00
|
|
|
Controller.$inject = ['$element', '$scope', '$http'];
|
2018-04-26 14:41:08 +00:00
|
|
|
|
|
|
|
ngModule.component('vnItemDescriptorPopover', {
|
2018-05-25 08:03:45 +00:00
|
|
|
template: require('./index.html'),
|
2018-04-26 14:41:08 +00:00
|
|
|
bindings: {
|
2018-08-01 10:15:09 +00:00
|
|
|
itemFk: '<',
|
|
|
|
quicklinks: '<'
|
2018-04-26 14:41:08 +00:00
|
|
|
},
|
|
|
|
controller: Controller
|
|
|
|
});
|