import { Component, OnInit } from '@angular/core';
import { FormBuilder, Validators } from '@angular/forms';
import { BsModalRef } from 'ngx-bootstrap/modal';
import { FrameDetailComponent } from '../../../../frame/core/detail/frame.detail';


@Component({
  selector: 'app-room-interview-video-std',
  templateUrl: './room-interview-video-std.component.html',
  styleUrls: ['./room-interview-video-std.component.scss']
})
export class RoomInterviewVideoStdComponent 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) {
      this.MsgService.errorToastr('起始序号或者终止序号不能为空！');
      return;
    }
    if(this.currentEntity.start_num > this.currentEntity.end_num) {
      this.MsgService.errorToastr('结束序号必须大于起始序号！');
      return;
    }
    this.closeWindow();
    this.FuncService.ajaxDownload('std/material/room/export.htm', {
      ly_room_id : this.currentEntity.ly_room_id,
      start_num : this.currentEntity.start_num,
      end_num : this.currentEntity.end_num
    });
  }

}
