salix/modules/travel/front/thermograph/index/index.js

52 lines
1.3 KiB
JavaScript
Raw Normal View History

2020-01-17 07:43:10 +00:00
import ngModule from '../../module';
2020-03-18 11:55:22 +00:00
import Section from 'salix/components/section';
2020-01-13 10:53:10 +00:00
import './style.scss';
2020-03-18 11:55:22 +00:00
class Controller extends Section {
2020-06-12 12:28:29 +00:00
constructor($element, $, vnFile) {
super($element, $);
this.vnFile = vnFile;
2020-01-13 10:53:10 +00:00
this.filter = {
include:
{relation: 'warehouse',
scope: {
fields: ['id', 'name']
}
}
};
}
showDeleteConfirm(index) {
this.thermographIndex = index;
this.$.confirm.show();
}
deleteThermograph() {
const data = this.travelThermographs;
const thermographId = data[this.thermographIndex].id;
const query = `Travels/deleteThermograph?id=${thermographId}`;
this.$http.delete(query).then(() => {
this.vnApp.showSuccess(this.$t('Thermograph deleted'));
this.$.model.remove(this.thermographIndex);
this.thermographIndex = null;
});
}
2020-06-12 12:28:29 +00:00
downloadFile(dmsId) {
this.vnFile.download(`api/dms/${dmsId}/downloadFile`);
}
2020-01-13 10:53:10 +00:00
}
2020-06-12 12:28:29 +00:00
Controller.$inject = ['$element', '$scope', 'vnFile'];
ngModule.vnComponent('vnTravelThermographIndex', {
2020-01-13 10:53:10 +00:00
template: require('./index.html'),
controller: Controller,
require: {
card: '^vnTravelCard'
},
bindings: {
travel: '<'
}
});