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

44 lines
1.1 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 {
$onInit() {
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.$translate.instant('Thermograph deleted'));
this.$.model.remove(this.thermographIndex);
this.thermographIndex = null;
});
}
2020-01-13 10:53:10 +00:00
}
2020-01-17 07:43:10 +00:00
ngModule.component('vnTravelThermographIndex', {
2020-01-13 10:53:10 +00:00
template: require('./index.html'),
controller: Controller,
require: {
card: '^vnTravelCard'
},
bindings: {
travel: '<'
}
});