import { Router } from 'aurelia-router';
import { autoinject, bindable, customElement } from 'aurelia-framework';
import { ImportResults } from "../../service/import-service";
import { CustomLogger } from '../../../modules/custom-logger';
import { I18N } from 'aurelia-i18n';

@autoinject
@customElement("import-step-5")
export class ImportStep5 {

  @bindable
  public importResults: ImportResults;
  @bindable
  public lastStepFooterView: any;
  @bindable
  public customParameters: number;

  @bindable
  public newStep;

  constructor(private router: Router, private logger: CustomLogger, private i18n: I18N) {

  }

  openExcelResultFile() {
    if (this.importResults.resultFileUri == null) {
      this.logger.LogError(this.i18n.tr('importdata.errorWhenGenerateResultFile'), null, null, true);
    } else {
      window.open("https://view.officeapps.live.com/op/view.aspx?src=" + this.importResults.resultFileUri, "_blank");
    }
  }
}
