Merge branch 'test' into dev
This commit is contained in:
commit
de654f270f
|
@ -20,7 +20,7 @@ class Controller {
|
||||||
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(() => {
|
||||||
this.card.reload();
|
this.cardReload();
|
||||||
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -40,9 +40,7 @@ ngModule.component('vnAddStowaway', {
|
||||||
template: require('./addStowaway.html'),
|
template: require('./addStowaway.html'),
|
||||||
controller: Controller,
|
controller: Controller,
|
||||||
bindings: {
|
bindings: {
|
||||||
ticket: '<'
|
ticket: '<',
|
||||||
},
|
cardReload: '&?'
|
||||||
require: {
|
|
||||||
card: '^vnTicketCard'
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -100,6 +100,7 @@
|
||||||
show-field="id"
|
show-field="id"
|
||||||
value-field="id"
|
value-field="id"
|
||||||
vn-tooltip="Ship stowaways"
|
vn-tooltip="Ship stowaways"
|
||||||
|
tooltip-position="up"
|
||||||
data="$ctrl.ticket.ship"
|
data="$ctrl.ticket.ship"
|
||||||
on-change="$ctrl.goToTicket(value)">
|
on-change="$ctrl.goToTicket(value)">
|
||||||
</vn-button-menu>
|
</vn-button-menu>
|
||||||
|
@ -152,5 +153,5 @@
|
||||||
question="You are going to delete this ticket"
|
question="You are going to delete this ticket"
|
||||||
message="Continue anyway?">
|
message="Continue anyway?">
|
||||||
</vn-confirm>
|
</vn-confirm>
|
||||||
<vn-add-stowaway vn-id="addStowaway" ticket="$ctrl.ticket"></vn-add-stowaway>
|
<vn-add-stowaway vn-id="addStowaway" card-reload="$ctrl.cardReload()" ticket="$ctrl.ticket"></vn-add-stowaway>
|
||||||
<vn-remove-stowaway vn-id="removeStowaway" ticket="$ctrl.ticket"></vn-remove-stowaway>
|
<vn-remove-stowaway vn-id="removeStowaway" card-reload="$ctrl.cardReload()" ticket="$ctrl.ticket"></vn-remove-stowaway>
|
|
@ -11,7 +11,7 @@ class Controller {
|
||||||
this.moreOptions = [
|
this.moreOptions = [
|
||||||
{callback: this.showAddTurnDialog, name: 'Add turn', show: true},
|
{callback: this.showAddTurnDialog, name: 'Add turn', show: true},
|
||||||
{callback: this.showDeleteTicketDialog, name: 'Delete ticket', show: true},
|
{callback: this.showDeleteTicketDialog, name: 'Delete ticket', show: true},
|
||||||
{callback: this.showAddStowaway, name: 'Add stowaway', show: true},
|
{callback: this.showAddStowaway, name: 'Add stowaway', show: () => this.isTicketModule()},
|
||||||
{callback: this.showRemoveStowaway, name: 'Remove stowaway', show: () => this.shouldShowRemoveStowaway()},
|
{callback: this.showRemoveStowaway, name: 'Remove stowaway', show: () => this.shouldShowRemoveStowaway()},
|
||||||
/* callback: this.showChangeShipped, name: 'Change shipped hour', show: true} */
|
/* callback: this.showChangeShipped, name: 'Change shipped hour', show: true} */
|
||||||
];
|
];
|
||||||
|
@ -37,8 +37,16 @@ class Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isTicketModule() {
|
||||||
|
let path = this.$state.getCurrentPath();
|
||||||
|
if (path[1].state.name === 'ticket')
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
shouldShowRemoveStowaway() {
|
shouldShowRemoveStowaway() {
|
||||||
if (!this._ticket)
|
if (!this._ticket || !this.isTicketModule())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return (this._ticket.stowaway || (this._ticket.ship && this._ticket.ship.length > 0));
|
return (this._ticket.stowaway || (this._ticket.ship && this._ticket.ship.length > 0));
|
||||||
|
@ -157,7 +165,8 @@ Controller.$inject = ['$state', '$scope', '$http', 'vnApp', '$translate'];
|
||||||
ngModule.component('vnTicketDescriptor', {
|
ngModule.component('vnTicketDescriptor', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
bindings: {
|
bindings: {
|
||||||
ticket: '<'
|
ticket: '<',
|
||||||
|
cardReload: '&'
|
||||||
},
|
},
|
||||||
controller: Controller
|
controller: Controller
|
||||||
});
|
});
|
||||||
|
|
|
@ -46,7 +46,7 @@ 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();
|
this.cardReload();
|
||||||
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -72,9 +72,7 @@ ngModule.component('vnRemoveStowaway', {
|
||||||
template: require('./removeStowaway.html'),
|
template: require('./removeStowaway.html'),
|
||||||
controller: Controller,
|
controller: Controller,
|
||||||
bindings: {
|
bindings: {
|
||||||
ticket: '<'
|
ticket: '<',
|
||||||
},
|
cardReload: '&?'
|
||||||
require: {
|
|
||||||
card: '^vnTicketCard'
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -20,6 +20,10 @@ module.exports = Self => {
|
||||||
|
|
||||||
Self.getPossibleStowaways = async ticketFk => {
|
Self.getPossibleStowaways = async ticketFk => {
|
||||||
let ship = await Self.app.models.Ticket.findById(ticketFk);
|
let ship = await Self.app.models.Ticket.findById(ticketFk);
|
||||||
|
|
||||||
|
if (!ship || !ship.shipped)
|
||||||
|
return [];
|
||||||
|
|
||||||
let lowestDate = new Date(ship.shipped.getTime());
|
let lowestDate = new Date(ship.shipped.getTime());
|
||||||
lowestDate.setHours(0, 0, -1, 0);
|
lowestDate.setHours(0, 0, -1, 0);
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<vn-main-block>
|
<vn-main-block>
|
||||||
<div class="left-menu">
|
<div class="left-menu">
|
||||||
<vn-ticket-descriptor ticket="$ctrl.ticket"></vn-ticket-descriptor>
|
<vn-ticket-descriptor ticket="$ctrl.ticket" card-reload="$ctrl.reload()"></vn-ticket-descriptor>
|
||||||
<vn-left-menu></vn-left-menu>
|
<vn-left-menu></vn-left-menu>
|
||||||
</div>
|
</div>
|
||||||
<div class="content-block" ui-view></div>
|
<div class="content-block" ui-view></div>
|
||||||
|
|
Loading…
Reference in New Issue