41 lines
990 B
JavaScript
41 lines
990 B
JavaScript
import ngModule from '../module';
|
|
|
|
class Controller {
|
|
constructor($stateParams, $, $http, vnApp, $translate) {
|
|
this.vnApp = vnApp;
|
|
this.$translate = $translate;
|
|
this.$ = $;
|
|
this.$stateParams = $stateParams;
|
|
this.$http = $http;
|
|
}
|
|
|
|
addStowaway(stowaway) {
|
|
let params = {id: stowaway.id, shipFk: this.ticket.id};
|
|
this.$http.post(`/api/Stowaways/`, params)
|
|
.then(() => {
|
|
this.cardReload();
|
|
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
|
this.$.dialog.hide();
|
|
});
|
|
}
|
|
|
|
show() {
|
|
this.$.dialog.show();
|
|
}
|
|
|
|
hide() {
|
|
this.$.dialog.hide();
|
|
}
|
|
}
|
|
|
|
Controller.$inject = ['$stateParams', '$scope', '$http', 'vnApp', '$translate'];
|
|
|
|
ngModule.component('vnAddStowaway', {
|
|
template: require('./addStowaway.html'),
|
|
controller: Controller,
|
|
bindings: {
|
|
ticket: '<',
|
|
cardReload: '&?'
|
|
}
|
|
});
|