import { Component, OnInit } from '@angular/core';
import { FramePageComponent } from '../../../../frame/core/page/frame.page';
import { BsModalService } from 'ngx-bootstrap/modal';

@Component({
  selector: 'app-layout-conflict',
  templateUrl: './layout-conflict.component.html',
  styleUrls: ['./layout-conflict.component.scss']
})
export class LayoutConflictComponent extends FramePageComponent implements OnInit {

  agentArr = [];
  query = {
    agent_id: '',
    batch_id: ''
  }


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

  ngOnInit(): void {
  }

  listAgent() {
    this.AjaxService.requestArray('conf/agent/all.htm', {}, (array) => {
      this.agentArr = array;
      if(this.agentArr && this.agentArr.length == 1) {
        this.query.agent_id = this.agentArr[0].agent_id;
      }
    });
  }

  requestData() {
    this.ajax.reload({ly_agent_id: this.query.agent_id, batch_id: this.query.batch_id});
  }

  export() {
    this.FuncService.ajaxDownload('layout/conflict/export.htm', {ly_agent_id: this.query.agent_id, batch_id: this.query.batch_id});
  }

}
