import {
  okOptions
} from '../../settings/ok';

export class IntroOldStagerController {
  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() {}

  onChanges(changes) {
    if (changes) {

    }
  }

  confirm() {
    _laq.push(['send', 'click', 'btn-type', 'help-oldman-close']);

    this.modalInstance.result.then(res => {
      if (res) {
        okOptions.from = 'oldStager';
        this.introService.showIntros(okOptions);
      }
    });

    this.closeModal('confirm');
  }

  back() {
    _laq.push(['send', 'click', 'btn-type', 'help-oldman-return']);

    this.closeModal('reopen');
    this.introService.openModal('introOption', 'modal-650');
  }

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

export const introOldStagerComponent = {
  bindings: {
    // For uibModal
    resolve: '<',
    modalInstance: '<',
    close: '&',
    dismiss: '&'
  },
  templateUrl: 'app/modules/intros/components/intro-oldStager/intro-oldStager.html',
  controller: IntroOldStagerController
};