import {Component, OnInit} from '@angular/core';
import {FramePageComponent} from '../../../../../frame/core/FramePageComponent';
import {BsModalService} from 'ngx-bootstrap';
import {ConfAgentDetailComponent} from '../conf-agent-detail/conf-agent-detail.component';
import {ConfAgentAspectComponent} from '../conf-agent-aspect/conf-agent-aspect.component';
//import {ConfAgentDetailComponent} from '../conf-agent-detail/conf-agent-detail.component';

@Component({
  selector: 'app-conf-agent-page',
  templateUrl: './conf-agent-page.component.html',
  styleUrls: ['./conf-agent-page.component.scss']
})
export class ConfAgentPageComponent extends FramePageComponent implements OnInit {

  constructor(private modalService: BsModalService) {
    super(modalService);
    this.modalComponent = ConfAgentDetailComponent;
  }

  ngOnInit() {
  }


  getEnrolTime(agent) {
    /*if (agent.enrol_status === 'InActive') {
      return '<span class="text-danger">未开启报名</span>';
    }*/
    if (agent.enrol_start_time === undefined) {
      return '<span class="text-warning">未设置开始时间</span>';
    }
    return `<span class="">${agent.enrol_start_time} - ${agent.enrol_end_time}</span>`;
  }

  getTicketTime(agent) {
    if (agent.ticket_start_time === undefined) {
      return '<span class="text-warning">未设置开始时间</span>';
    }
    return `<span class="">${agent.ticket_start_time} - ${agent.ticket_end_time}</span>`;
  }

  showAspect(ap) {
    this.showComponentModal(ConfAgentAspectComponent, {
      'ResponseEntity': ap,
      'arrayUrl': 'conf/agent/aspect/list.htm',
      'arrayParam': {
        agent_id: ap.school_id
      }
    });
  }
}
