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

44 lines
1.1 KiB
JavaScript

import ngModule from '../../module';
import Section from 'salix/components/section';
import './style.scss';
class Controller extends Section {
$onInit() {
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;
});
}
}
ngModule.component('vnTravelThermographIndex', {
template: require('./index.html'),
controller: Controller,
require: {
card: '^vnTravelCard'
},
bindings: {
travel: '<'
}
});