44 lines
943 B
JavaScript
44 lines
943 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(response) {
|
|
if (response === 'accept')
|
|
this.addCredit();
|
|
}
|
|
|
|
goToIndex() {
|
|
this.$state.go('client.card.credit.index');
|
|
}
|
|
|
|
addCredit() {
|
|
this.$.watcher.submit().then(
|
|
() => {
|
|
this.goToIndex();
|
|
}
|
|
);
|
|
}
|
|
}
|
|
|
|
ngModule.component('vnClientCreditCreate', {
|
|
template: require('./index.html'),
|
|
controller: Controller,
|
|
bindings: {
|
|
client: '<'
|
|
}
|
|
});
|