import ngModule from '../module'; import Summary from 'salix/components/summary'; import './style.scss'; class Controller extends Summary { constructor($element, $, vnFile) { super($element, $); this.vnFile = vnFile; } $onChanges() { if (this.claim && this.claim.id) this.getSummary(); } get claim() { return this._claim; } set claim(value) { this._claim = value; // Get DMS on summary load if (value) this.$.$applyAsync(() => this.loadDms()); } loadDms() { this.$.model.where = { claimFk: this.claim.id }; this.$.model.refresh(); } getSummary() { this.$http.get(`Claims/${this.claim.id}/getSummary`).then(response => { this.summary = response.data; }); } getImagePath(dmsId) { return this.vnFile.getPath(`/api/dms/${dmsId}/downloadFile`); } } Controller.$inject = ['$element', '$scope', 'vnFile']; ngModule.vnComponent('vnClaimSummary', { template: require('./index.html'), controller: Controller, bindings: { claim: '<' } });