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) {
|
2019-02-01 11:11:56 +00:00
|
|
|
this.vnApp = vnApp;
|
|
|
|
this.$translate = $translate;
|
2019-06-21 05:41:03 +00:00
|
|
|
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};
|
2019-01-18 12:36:13 +00:00
|
|
|
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-06-21 11:19:51 +00:00
|
|
|
this.$.dialog.hide();
|
2019-01-18 12:36:13 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
show() {
|
2019-06-21 05:41:03 +00:00
|
|
|
this.$.dialog.show();
|
2019-01-18 12:36:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
hide() {
|
2019-06-21 05:41:03 +00:00
|
|
|
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: {
|
2019-02-04 11:24:47 +00:00
|
|
|
ticket: '<',
|
|
|
|
cardReload: '&?'
|
2019-01-18 12:36:13 +00:00
|
|
|
}
|
|
|
|
});
|