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

@Component({
  selector: 'app-exam-interview-entrance-batch-detail',
  templateUrl: './exam-interview-entrance-batch-detail.component.html',
  styleUrls: ['./exam-interview-entrance-batch-detail.component.scss']
})
export class ExamInterviewEntranceBatchDetailComponent  extends FrameDetailComponent implements OnInit {

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

  ngOnInit() {
  }

  initDefautEntity() {
  }

  batchInroom() {
    let roomArray = [];
    for(const group of this.ResponseMap.GroupArray) {
      for(const room of this.ResponseMap['GroupRoom_' + group.ly_group_id]) {
        roomArray.push(room);
      }
    }
    AjaxService.request('exam/interview/batch/inroom.htm', {
      exam_date: this.ResponseEntity.exam_date,
      json_value: JSON.stringify(roomArray),
      group_json_value: JSON.stringify(this.ResponseMap.GroupArray)
    }, () => {
      MsgService.successToastr('批量入场成功！');
      this.closeWindow();
    });
  }

}
