<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>
          <input class="form-control mt-1" type="text" [(ngModel)]="searchText" placeholder="输入关键字进行搜索"/>
        </div>
        <div *ngIf="FrameService.getParamValue('ExamBatchs' , '1') > '1'" class="ml-3">
          <select class="form-control mt-1" [(ngModel)]="exam_batch">
            <option [value]="v.dict_value" *ngFor="let v of batchNameArray">{{v.dict_text}}</option>
          </select>
        </div>

        <div class="btn-group mr-1 ml-3" 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" href="#"
               (click)="FuncService.ajaxDownload('frame/report/download.htm', {report_name:'LayoutMaterialWrittenRoom', report_title :agent.ly_agent_name + '考场汇总-'})">考场汇总表</a>
            <div class="dropdown-divider"></div>
          </div>
        </div>
      </div>

    </div>
  </div>
  <div class="card card-default" *ngIf="ajax && ajax.getMap() && ajax.getMap()['SingleArray']">
    <div class="row card-header justify-content-between">
      <div>
    <span class="table-button"
          (click)="this['showSingleGroup'] = (this['showSingleGroup'] === undefined || this['showSingleGroup'])? false : true">
       <em class="fa-2x fas ml-2"
           [ngClass]="{'fa-angle-double-down': !this['showSingleGroup'],'fa-angle-double-up':(this['showSingleGroup'] === undefined || this['showSingleGroup'])}"></em> 未分组科目（{{ajax.getMap()['SingleArray'].length}}
      ）
    </span>
      </div>
    </div>
    <table class="table table-striped table-hover table-bordered" [hidden]="this['showSingleGroup'] === false">
      <thead>
      <tr>
        <th>分组名称</th>
        <th>顺序</th>
        <th>考生数</th>
        <th>考试时间</th>
        <th>考场数</th>
        <th>桌贴类型</th>
        <th></th>
      </tr>
      </thead>
      <tbody>
      <tr
        *ngFor="let v of ajax.getMap()['SingleArray'] | arrayFilter:  searchText | attrFilter :{exam_batch: exam_batch}; let i = index">

        <td><span
          *ngIf="v.dept_name">{{v.dept_name}} - </span>{{v.group_name}}({{v.subject_id}})
        </td>
        <td>{{v.ly_order}}</td>
        <td><span [tooltip]="'省内：' + v.province_std_total + '；省外：' + v.outside_std_total">{{v.group_std_total}}</span>
        </td>
        <td>
          {{FuncService.dateToShortString(v.exam_start_time)}}
          {{FuncService.dateToMinuteString(v.exam_start_time)}}-{{FuncService.dateToMinuteString(v.exam_end_time)}}
        </td>
        <td>{{v.room_total}}</td>
        <td [innerHTML]="v.aspect_num_flag | frameStatusCustom:['专业考号','准考证号','text-danger', 'text-black']"></td>
        <td>
          <div class="btn-group btn-group-sm" dropdown style="margin-top:-2px">
            <button class="btn dropdown-toggle btn-secondary btn-sm" type="button" dropdownToggle>分组操作
              <span class="caret"></span>
            </button>
            <div *dropdownMenu class="dropdown-menu" role="menu">
              <a class="dropdown-item" href="#" *ngIf="v.room_total > 0"
                 (click)="FuncService.ajaxDownload('frame/report/download.htm', {report_name:'LayoutMaterialWrittenRoom', report_title :v.group_name + '考场汇总-', ly_group_id:v.ly_group_id})">考场汇总表</a>
              <div class="dropdown-divider"></div>
              <a class="dropdown-item" href="#" *ngIf="v.room_total > 0"
                 (click)="FuncService.ajaxDownload('layout/material/written/door.htm', {ly_group_id:v.ly_group_id})">门贴</a>
              <div class="dropdown-divider"></div>
              <a class="dropdown-item" href="#" *ngIf="v.room_total > 0"
                 (click)="FuncService.ajaxDownload('layout/material/written/seat.htm', {ly_group_id:v.ly_group_id})">桌贴(无照片) </a>
              <div class="dropdown-divider"></div>
              <a class="dropdown-item" href="#" *ngIf="v.room_total > 0"  (click)="goThreadDownload('layout/material/written/seatWithImage.htm',{ly_group_id:v.ly_group_id})">桌贴(带照片)</a>
              <div class="dropdown-divider"></div>
              <a class="dropdown-item" href="#" *ngIf="v.room_total > 0"
                 (click)="showMaterialParam(v, { material_name: '卷袋', download_url:'layout/material/written/bag.htm', arrayUrl:'layout/group/written/room/list.htm', arrayParam:v})">试卷卷袋</a>
              <div class="dropdown-divider"></div>
              <a class="dropdown-item" href="#" *ngIf="v.room_total > 0"
                 (click)="goThreadDownload('layout/material/written/sign.htm',{ly_group_id:v.ly_group_id})">签字单</a>
              <div class="dropdown-divider"></div>
              <a class="dropdown-item" href="#" *ngIf="v.room_total > 0"
                 (click)="FuncService.ajaxDownload('layout/material/written/sendreceive.htm', v)">试卷收发单</a>
              <div class="dropdown-divider"></div>
              <a class="dropdown-item" href="#" *ngIf="v.room_total > 0"
                 (click)="FuncService.ajaxDownload('layout/material/written/record.htm',v)">考场记录单</a>
              <div class="dropdown-divider"></div>
              <a class="dropdown-item" href="#" *ngIf="v.room_total > 0"
                 (click)="showRoomSeat(v)">浏览考场</a>
                <div class="dropdown-divider"></div>
                <a class="dropdown-item" href="#" *ngIf="v.room_total > 0" (click)="FuncService.ajaxDownload('frame/report/download.htm', {report_name:'MaterialReport', report_title :'数码打印材料下载',  ly_group_id:  v.ly_group_id})">数码打印材料下载</a>
                <div class="dropdown-divider"></div>
                <a class="dropdown-item" href="#" *ngIf="v.room_total > 0" (click)="FuncService.ajaxDownload('layout/material/written/paper/recover.htm',v)">试卷回收记录单</a>
            </div>
          </div>
        </td>
      </tr>
      </tbody>
    </table>
  </div>
  <div class="card card-default">
    <table class="table table-striped table-hover table-bordered">
      <thead>
      <tr>
        <th class="th-index">#</th>
        <th>科目名称</th>
        <th class="wd-sm">考试人数</th>
        <th class="wd-md">考试时间</th>
        <th class="wd-sm">笔试时长(分钟)</th>
        <th class="wd-xs"></th>
      </tr>
      </thead>
    </table>
  </div>
  <div class="card card-default"
       *ngFor="let group of ajax.getMap()['MoreArray'] | arrayFilter:  searchText | attrFilter :{exam_batch: exam_batch}">
    <div class="row card-header justify-content-between bg-gray">
      <div class="row ml-2 text-1-2">
        【{{group.group_name}}({{group.group_std_total}})】
        <span *ngIf="group.ly_status!=='Init' && group.room_total > 0 "
              class="text-success">【{{group.room_total}}个考场】</span>
        <span *ngIf="group.ly_status!=='Init' && (group.room_total=== undefined ||  group.room_total ===0) "
              class="text-warning">【未上传考场】</span>【<span
        [innerHTML]="group.aspect_num_flag | frameStatusCustom:['专业考号','准考证号','text-danger', 'text-black']"></span>】【<span
        [innerHTML]="group.once_flag | frameStatusCustom:['进场一次','多次进场', 'text-danger', 'text-black']"></span>】
        <span *ngIf="group.province_flag === 'Active'" class="text-warning">【分省内外考场】</span>
      </div>
      <div class="float-right mr-5">
        <div class="btn-group btn-group-sm mb-1 mr-1 ml-3" dropdown>
          <button class="btn dropdown-toggle btn-secondary btn-lg" type="button" dropdownToggle>分组操作
            <span class="caret"></span>
          </button>
          <div *dropdownMenu class="dropdown-menu modal-lg" role="menu">
            <a class="dropdown-item" href="#" *ngIf="group.room_total > 0"
               (click)="FuncService.ajaxDownload('frame/report/download.htm', {report_name:'LayoutMaterialWrittenRoom', report_title :group?.group_name + '考场汇总-', ly_group_id:group.ly_group_id})">考场汇总表</a>
            <div class="dropdown-divider"></div>

            <a class="dropdown-item" href="#" *ngIf="group.room_total > 0"
               (click)="FuncService.ajaxDownload('layout/material/written/door.htm', {ly_group_id:group.ly_group_id})">门贴</a>
            <div class="dropdown-divider"></div>
            <a class="dropdown-item" href="#" *ngIf="group.room_total > 0"
               (click)="FuncService.ajaxDownload('layout/material/written/seat.htm', {ly_group_id:group.ly_group_id})">桌贴(无照片)</a>
            <div class="dropdown-divider"></div>
            <a class="dropdown-item" href="#" *ngIf="group.room_total > 0"
               (click)="goThreadDownload('layout/material/written/seatWithImage.htm', {ly_group_id:group.ly_group_id})">桌贴(带照片)</a>
            <div class="dropdown-divider"></div>  <div class="dropdown-divider"></div>
            <a class="dropdown-item" href="#" *ngIf="group.room_total > 0"
               (click)="goThreadDownload('layout/material/written/sign.htm',{ly_group_id:group.ly_group_id})">签字单</a>
            <div class="dropdown-divider"></div>
            <a class="dropdown-item" href="#" *ngIf="group.room_total > 0"
               (click)="FuncService.ajaxDownload('layout/material/written/sendreceive.htm',group)">试卷收发单</a>
            <div class="dropdown-divider"></div>
            <a class="dropdown-item" href="#" *ngIf="group.room_total > 0"
               (click)="FuncService.ajaxDownload('layout/material/written/record.htm',group)">考场记录单</a>
            <div class="dropdown-divider"></div>
            <a class="dropdown-item" href="#" *ngIf="group.room_total > 0"
               (click)="FuncService.ajaxDownload('layout/material/written/seattable.htm',group)">考场座次表</a>
               <div class="dropdown-divider"></div>
               <a class="dropdown-item" href="#" *ngIf="group.room_total > 0" (click)="FuncService.ajaxDownload('frame/report/download.htm', {report_name:'MaterialReport', report_title :'数码打印材料下载',  ly_group_id:  group.ly_group_id})">数码打印材料下载</a>
          </div>
        </div>
      </div>
    </div>
    <table class="table table-striped table-hover table-bordered">
      <tbody>
      <tr *ngFor="let sb of ajax.getMap()['SubjectArray_' + group.ly_group_id] ; let i = index">
        <td class="th-index">{{sb.group_order}}</td>
        <td>{{sb.subject_name}}({{sb.subject_id}})</td>
        <td class="wd-sm"><span
          [tooltip]="'省内：' + sb.province_std_total + '；省外：' + sb.outside_std_total">{{sb.subject_std_total}}</span></td>
        <td class="wd-md">
          <span *ngIf="sb.exam_start_time">
          {{FuncService.dateToShortString(sb.exam_start_time)}} {{FuncService.dateToMinuteString(sb.exam_start_time)}}
            -{{FuncService.dateToMinuteString(sb.exam_end_time)}}</span>
        </td>
        <td class="wd-sm">{{sb.exam_minutes}}</td>
        <td class="wd-xs">
          <div class="btn-group btn-group-sm" dropdown style="margin-top:-2px">
            <button class="btn dropdown-toggle btn-secondary btn-sm" type="button" dropdownToggle>笔试材料
              <span class="caret"></span>
            </button>
            <div *dropdownMenu class="dropdown-menu" role="menu">
              <a class="dropdown-item" href="#"
                 (click)="showMaterialParam(group, {material_name: '卷袋', download_url:'layout/material/written/bag.htm', arrayUrl:'layout/group/written/room/list.htm', arrayParam:sb}, sb)">试卷卷袋</a>
              <div class="dropdown-divider"></div>
              <a class="dropdown-item" href="#" *ngIf="group.room_total > 0"
                 (click)="showMaterialParam(group, {thread_flag:'Active', material_name: '签字单', download_url:'layout/material/written/sign.htm', mapUrl:'layout/material/written/room/std.htm', mapParam:group},sb)">签字单</a>
              <div class="dropdown-divider"></div>
            </div>
          </div>
        </td>
      </tr>
      </tbody>
    </table>
  </div>
  <frame-ajax [url]="'layout/group/list.htm'"
              [requestData]="{group_type:'Written',ly_agent_id: agent.ly_agent_id,ly_status:'Publish'}"
              [autoRequest]="false"
              [requestParam]="{RequestDataType:'map', RequestWithLoading:true}" #ajax></frame-ajax>
</ng-container>
