diff --git a/modules/item/front/ticket-descriptor/addStowaway.js b/modules/item/front/ticket-descriptor/addStowaway.js index d61d88a66..4c05bb65c 100644 --- a/modules/item/front/ticket-descriptor/addStowaway.js +++ b/modules/item/front/ticket-descriptor/addStowaway.js @@ -18,8 +18,9 @@ class Controller { addStowaway(index) { let params = {id: this.possibleStowaways[index].id, shipFk: this.ticket.id}; this.$http.post(`/api/Stowaways/`, params) - .then(() => { - this.card.reload(); + .then(res => { + this.ticket.ship.push = res.data[0]; + this.hide; }); } @@ -39,8 +40,5 @@ ngModule.component('vnAddStowaway', { controller: Controller, bindings: { ticket: '<' - }, - require: { - card: '^vnTicketCard' } }); diff --git a/modules/item/front/ticket-descriptor/removeStowaway.js b/modules/item/front/ticket-descriptor/removeStowaway.js index 60b40d91c..0ab62b69e 100644 --- a/modules/item/front/ticket-descriptor/removeStowaway.js +++ b/modules/item/front/ticket-descriptor/removeStowaway.js @@ -45,7 +45,15 @@ class Controller { deleteStowaway(response) { if (response === 'ACCEPT') { this.$http.delete(`/api/Stowaways/${this.stowawayToDelete.id}`).then(res => { - this.card.reload(); + 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(); }); } } @@ -71,8 +79,5 @@ ngModule.component('vnRemoveStowaway', { controller: Controller, bindings: { ticket: '<' - }, - require: { - card: '^vnTicketCard' } }); diff --git a/modules/ticket/back/methods/ticket/getPossibleStowaways.js b/modules/ticket/back/methods/ticket/getPossibleStowaways.js index 045e0595c..4ff5fa9d5 100644 --- a/modules/ticket/back/methods/ticket/getPossibleStowaways.js +++ b/modules/ticket/back/methods/ticket/getPossibleStowaways.js @@ -29,6 +29,7 @@ module.exports = Self => { let possibleStowaways = await Self.app.models.Ticket.find({ where: { + id: {neq: ticketFk}, clientFk: ship.clientFk, addressFk: ship.addressFk, agencyModeFk: ship.agencyModeFk, diff --git a/modules/ticket/front/card/index.js b/modules/ticket/front/card/index.js index 94a35f02a..cfd60800d 100644 --- a/modules/ticket/front/card/index.js +++ b/modules/ticket/front/card/index.js @@ -7,9 +7,9 @@ class Controller { this.filter = { include: [ {relation: 'warehouse', scope: {fields: ['name']}}, - // {relation: 'ship'}, + {relation: 'ship'}, {relation: 'agencyMode', scope: {fields: ['name']}}, - // {relation: 'stowaway'}, + {relation: 'stowaway'}, { relation: 'client', scope: {