<ng-container *ngIf="agent">
  <div class="content-heading  justify-content-between">
    <div>评委抽签 - {{agent?.ly_agent_name}}</div>
    <div class="float-right">
      <div class="row">
        <div class="wd-sm">
          <div class="ml-3" *ngIf="dateArray!==undefined">
            <ngx-select [items]="dateArray" [(ngModel)]="agent.exam_date" [autoClearSearch]="true"
                        (ngModelChange)="changeDate()"></ngx-select>
          </div>
        </div>
        <div class="btn-group  ml-3" dropdown *ngIf="agent.exam_date!==undefined ">
          <button class="btn dropdown-toggle btn-secondary " type="button" dropdownToggle>评委抽签功能
            <span class="caret"></span>
          </button>
          <div *dropdownMenu class="dropdown-menu " role="menu">
            <a class="dropdown-item" href="#"
               (click)="optrExtract('确定要按照规则抽取日期【' + agent['exam_date'] + '】的评委吗？','rule')">规则抽签</a>
               <div class="dropdown-divider"></div>
             <a class="dropdown-item" href="#" (click)="FuncService.ajaxDownload('frame/report/download.htm', {report_name:'ExamJudgeSpare', report_title :agent.ly_agent_name + '备用评委结果-',agent_id:agent.ly_agent_id,exam_date:agent.exam_date})">下载备用评委</a>  
            <div class="dropdown-divider"></div>
            <a class="dropdown-item text-primary" href="#"
               (click)="optrExtract('确定要为考试日期为【' + agent['exam_date'] + '】自动添加并安排评委吗','auto')">自动安排</a>
            <div class="dropdown-divider"></div>
            <a class="dropdown-item text-danger" href="#"
               (click)="optrExtract('确定清空考试日期为【' + agent['exam_date'] + '】的评委安排吗','clear')">清除安排</a>
            <div class="dropdown-divider"></div>
            <a class="dropdown-item text-info" href="#"
               (click)="optrExtract('确定要复制前一天的评委信息吗？','copy')">复制评委</a>
            <div class="dropdown-divider"></div>
            <a class="dropdown-item" href="#"
               (click)="optrExtract('确定按组重新分配评委吗？','random/team')">按组随机</a>
            <div class="dropdown-divider"></div>
            <a class="dropdown-item" href="#"
               (click)="optrExtract('确定按组重新分配评委吗？','random/chief')">打散随机</a>
            <div class="dropdown-divider"></div>
            <a class="dropdown-item" href="#"
               (click)="FuncService.ajaxDownload('frame/report/download.htm', {report_name:'ExamJudgeExtract', report_title :agent.ly_agent_name + '评委抽签结果-',ly_agent_id:agent.ly_agent_id,exam_date:agent.exam_date})">抽签结果</a>
            <div class="dropdown-divider"></div>
            <a class="dropdown-item text-warning" href="#" (click)="FuncService.ajaxDownload('frame/report/download.htm', {report_name:'JudgeToScoreSystem', report_title :agent.ly_agent_name + '评委抽签结果-评分系统使用'})">
              评分系统导出
            </a>   
          </div>
        </div>
      </div>
    </div>
  </div>

  <ng-container *ngIf="currentMap !==undefined">
    <div class="card card-default" *ngFor="let group of currentMap.GroupArray">
      <div class="card-header row justify-content-between">
        <div class="ml-2 text-bold text-1-2">
          {{group.group_name}}(需要【<span class="text-primary text-1-2 text-bold">{{group.room_judge_num}}</span>】评委)
        </div>
        <div class="mr-3">
          <div class="btn-group  ml-3" dropdown>
            <button class="btn dropdown-toggle btn-secondary " type="button" dropdownToggle>抽签功能
              <span class="caret"></span>
            </button>
            <div *dropdownMenu class="dropdown-menu " role="menu">
              <a class="dropdown-item" href="#"
                 (click)="optrExtract('确定要为考试日期为【' + agent['exam_date'] + '】自动添加并安排评委吗','rule',group)">规则抽签</a>
              <div class="dropdown-divider"></div>
              <a class="dropdown-item" href="#"
              (click)="optrExtract('确定要为考试日期为【' + agent['exam_date'] + '】新增的规则安排评委吗','ruleadd',group)">新增规则抽签</a>
              <div class="dropdown-divider"></div>
              <a class="dropdown-item text-primary" href="#"
                 (click)="optrExtract('确定要为考试日期为【' + agent['exam_date'] + '】【' + group['group_name'] + '】自动添加并安排评委吗','auto',group)">自动安排</a>
              <div class="dropdown-divider"></div>
              <a class="dropdown-item text-danger" href="#"
                 (click)="optrExtract('确定清空考试日期为【' + agent['exam_date'] + '】【' + group['group_name']+ '】的评委安排吗','clear',group)">清除安排</a>
              <div class="dropdown-divider"></div>
              <a class="dropdown-item text-info" href="#"
                 (click)="optrExtract('确定要复制前一天的评委信息吗？','copy',group)">复制评委</a>
              <div class="dropdown-divider"></div>
              <a class="dropdown-item" href="#"
                 (click)="optrExtract('确定按组重新分配评委吗？','random/team',group)">按组随机</a>
              <div class="dropdown-divider"></div>
              <a class="dropdown-item" href="#"
                 (click)="optrExtract('确定按组重新分配评委吗？','random/chief',group)">打散随机</a>
            </div>
          </div>
        </div>
      </div>
      <div class="row">
        <div class="col-lg-4" *ngFor="let room of currentMap['RoomArray_'+group.ly_group_id]">
          <div class="card card-default">
            <div class="card-header">
              <span
                [ngClass]="{'text-success':group.room_judge_num === currentMap['JudgeArray_'+room.ly_room_id].length,'text-danger':group.room_judge_num !== currentMap['JudgeArray_'+room.ly_room_id].length}">第{{room.room_seq}}
                考场：{{room.room_addr}}</span>
              <div class="float-right">
                <span class="table-button" (click)="openChooseJudge(room)"
                      *ngIf="group.room_judge_num !== currentMap['JudgeArray_'+room.ly_room_id].length"><em
                  class="fa fas fa-user"></em></span></div>
            </div>
            <div class="list-group-item list-group-item-action"
                 *ngFor="let judge of currentMap['JudgeArray_'+room.ly_room_id];">
              <div class="media">
                <!--
                <img class="align-self-start mx-2 circle thumb32" src="assets/img/user/0{{judge.judge_seq}}.jpg"
                     alt="Image">
                     -->
                <div class="media-body text-truncate">
                  <p class="mb-1">
                    <strong [ngClass]="{'text-primary':judge.room_chief === 'Active'}">
                      <span>{{judge.judge_seq}}. {{judge.judge_name}}<span class="ml-2">{{judge.judge_mobile}} </span>
                      <span class="ml-2"
                            *ngIf="judge.judge_title!==undefined && judge.judge_title.length>0">{{judge.judge_title}} </span>
                       <span class="ml-2"
                             *ngIf="judge.judge_school!==undefined && judge.judge_school.length>0">{{judge.judge_school}} </span>
                      </span>
                      <!-- <span class="ml-2" *ngIf="judge.judge_school_flag != undefined && judge.judge_school_flag.length > 0">
                        <span *ngIf="judge.judge_school_flag =='InActive'">校外</span>
                        <span *ngIf="judge.judge_school_flag =='Active'">校内</span>
                      </span> -->
                      <span class="ml-2" *ngIf="judge.judge_breeds != undefined && judge.judge_breeds.length > 0">
                        {{judge.judge_breeds}}
                      </span>
                    </strong>
                  </p>
                  <!--
                  <p class="mb-1 text-sm" *ngIf="rule.rule_chief === 'Active'">限定主评委</p>
                  -->
                </div>
                <div class="ml-auto">
                  <div class="ml-3">
                        <span class="table-button"
                              [ngClass]="{'text-primary':judge.room_chief === 'Active','text-muted':judge.room_chief !== 'Active'}"
                              (click)="changeChief(judge)"><em
                          class="fa fas fa-user-graduate"></em></span>
                    <span class="table-button ml-3"
                          (click)="deleteJudge(judge)"><em
                      class="fa fas fa-trash-alt text-danger"></em></span>
                  </div>
                </div>
              </div>
            </div>

          </div>
        </div>
      </div>
    </div>
  </ng-container>


</ng-container>
