68 lines
1.8 KiB
JavaScript
68 lines
1.8 KiB
JavaScript
import ngModule from '../../module';
|
|
|
|
class Controller {
|
|
constructor($http, $scope, $state, $translate, vnApp) {
|
|
this.$http = $http;
|
|
this.$scope = $scope;
|
|
this.$state = $state;
|
|
this.$translate = $translate;
|
|
this.vnApp = vnApp;
|
|
}
|
|
|
|
$onInit() {
|
|
this.data.registerChild(this);
|
|
}
|
|
|
|
$onChanges() {
|
|
this.ticket.option = 1;
|
|
}
|
|
|
|
onStepChange(state) {
|
|
return true;
|
|
}
|
|
|
|
onSubmit() {
|
|
if (!this.ticket.option) {
|
|
return this.vnApp.showError(
|
|
this.$translate.instant('Choose an option')
|
|
);
|
|
}
|
|
|
|
let query = `tickets/${this.ticket.id}/componentUpdate`;
|
|
let params = {
|
|
clientId: this.ticket.clientFk,
|
|
agencyModeId: this.ticket.agencyModeFk,
|
|
addressId: this.ticket.addressFk,
|
|
zoneId: this.ticket.zoneFk,
|
|
warehouseId: this.ticket.warehouseFk,
|
|
companyId: this.ticket.companyFk,
|
|
shipped: this.ticket.shipped,
|
|
landed: this.ticket.landed,
|
|
isDeleted: this.ticket.isDeleted,
|
|
option: this.ticket.option
|
|
};
|
|
|
|
this.$http.post(query, params).then(res => {
|
|
this.vnApp.showMessage(
|
|
this.$translate.instant(`The ticket has been unrouted`)
|
|
);
|
|
this.card.reload();
|
|
this.$state.go('ticket.card.summary', {id: this.$state.params.id});
|
|
});
|
|
}
|
|
}
|
|
|
|
Controller.$inject = ['$http', '$scope', '$state', '$translate', 'vnApp'];
|
|
|
|
ngModule.component('vnTicketBasicDataStepThree', {
|
|
template: require('./index.html'),
|
|
controller: Controller,
|
|
bindings: {
|
|
ticket: '<'
|
|
},
|
|
require: {
|
|
card: '^vnTicketCard',
|
|
data: '^vnTicketBasicData'
|
|
}
|
|
});
|