import { SetDataService } from "../../../service/set-data.service";
import { Router } from "@angular/router";
import { Component, OnInit } from "@angular/core";
import { ActivatedRoute } from "@angular/router";
import { HelperService } from "app/service/helper.service";
import { ReasonData } from "app/data/ReasonData";

@Component({
  selector: "app-set002-view-reason",
  templateUrl: "./set002-view-reason.component.html"
})
export class Set002ViewReasonComponent implements OnInit {
  errorMessage: String;
  data: any;
  reasonData: ReasonData;

  selectedItem: any;
  itemId: number;
  loading = false;

  constructor(
    private setDataService: SetDataService,
    private route: ActivatedRoute,
    private router: Router,
    private helperService: HelperService
  ) {}

  ngOnInit() {
    this.loading = true;
    this.reasonData = new ReasonData();
    this.route.data.subscribe((data: { selectedItem: any }) => {
      this.loading = false;
      this.selectedItem = data.selectedItem;
    });
  }

  backPreviousPage() {
    this.router.navigateByUrl("/set/set002");
  }
}
