import { Component, OnInit } from '@angular/core';
import { FormBuilder, Validators } from '@angular/forms';
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';
import { FuncService } from '../../../../../core/service/func.service';

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

  constructor(bsModalRef: BsModalRef, fb: FormBuilder) {
    super(bsModalRef);
    this.detailForm = fb.group({
      'start_num' : [null, Validators.required],
      'end_num' : [null, Validators.required]
    });
   }

  ngOnInit(): void {
  }

  export() {
    if(this.currentEntity.start_num > this.currentEntity.end_num) {
      MsgService.errorToastr('结束序号必须大于起始序号！');
      return;
    }
    this.closeWindow();
    FuncService.ajaxDownload('zhongx/std/video/room/export.htm', {
      room_id : this.currentEntity.ly_room_id,
      start_num : this.currentEntity.start_num,
      end_num : this.currentEntity.end_num
    });
  }

}
