import { Component, OnInit } from '@angular/core';
import { FrameRequest } from '../../../../../shared/frame/frame-request';

@Component({
  selector: 'app-layout-other-monitor',
  templateUrl: './layout-other-monitor.component.html',
  styleUrls: ['./layout-other-monitor.component.scss']
})
export class LayoutOtherMonitorComponent implements OnInit {

  public query = {
    query: "",
    year_code: 0
  };

  flag : boolean = true;
  num : any;

  CHECK_URL = "std/stdEnrol/stdLayoutNumCheck.htm";
  YEAR_CODE_URL = "pl/plExamTime/list.htm";
  LATEST_TIME_URL = "pl/plExamTime/getCurrentYearCode.htm";

  constructor() { }

  ngOnInit() {
    setTimeout(() =>{
      FrameRequest.requestEntity(this.LATEST_TIME_URL, { }, (entity) => {
        if (entity) {
          this.query.year_code = Number.parseInt(entity);
        }
      });
    },200);
  }

  check() {
    FrameRequest.requestEntity(this.CHECK_URL, {year_code: this.query.year_code}, (entity) => {
      this.num = entity;
      this.flag = false;
    });
  }

}
