salix/modules/claim/front/summary/index.js

63 lines
1.3 KiB
JavaScript
Raw Normal View History

2018-09-05 11:47:15 +00:00
import ngModule from '../module';
2020-11-23 12:41:51 +00:00
import Summary from 'salix/components/summary';
import './style.scss';
2018-09-05 11:47:15 +00:00
2020-11-23 12:41:51 +00:00
class Controller extends Summary {
2020-06-12 12:28:29 +00:00
constructor($element, $, vnFile) {
super($element, $);
this.vnFile = vnFile;
}
2020-03-18 14:47:38 +00:00
$onChanges() {
if (this.claim && this.claim.id)
this.getSummary();
}
get isSalesPerson() {
return this.aclService.hasAny(['salesPerson']);
}
get isClaimManager() {
return this.aclService.hasAny(['claimManager']);
}
2020-03-18 14:47:38 +00:00
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();
}
2018-09-05 11:47:15 +00:00
getSummary() {
this.$http.get(`Claims/${this.claim.id}/getSummary`).then(response => {
2018-09-05 11:47:15 +00:00
this.summary = response.data;
});
}
2020-06-12 12:28:29 +00:00
getImagePath(dmsId) {
return this.vnFile.getPath(`/api/dms/${dmsId}/downloadFile`);
}
2018-09-05 11:47:15 +00:00
}
2020-06-12 12:28:29 +00:00
Controller.$inject = ['$element', '$scope', 'vnFile'];
ngModule.vnComponent('vnClaimSummary', {
2018-09-05 11:47:15 +00:00
template: require('./index.html'),
controller: Controller,
bindings: {
claim: '<'
}
});