stowaway fixes

This commit is contained in:
Gerard 2019-01-21 08:44:21 +01:00
parent 6e43b11e16
commit ea0504db21
4 changed files with 15 additions and 11 deletions

View File

@ -18,8 +18,9 @@ class Controller {
addStowaway(index) { addStowaway(index) {
let params = {id: this.possibleStowaways[index].id, shipFk: this.ticket.id}; let params = {id: this.possibleStowaways[index].id, shipFk: this.ticket.id};
this.$http.post(`/api/Stowaways/`, params) this.$http.post(`/api/Stowaways/`, params)
.then(() => { .then(res => {
this.card.reload(); this.ticket.ship.push = res.data[0];
this.hide;
}); });
} }
@ -39,8 +40,5 @@ ngModule.component('vnAddStowaway', {
controller: Controller, controller: Controller,
bindings: { bindings: {
ticket: '<' ticket: '<'
},
require: {
card: '^vnTicketCard'
} }
}); });

View File

@ -45,7 +45,15 @@ class Controller {
deleteStowaway(response) { deleteStowaway(response) {
if (response === 'ACCEPT') { if (response === 'ACCEPT') {
this.$http.delete(`/api/Stowaways/${this.stowawayToDelete.id}`).then(res => { 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, controller: Controller,
bindings: { bindings: {
ticket: '<' ticket: '<'
},
require: {
card: '^vnTicketCard'
} }
}); });

View File

@ -29,6 +29,7 @@ module.exports = Self => {
let possibleStowaways = await Self.app.models.Ticket.find({ let possibleStowaways = await Self.app.models.Ticket.find({
where: { where: {
id: {neq: ticketFk},
clientFk: ship.clientFk, clientFk: ship.clientFk,
addressFk: ship.addressFk, addressFk: ship.addressFk,
agencyModeFk: ship.agencyModeFk, agencyModeFk: ship.agencyModeFk,

View File

@ -7,9 +7,9 @@ class Controller {
this.filter = { this.filter = {
include: [ include: [
{relation: 'warehouse', scope: {fields: ['name']}}, {relation: 'warehouse', scope: {fields: ['name']}},
// {relation: 'ship'}, {relation: 'ship'},
{relation: 'agencyMode', scope: {fields: ['name']}}, {relation: 'agencyMode', scope: {fields: ['name']}},
// {relation: 'stowaway'}, {relation: 'stowaway'},
{ {
relation: 'client', relation: 'client',
scope: { scope: {