Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into dev
This commit is contained in:
commit
cf10365bc8
|
@ -1,7 +1,9 @@
|
|||
import ngModule from '../module';
|
||||
|
||||
class Controller {
|
||||
constructor($state, $scope, $http) {
|
||||
constructor($state, $scope, $http, vnApp, $translate) {
|
||||
this.vnApp = vnApp;
|
||||
this.$translate = $translate;
|
||||
this.$scope = $scope;
|
||||
this.$state = $state;
|
||||
this.$http = $http;
|
||||
|
@ -17,9 +19,9 @@ class Controller {
|
|||
addStowaway(index) {
|
||||
let params = {id: this.possibleStowaways[index].id, shipFk: this.ticket.id};
|
||||
this.$http.post(`/api/Stowaways/`, params)
|
||||
.then(res => {
|
||||
this.ticket.ship.push = res.data[0];
|
||||
this.hide;
|
||||
.then(() => {
|
||||
this.card.reload();
|
||||
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -39,5 +41,8 @@ ngModule.component('vnAddStowaway', {
|
|||
controller: Controller,
|
||||
bindings: {
|
||||
ticket: '<'
|
||||
},
|
||||
require: {
|
||||
card: '^vnTicketCard'
|
||||
}
|
||||
});
|
||||
|
|
|
@ -95,7 +95,7 @@
|
|||
<vn-button-menu
|
||||
ng-if="$ctrl.ticket.ship.length > 1"
|
||||
vn-id="stowaways-button"
|
||||
icon="icon-polizon"
|
||||
icon="icon-stowaway"
|
||||
show-filter="false"
|
||||
show-field="id"
|
||||
value-field="id"
|
||||
|
|
|
@ -40,7 +40,8 @@ class Controller {
|
|||
shouldShowRemoveStowaway() {
|
||||
if (!this._ticket)
|
||||
return false;
|
||||
return (this._ticket.stowaway || (this._ticket.ship && this._ticket.ship.length > 1));
|
||||
|
||||
return (this._ticket.stowaway || (this._ticket.ship && this._ticket.ship.length > 0));
|
||||
}
|
||||
|
||||
onMoreChange(callback) {
|
||||
|
@ -124,7 +125,7 @@ class Controller {
|
|||
}};
|
||||
if (value.stowaway) {
|
||||
links.btnTwo = {
|
||||
icon: 'icon-polizon',
|
||||
icon: 'icon-stowaway',
|
||||
state: `ticket.card.summary({id: ${value.stowaway.shipFk}})`,
|
||||
tooltip: 'Ship'
|
||||
};
|
||||
|
@ -132,7 +133,7 @@ class Controller {
|
|||
|
||||
if (value.ship && value.ship.length == 1) {
|
||||
links.btnThree = {
|
||||
icon: 'icon-polizon',
|
||||
icon: 'icon-stowaway',
|
||||
state: `ticket.card.summary({id: ${value.ship[0].id}})`,
|
||||
tooltip: 'Stowaway'
|
||||
};
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
import ngModule from '../module';
|
||||
|
||||
class Controller {
|
||||
constructor($state, $scope, $http) {
|
||||
constructor($state, $scope, $http, vnApp, $translate) {
|
||||
this.vnApp = vnApp;
|
||||
this.$translate = $translate;
|
||||
this.$scope = $scope;
|
||||
this.$state = $state;
|
||||
this.$http = $http;
|
||||
|
@ -44,15 +46,8 @@ class Controller {
|
|||
deleteStowaway(response) {
|
||||
if (response === 'ACCEPT') {
|
||||
this.$http.delete(`/api/Stowaways/${this.stowawayToDelete.id}`).then(res => {
|
||||
if (this.ticket.stowaway)
|
||||
delete this.ticket.stowaway;
|
||||
else {
|
||||
for (let i = 0; i < this.ticket.ship.length; i++) {
|
||||
if (this.ticket.ship[i].id === this.stowawayToDelete.id)
|
||||
delete this.ticket.ship[i];
|
||||
}
|
||||
}
|
||||
this.hide();
|
||||
this.card.reload();
|
||||
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -78,5 +73,8 @@ ngModule.component('vnRemoveStowaway', {
|
|||
controller: Controller,
|
||||
bindings: {
|
||||
ticket: '<'
|
||||
},
|
||||
require: {
|
||||
card: '^vnTicketCard'
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue