stowaway fixes
This commit is contained in:
parent
ea0504db21
commit
2a339185fc
|
@ -10,17 +10,38 @@ class Controller {
|
||||||
this.$translate = $translate;
|
this.$translate = $translate;
|
||||||
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: true},
|
||||||
{callback: this.showRemoveStowaway, name: 'Remove stowaway', show: false}
|
{callback: this.showRemoveStowaway, name: 'Remove stowaway', show: () => this.shouldShowRemoveStowaway()},
|
||||||
*/
|
/* callback: this.showChangeShipped, name: 'Change shipped hour', show: true} */
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Change shipped hour
|
||||||
|
showChangeShipped() {
|
||||||
|
if (!this.isEditable) {
|
||||||
|
this.vnApp.showError(this.$translate.instant('This ticket can\'t be modified'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.newShipped = new Date(this.ticket.shipped);
|
||||||
|
this.$scope.changeShippedDialog.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
changeShipped(response) {
|
||||||
|
console.log(response);
|
||||||
|
if (response === 'ACCEPT') {
|
||||||
|
let params = {shipped: this.newShipped};
|
||||||
|
this.$http.patch(`/ticket/api/Tickets/${this.ticket.id}/`, params).then(() => {
|
||||||
|
this.$state.go('ticket.index');
|
||||||
|
this.vnApp.showSuccess(this.$translate.instant('Shipped hour updated'));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
shouldShowRemoveStowaway() {
|
shouldShowRemoveStowaway() {
|
||||||
if (!this._ticket)
|
if (!this._ticket)
|
||||||
return false;
|
return false;
|
||||||
return (this._ticket.stowaway || this._ticket.ship.length > 1);
|
return (this._ticket.stowaway || (this._ticket.ship && this._ticket.ship.length > 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
onMoreChange(callback) {
|
onMoreChange(callback) {
|
||||||
|
@ -81,7 +102,6 @@ class Controller {
|
||||||
|
|
||||||
showAddStowaway() {
|
showAddStowaway() {
|
||||||
this.$scope.addStowaway.show();
|
this.$scope.addStowaway.show();
|
||||||
console.log(this.$state.getCurrentPath());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
showRemoveStowaway() {
|
showRemoveStowaway() {
|
||||||
|
@ -110,16 +130,16 @@ class Controller {
|
||||||
tooltip: 'Ship'
|
tooltip: 'Ship'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
if (value.ship.length == 1) {
|
if (value.ship && value.ship.length == 1) {
|
||||||
links.btnThree = {
|
links.btnThree = {
|
||||||
icon: 'icon-polizon',
|
icon: 'icon-polizon',
|
||||||
state: `ticket.card.summary({id: ${value.ship[0].id}})`,
|
state: `ticket.card.summary({id: ${value.ship[0].id}})`,
|
||||||
tooltip: 'Stowaway'
|
tooltip: 'Stowaway'
|
||||||
};
|
};
|
||||||
} else if (value.ship.length > 1)
|
} else if (value.ship && value.ship.length > 1)
|
||||||
this.shipStowaways = value.ship;
|
this.shipStowaways = value.ship;
|
||||||
*/
|
|
||||||
this._quicklinks = links;
|
this._quicklinks = links;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue