salix/modules/client/front/address/create/index.js

36 lines
873 B
JavaScript
Raw Normal View History

2018-05-23 12:26:51 +00:00
import ngModule from '../../module';
2017-06-03 11:01:47 +00:00
export default class Controller {
constructor($scope, $state) {
this.$scope = $scope;
this.$state = $state;
this.data = {
address: {
clientFk: parseInt($state.params.id),
isActive: true
},
isDefaultAddress: false
};
this.address = this.data.address;
}
onSubmit() {
this.$scope.watcher.submit().then(res => {
if (res.data && this.data.isDefaultAddress)
this.client.defaultAddressFk = res.data.id;
this.$state.go('client.card.address.index');
});
}
}
Controller.$inject = ['$scope', '$state'];
2018-05-23 12:26:51 +00:00
ngModule.component('vnClientAddressCreate', {
template: require('./index.html'),
controller: Controller,
bindings: {
client: '<'
}
2017-06-03 11:01:47 +00:00
});