<div class="content-heading  justify-content-between">
  <div>考务编排-请选择考点</div>
  <div class="float-right">
    <button class="btn btn-primary" type="button" (click)="ajax.reload()">
      刷新数据
    </button>
  </div>
</div>
<table class="table table-striped table-hover table-bordered">
  <thead>
  <tr>
    <th>代码</th>
    <th>考点名称</th>
    <th>缴费结束时间</th>
    <th>报考人次/人数</th>
    <th>报考金额</th>
    <th>开考日期</th>
    <th>编排状态</th>
    <th>准考证状态</th>
    <th class="th-b-4 text-left"></th>
  </tr>
  </thead>
  <tbody>
  <tr *ngFor="let v of ajax.getArray(); let i = index">
    <td>{{v.agent_code}}</td>
    <td><span class="table-button" (click)="chooseAgent(v)"
      [tooltip]="v.ly_agent_addr?v.ly_agent_addr:v.agent_addr"
              [ngClass]="{'text-success': currentAgentId!==undefined && v.ly_agent_id === currentAgentId}">{{v.ly_agent_name?v.ly_agent_name:v.agent_name}}</span>
    </td>
    <td>{{v.pay_end_time? v.pay_end_time:v.enrol_end_time}}</td>
    <td>{{v.enrol_aspect_total}} / {{v.enrol_std_total}}</td>
    <td>{{FuncService.formatCurrency(v.enrol_fee_total ===undefined ? 0 : v.enrol_fee_total / 100)}}</td>
    <td>{{FuncService.dateToShortString(v.exam_start_date)}}</td>
    <td [ngClass]="{'text-success':v.ly_status==='Publish'}">{{v.ly_status}}</td>
    <td><span [tooltip]="v.ly_ticket_explain" [ngClass]="{'text-info': v.ly_ticket_explain !== undefined}">{{v.ly_ticket_time}}</span>
    </td>
    <td>
      <!-- *ngIf="checkPayTime(v)" -->
      <div class="btn-group btn-group-sm" dropdown >
        <button class="btn dropdown-toggle btn-secondary btn-sm" type="button" dropdownToggle> 编排功能
          <span class="caret"></span>
        </button>
        <div *dropdownMenu class="dropdown-menu modal-lg" role="menu">
          <a class="dropdown-item text-success" href="#" (click)="showModal({ResponseEntity: v})"
             *ngIf="v.ly_agent_id === undefined">初始化编排</a>
          <div class="dropdown-divider" *ngIf="v.ly_agent_id"></div>
          <a class="dropdown-item text-info" href="#" *ngIf="v.ly_agent_id" (click)="showModal({ResponseEntity: v})">编辑准考证说明</a>
          <div class="dropdown-divider" *ngIf="v.ly_agent_id"></div>
          <a class="dropdown-item text-warning" href="#" *ngIf="v.ly_agent_id" (click)="refreshAgent(v)">刷新编排数据</a>

          <div class="dropdown-divider" *ngIf="v.ly_agent_id  && v.ly_status !== 'Publish'"></div>
          <a class="dropdown-item text-warning" href="#" *ngIf="v.ly_agent_id  && v.ly_status !== 'Publish'" (click)="resetTicket(v)">重新生成准考证号</a>

          <div class="dropdown-divider" *ngIf="v.ly_agent_id && v.ly_status !== 'Publish'"></div>
          <a class="dropdown-item text-danger" href="#" *ngIf="v.ly_agent_id && v.ly_status !== 'Publish'"
             (click)="ajax.optrRecord('layout/agent/clear.htm', {ly_agent_id: v.ly_agent_id}, {confirmMsg:'确定要清除编排数据吗？该考点所有被编排的数据都会被清空，请谨慎进行此操作！', successMsg:'考点编排数据已清除！', successMsgType: 'Swal',showMsg: true}, {RequestWithLoading: true})">重置所有编排</a>

          <div class="dropdown-divider" *ngIf="v.ly_agent_id && v.ly_status !== 'Publish'"></div>
          <a class="dropdown-item text-info" href="#" *ngIf="v.ly_agent_id && v.ly_status !== 'Publish'"
             (click)="ajax.optrRecord('layout/agent/publish.htm', {ly_agent_id: v.ly_agent_id}, {confirmMsg:'确定要发布该考点的编排结果吗？一旦发布将不可修改，请谨慎进行此操作！', successMsg:'考点数据已经发布！', successMsgType: 'Swal',showMsg: true}, {RequestWithLoading: true})">考点编排完成</a>

        </div>
      </div>
    </td>
  </tr>
  </tbody>
</table>
<frame-ajax [url]="'layout/agent/list.htm'" [requestParam]="{RequestDataType:'array', RequestWithLoading: true}"  #ajax></frame-ajax>

