import ngModule from '../module';

export default class Controller {
    constructor($scope, $stateParams, $http) {
        this.$scope = $scope;
        this.$http = $http;
        this.$stateParams = $stateParams;
        this.client = null;
    }

    $onInit() {
        this.getCard();
    }

    getCard() {
        this.$http.get(`/client/api/Clients/${this.$stateParams.id}/getCard`).then(response => {
            this.client = response.data;
        });
    }

    reload() {
        this.getCard();
    }
}
Controller.$inject = ['$scope', '$stateParams', '$http'];

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