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

class Controller {
    constructor($scope, $state, $filter) {
        this.$ = $scope;
        this.$state = $state;
        this.greuge = {
            shipped: new Date(),
            clientFk: $state.params.id
        };
    }

    cancel() {
        this.goToIndex();
    }

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

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

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