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

declare let laydate;

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

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

  ngOnInit(): void {
    this.getDate();
  }
  
  /**
   * 视频审核-数据初始化
   */
  videoInit() {
    AjaxService.request('zhongx/std/face/data/init.htm', {
      ly_room_id : this.ResponseEntity.ly_room_id,
      video_send_time : this.currentEntity.video_send_time
    }, () => {
      MsgService.successToastr('该考场数据初始化成功！');
      this.closeWindow();
    });
  }

   //初始化时间控件
   getDate() {
    let _this = this;
    setTimeout(() => {
      laydate.render({
        elem:'#videoSendTime',
        type:'datetime',
        theme:'#0c6acf',
        trigger: 'click',
        format: 'yyyy-MM-dd HH:mm:ss',
        done:(value, date, endDate)=>{
          _this.currentEntity.video_send_time = value;
        }
      });
     
    }, 500);
  }

}
