export class NewComersController {
  constructor($http, $log, $state, toastr, globalVar, $scope, introService) {
    'ngInject';

    this.$http = $http;
    this.$log = $log;
    this.$state = $state;
    this.toastr = toastr;
    this.globalVar = globalVar;
    this.$scope = $scope;
    this.introService = introService;


    this.$onInit = this.onInit.bind(this);
    this.$onChanges = this.onChanges.bind(this);
  }

  onInit() {
    this.introService.onCloseModal(this.modalInstance);
  }

  onChanges(changes) {
    if (changes) {

    }
  }

  closeModal() {
    if (this.modalInstance) {
      let intro = this.intro;
      switch (intro) {
        case 'option':
          _laq.push(['send', 'click', 'btn-type', 'help-index-close-btn']);
          break;
        case 'oldStager':

          break;
        case 'lookAround':

          break;
        case 'couponActivity':
          _laq.push(['send', 'click', 'btn-type', 'help-coupon-close']);
          break;
        case 'question':

          break;
        default:
          break;
      }

      if (this.onCloseBtn) {
        this.onCloseBtn();
      }

      return this.modalInstance.close({
        $value: 'close'
      });
    }
  }
}

export const newComersComponent = {
  bindings: {
    modalInstance: '<',
    intro: '<',
    onCloseBtn: '&'
  },
  transclude: {
    'new-comers-header': '?newComersHeader',
    'new-comers-body': 'newComersBody',
    'new-comers-footer': '?newComersFooter'
  },
  templateUrl: 'app/modules/intros/components/new-comers/new-comers.html',
  controller: NewComersController
};