import { Component, OnInit } from '@angular/core';
import { BsModalService } from 'ngx-bootstrap/modal';
import { VideoAppReportStdComponent } from '../video-app-report-std/video-app-report-std.component';
import { MsgService } from '../../../../../core/service/msg.service';
import { FramePageComponent } from '../../../../frame/core/page/frame.page';
import { AjaxService } from '../../../../../core/service/ajax.service';

@Component({
  selector: 'app-enrol-works-report',
  templateUrl: './enrol-works-report.component.html',
  styleUrls: ['./enrol-works-report.component.scss']
})
export class EnrolWorksReportComponent extends FramePageComponent implements OnInit {

  agentArray = [];
  dateArray = [];
  roomArray = [];
  array = [];
  no_vieo_total = 0;
  query: any;

  constructor(private modalService: BsModalService) { 
    super(modalService);
    this.goInit();
  }

  ngOnInit() {
    this.rquestStat();
  }

  goInit() {
    this.agentArray = [];
    this.roomArray = [];
    this.query = {};
    AjaxService.requestArray('conf/agent/list/dept.htm', {}, (array) => {
      this.agentArray = array;
      if (this.agentArray.length === 1) {
        this.query.agent_id = this.agentArray[0].ly_agent_id;
        this.rquestStat();
      }
    });
  }

  rquestStat() {
    debugger;
    this.query.agent_id= 100;
    AjaxService.requestArray('enrol/gat/works/report.htm', this.query, (array) => {
      debugger;
      this.array = array;
    });
  }


  showStdModal(aspect: any, type: any) {
    if(type) {
      aspect.type = type;
    }
    this.showComponentModal(VideoAppReportStdComponent,  {ResponseEntity: aspect} );
  }
}
