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 {
|
2018-05-11 09:16:16 +00:00
|
|
|
onSubmit() {
|
2020-03-17 10:17:50 +00:00
|
|
|
this.$http.get(`Recoveries/${this.$params.id}/hasActiveRecovery`).then(res => {
|
2018-05-11 09:16:16 +00:00
|
|
|
let activeRecovery = res.data;
|
|
|
|
if (activeRecovery)
|
2020-03-17 10:17:50 +00:00
|
|
|
this.$.confirmation.show();
|
2018-05-11 09:16:16 +00:00
|
|
|
else
|
|
|
|
this.addCredit();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2018-10-17 07:28:38 +00:00
|
|
|
cancel() {
|
2018-07-25 11:37:27 +00:00
|
|
|
this.goToIndex();
|
|
|
|
}
|
|
|
|
|
2020-07-29 08:54:45 +00:00
|
|
|
returnDialog() {
|
|
|
|
this.addCredit();
|
2018-05-11 09:16:16 +00:00
|
|
|
}
|
|
|
|
|
2018-07-25 11:37:27 +00:00
|
|
|
goToIndex() {
|
|
|
|
this.$state.go('client.card.credit.index');
|
|
|
|
}
|
|
|
|
|
2018-05-11 09:16:16 +00:00
|
|
|
addCredit() {
|
2020-03-17 10:17:50 +00:00
|
|
|
this.$.watcher.submit().then(
|
2018-05-11 09:16:16 +00:00
|
|
|
() => {
|
2018-07-25 11:37:27 +00:00
|
|
|
this.goToIndex();
|
2018-05-11 09:16:16 +00:00
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-24 12:22:30 +00:00
|
|
|
ngModule.vnComponent('vnClientCreditCreate', {
|
2018-05-23 12:26:51 +00:00
|
|
|
template: require('./index.html'),
|
2018-05-11 09:16:16 +00:00
|
|
|
controller: Controller,
|
2017-12-04 07:17:29 +00:00
|
|
|
bindings: {
|
|
|
|
client: '<'
|
|
|
|
}
|
|
|
|
});
|