43 lines
898 B
JavaScript
43 lines
898 B
JavaScript
import ngModule from '../../module';
|
|
import Section from 'salix/components/section';
|
|
|
|
class Controller extends Section {
|
|
onSubmit() {
|
|
this.$http.get(`Recoveries/${this.$params.id}/hasActiveRecovery`).then(res => {
|
|
let activeRecovery = res.data;
|
|
if (activeRecovery)
|
|
this.$.confirmation.show();
|
|
else
|
|
this.addCredit();
|
|
});
|
|
}
|
|
|
|
cancel() {
|
|
this.goToIndex();
|
|
}
|
|
|
|
returnDialog() {
|
|
this.addCredit();
|
|
}
|
|
|
|
goToIndex() {
|
|
this.$state.go('client.card.credit.index');
|
|
}
|
|
|
|
addCredit() {
|
|
this.$.watcher.submit().then(
|
|
() => {
|
|
this.goToIndex();
|
|
}
|
|
);
|
|
}
|
|
}
|
|
|
|
ngModule.vnComponent('vnClientCreditCreate', {
|
|
template: require('./index.html'),
|
|
controller: Controller,
|
|
bindings: {
|
|
client: '<'
|
|
}
|
|
});
|