2019-01-18 12:36:13 +00:00
|
|
|
import ngModule from '../module';
|
|
|
|
|
|
|
|
class Controller {
|
2019-02-01 11:11:56 +00:00
|
|
|
constructor($state, $scope, $http, vnApp, $translate) {
|
|
|
|
this.vnApp = vnApp;
|
|
|
|
this.$translate = $translate;
|
2019-01-18 12:36:13 +00:00
|
|
|
this.$scope = $scope;
|
|
|
|
this.$state = $state;
|
|
|
|
this.$http = $http;
|
|
|
|
}
|
|
|
|
|
|
|
|
getPossibleStowaways() {
|
|
|
|
this.$http.get(`/api/Tickets/${this.ticket.id}/getPossibleStowaways`)
|
|
|
|
.then(res => {
|
|
|
|
this.possibleStowaways = res.data;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
addStowaway(index) {
|
|
|
|
let params = {id: this.possibleStowaways[index].id, shipFk: this.ticket.id};
|
|
|
|
this.$http.post(`/api/Stowaways/`, params)
|
2019-02-01 11:11:56 +00:00
|
|
|
.then(() => {
|
2019-02-04 11:24:47 +00:00
|
|
|
this.cardReload();
|
2019-02-01 11:11:56 +00:00
|
|
|
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
2019-01-18 12:36:13 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
show() {
|
|
|
|
this.$scope.dialog.show();
|
|
|
|
}
|
|
|
|
|
|
|
|
hide() {
|
|
|
|
this.$scope.dialog.hide();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Controller.$inject = ['$state', '$scope', '$http', 'vnApp', '$translate'];
|
|
|
|
|
|
|
|
ngModule.component('vnAddStowaway', {
|
|
|
|
template: require('./addStowaway.html'),
|
|
|
|
controller: Controller,
|
|
|
|
bindings: {
|
2019-02-04 11:24:47 +00:00
|
|
|
ticket: '<',
|
|
|
|
cardReload: '&?'
|
2019-01-18 12:36:13 +00:00
|
|
|
}
|
|
|
|
});
|