2018-08-24 11:16:11 +00:00
|
|
|
import ngModule from '../module';
|
|
|
|
|
|
|
|
class Controller {
|
2019-01-25 14:08:11 +00:00
|
|
|
constructor($scope, $state, $http, $translate, vnApp) {
|
|
|
|
this.$scope = $scope;
|
2018-08-24 11:16:11 +00:00
|
|
|
this.$state = $state;
|
2019-01-25 14:08:11 +00:00
|
|
|
this.$http = $http;
|
|
|
|
this.$translate = $translate;
|
|
|
|
this.vnApp = vnApp;
|
|
|
|
this.moreOptions = [
|
|
|
|
{callback: this.showConfirmDialog, name: 'Pickup order'}
|
|
|
|
];
|
2018-10-03 06:00:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
get claim() {
|
|
|
|
return this._claim;
|
|
|
|
}
|
|
|
|
|
|
|
|
set claim(value) {
|
|
|
|
this._claim = value;
|
|
|
|
|
|
|
|
if (!value) return;
|
|
|
|
|
|
|
|
this._quicklinks = {
|
|
|
|
btnOne: {
|
|
|
|
icon: 'person',
|
|
|
|
state: `client.card.summary({id: ${value.clientFk}})`,
|
|
|
|
tooltip: 'Client card'
|
2019-01-30 07:44:15 +00:00
|
|
|
},
|
|
|
|
btnTwo: {
|
|
|
|
icon: 'icon-ticket',
|
|
|
|
state: `ticket.card.summary({id: ${this.claim.ticketFk}})`,
|
|
|
|
tooltip: 'Claimed ticket'
|
2018-10-03 06:00:19 +00:00
|
|
|
}
|
|
|
|
};
|
2018-08-24 11:16:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
set quicklinks(value = {}) {
|
|
|
|
this._quicklinks = Object.assign(value, this._quicklinks);
|
|
|
|
}
|
|
|
|
|
|
|
|
get quicklinks() {
|
|
|
|
return this._quicklinks;
|
|
|
|
}
|
2019-01-25 14:08:11 +00:00
|
|
|
|
|
|
|
onMoreChange(callback) {
|
|
|
|
callback.call(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
showConfirmDialog() {
|
|
|
|
this.$scope.confirmDialog.show();
|
|
|
|
}
|
|
|
|
|
|
|
|
returnDialog(response) {
|
|
|
|
if (response === 'CANCEL') {
|
2019-01-28 11:28:22 +00:00
|
|
|
let url = `/api/report/rpt-claim-pickup-order?claimFk=${this.claim.id}`;
|
2019-01-25 14:08:11 +00:00
|
|
|
window.open(url);
|
|
|
|
} else if (response === 'ACCEPT') {
|
2019-01-28 11:28:22 +00:00
|
|
|
this.$http.post(`/api/email/claim-pickup-order`, {claimFk: this.claim.id}).then(
|
2019-01-25 14:08:11 +00:00
|
|
|
() => this.vnApp.showMessage(this.$translate.instant('Notification sent!'))
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2018-08-24 11:16:11 +00:00
|
|
|
}
|
|
|
|
|
2019-01-25 14:08:11 +00:00
|
|
|
Controller.$inject = ['$scope', '$state', '$http', '$translate', 'vnApp'];
|
2018-08-24 11:16:11 +00:00
|
|
|
|
|
|
|
ngModule.component('vnClaimDescriptor', {
|
|
|
|
template: require('./index.html'),
|
|
|
|
controller: Controller,
|
|
|
|
bindings: {
|
|
|
|
claim: '<',
|
|
|
|
tags: '<',
|
|
|
|
quicklinks: '<'
|
|
|
|
}
|
|
|
|
});
|