import { Component, OnInit } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
import { BsModalRef } from 'ngx-bootstrap/modal';
import { FrameDetailComponent } from '../../../../frame/core/detail/frame.detail';

@Component({
  selector: 'app-room-interview-judge',
  templateUrl: './room-interview-judge.component.html',
  styleUrls: ['./room-interview-judge.component.scss']
})
export class RoomInterviewJudgeComponent extends FrameDetailComponent implements OnInit {


  judgeCompo:any;

  constructor(bsModalRef: BsModalRef, sanitizer: DomSanitizer) {
    super(bsModalRef, sanitizer);
   }

  ngOnInit(): void {
    this.requestRoomJudge();
  }

  //清空MAC地址
  clearMac(judge) {
    if(!judge.pad_mac) return;
    this.MsgService.confirmAlert(`确定要清除评委【${judge.judge_name}】的绑定设备吗？`, () => {
      this.AjaxService.request('ex/judge/room/clear/mac.htm', judge, () => {
        this.requestRoomJudge();
      });
    });
  }

  //查询考场的评委
  requestRoomJudge() {
    this.AjaxService.requestEntity('ly/room/interview/judge/list.htm', {ly_room_id: this.ResponseEntity.ly_room_id}, (entity) => {
      this.judgeCompo = entity;
    })
  }

  //清空考场所有评委的MAC
  clearRoomMac() {
    this.MsgService.confirmAlert(`确定要清除考场【${this.currentEntity.room_addr}】的所有终端设备？`, () => {
      this.AjaxService.request('ex/judge/room/clear/mac/all.htm', {ly_room_id: this.currentEntity.ly_room_id}, () => {
        this.requestRoomJudge();
      });
    });
  }

}
