import {Component, OnDestroy, OnInit, ViewChild} from '@angular/core';
import { BsModalService } from 'ngx-bootstrap/modal';
import { AjaxService } from '../../../../../core/service/ajax.service';
import { FramePageComponent } from '../../../../frame/core/page/frame.page';

@Component({
  selector: 'app-exam-interview-judge-grade',
  templateUrl: './exam-interview-judge-grade.component.html',
  styleUrls: ['./exam-interview-judge-grade.component.scss']
})
export class ExamInterviewJudgeGradeComponent  extends FramePageComponent implements OnInit, OnDestroy {

  currentStep;
  currentRoom;
  checkin;
  room_key:any;

  private intervalId: any;

  constructor(modalService: BsModalService) {
    super(modalService);
    this.currentStep = 'Init';
    this.checkin = {};
  }


  ngOnInit() {

  }

  /**
   * 以前的方式为：this['room_key']
   */
  goInit() {
    this.currentRoom = undefined;
    this.room_key = undefined;
    this.checkin = {};
    clearTimeout(this.intervalId);
    this.currentStep = 'Init';
  }

  changePassword() {
    if (this.room_key === undefined || $.trim(this.room_key).length === 0)
      return;
    AjaxService.requestMap('exam/interview/room/find.htm', {room_key: this.room_key}, (map) => {
      this.currentRoom = map.Room;
      this.checkin.ly_room_id = this.currentRoom.ly_room_id;
      this.currentStep = 'Confirm';
    }, {
      MsgType: 'Swal'
    });
  }



  ngOnDestroy(): void {
    clearTimeout(this.intervalId);
  }


}

