salix/modules/ticket/front/descriptor/addStowaway.js

42 lines
1008 B
JavaScript
Raw Normal View History

2019-01-18 12:36:13 +00:00
import ngModule from '../module';
2019-10-10 06:07:11 +00:00
import './style.scss';
2019-01-18 12:36:13 +00:00
class Controller {
2019-09-25 09:26:12 +00:00
constructor($stateParams, $, $http, vnApp, $translate) {
this.vnApp = vnApp;
this.$translate = $translate;
this.$ = $;
2019-09-25 09:26:12 +00:00
this.$stateParams = $stateParams;
2019-01-18 12:36:13 +00:00
this.$http = $http;
}
2019-09-25 09:26:12 +00:00
addStowaway(stowaway) {
let params = {id: stowaway.id, shipFk: this.ticket.id};
this.$http.post(`Stowaways/`, params)
.then(() => {
this.cardReload();
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
2019-06-21 11:19:51 +00:00
this.$.dialog.hide();
2019-01-18 12:36:13 +00:00
});
}
show() {
this.$.dialog.show();
2019-01-18 12:36:13 +00:00
}
hide() {
this.$.dialog.hide();
2019-01-18 12:36:13 +00:00
}
}
2019-09-25 09:26:12 +00:00
Controller.$inject = ['$stateParams', '$scope', '$http', 'vnApp', '$translate'];
2019-01-18 12:36:13 +00:00
ngModule.component('vnAddStowaway', {
template: require('./addStowaway.html'),
controller: Controller,
bindings: {
ticket: '<',
cardReload: '&?'
2019-01-18 12:36:13 +00:00
}
});