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

43 lines
898 B
JavaScript
Raw Normal View History

2018-05-23 12:26:51 +00:00
import ngModule from '../../module';
2020-03-17 10:17:50 +00:00
import Section from 'salix/components/section';
2017-12-04 07:17:29 +00:00
2020-03-17 10:17:50 +00:00
class Controller extends Section {
onSubmit() {
2020-03-17 10:17:50 +00:00
this.$http.get(`Recoveries/${this.$params.id}/hasActiveRecovery`).then(res => {
let activeRecovery = res.data;
if (activeRecovery)
2020-03-17 10:17:50 +00:00
this.$.confirmation.show();
else
this.addCredit();
});
}
cancel() {
2018-07-25 11:37:27 +00:00
this.goToIndex();
}
2020-07-29 08:54:45 +00:00
returnDialog() {
this.addCredit();
}
2018-07-25 11:37:27 +00:00
goToIndex() {
this.$state.go('client.card.credit.index');
}
addCredit() {
2020-03-17 10:17:50 +00:00
this.$.watcher.submit().then(
() => {
2018-07-25 11:37:27 +00:00
this.goToIndex();
}
);
}
}
ngModule.vnComponent('vnClientCreditCreate', {
2018-05-23 12:26:51 +00:00
template: require('./index.html'),
controller: Controller,
2017-12-04 07:17:29 +00:00
bindings: {
client: '<'
}
});