import ngModule from '../../module';

class Controller {
    constructor($scope, $state, $filter) {
        this.$ = $scope;
        this.$state = $state;
        this.recovery = {
            started: new Date()
        };
    }

    cancel() {
        this.goToIndex();
    }

    goToIndex() {
        this.$state.go('client.card.recovery.index');
    }

    onSubmit() {
        this.recovery.clientFk = this.$state.params.id;
        this.$.watcher.submit().then(
            () => {
                this.goToIndex();
            }
        );
    }
}
Controller.$inject = ['$scope', '$state', '$filter'];

ngModule.component('vnClientRecoveryCreate', {
    template: require('./index.html'),
    controller: Controller
});