<div class="modal-header">
  <h4 class="modal-title pull-left">编排-笔试分组</h4>
</div>
<div class="modal-body mb-1">

  <div class="card card-default" [formGroup]="detailForm">
    <div class="card-header bg-info">笔试编排参数</div>
    <div class="card-body">
      <div class="form-group row">
        <label class="col-lg-2 col-form-label text-lg-right">分组名称</label>
        <div class="col-lg-4 col-md-4">
          <input class="form-control" type="text" formControlName="group_name" [(ngModel)]="currentEntity.group_name"
                 maxlength="128"/>
          <form-valid [form]="detailForm" fieldName="group_name"></form-valid>
          <form-valid [form]="detailForm" fieldName="group_name" errorCode="minlength"></form-valid>
          <form-valid [form]="detailForm" fieldName="group_name" errorCode="maxlength"></form-valid>
        </div>
        <label class="col-lg-{{ResponseArray.length>1?1:2}} col-form-label text-lg-right">顺序</label>
        <div class="col-lg-{{ResponseArray.length>1?2:4}} col-md-{{ResponseArray.length>1?2:4}}">
          <input class="form-control" type="number" formControlName="ly_order" [(ngModel)]="currentEntity.ly_order"/>
          <form-valid [form]="detailForm" fieldName="ly_order"></form-valid>
          <form-valid [form]="detailForm" fieldName="ly_order" errorCode="min"></form-valid>
          <form-valid [form]="detailForm" fieldName="ly_order" errorCode="max"></form-valid>
        </div>
        <ng-container *ngIf="ResponseArray.length>1">
          <label class="col-lg-1 col-form-label text-lg-right">独立考场</label>
          <div class="col-lg-2 col-md-2">
            <select class="form-control" formControlName="room_limit_flag" frameDict
                    [dictName]="'FrameStatus'"
                    [tipFlag]="false"
                    [(ngModel)]="currentEntity.room_limit_flag"> </select>
          </div>
        </ng-container>
      </div>
      <div class="form-group row">
        <label class="col-lg-2 col-form-label text-lg-right">笔试预约</label>
        <div class="col-lg-4 col-md-4">
          <select class="form-control" formControlName="appointment_type" frameDict [dictName]="'FrameStatus'"
                  [tipFlag]="false" [(ngModel)]="currentEntity.appointment_type"> </select>
        </div>
        <label class="col-lg-2 col-form-label text-lg-right">一次进场</label>
        <div class="col-lg-4 col-md-4">
          <select class="form-control" formControlName="once_flag" frameDict [dictName]="'FrameStatus'"
                  [tipFlag]="false" [(ngModel)]="currentEntity.once_flag"> </select>
        </div>
      </div>

      <div class="form-group row">
        <label class="col-lg-2 col-form-label text-lg-right">省内外分考场</label>
        <div class="col-lg-4 col-md-4">
          <select class="form-control" formControlName="province_flag" frameDict [dictName]="'FrameStatus'"
                  [tipFlag]="false" [(ngModel)]="currentEntity.province_flag"> </select>
        </div>
        <label class="col-lg-2 col-form-label text-lg-right">专业考号桌贴</label>
        <div class="col-lg-4 col-md-4">
          <select class="form-control" formControlName="aspect_num_flag" frameDict [dictName]="'FrameStatus'"
                  [tipFlag]="false" [(ngModel)]="currentEntity.aspect_num_flag"> </select>
        </div>
      </div>

      <div class="form-group row">
        <label class="col-lg-2 col-form-label text-lg-right">集中候考</label>
        <div class="col-lg-4 col-md-4">
          <select class="form-control" formControlName="focus_flag" frameDict [dictName]="'FrameStatus'"
                  (change)="changeFocusFlag()"
                  [tipFlag]="false" [(ngModel)]="currentEntity.focus_flag"> </select>
        </div>
        <label class="col-lg-2 col-form-label text-lg-right">候考地址</label>
        <div class="col-lg-4 col-md-4">
          <input class="form-control" type="text" formControlName="focus_addr"
                 [readonly]="currentEntity.focus_flag === 'InActive'"
                 [(ngModel)]="currentEntity.focus_addr"
                 maxlength="256"/>
        </div>
      </div>
    </div>
  </div>
  <div class="card card-default">
    <div class="card-header bg-info">科目明细</div>
    <table class="table table-striped table-hover table-bordered">
      <thead>
      <tr>
        <th class="th-index"></th>
        <th>科目名称</th>
        <th class="wd-md">开考时间</th>
        <th class="wd-md">考试时长（分）</th>
      </tr>
      </thead>
      <tbody>
      <tr *ngFor="let v of ResponseArray; let i = index">
        <td>{{i+1}}</td>
        <td>{{v.subject_name}}</td>
        <td><input class="form-control form-control-sm wd-md" type="text" [(ngModel)]="v.exam_start_time" id="exam_start_time{{i+1}}" /></td>
        <td><input class="form-control form-control-sm wd-md" type="number" [(ngModel)]="v.exam_minutes"/></td>
      </tbody>
    </table>
  </div>
</div>
<div class="modal-footer justify-content-between">
  <div>
    <button class="btn btn-primary ml-2" type="button"
            (click)="FuncService.sortArray(ResponseArray, 'exam_start_time')">
      排序
    </button>
  </div>
  <div>
    <button class="btn btn-primary"  type="button" (click)="saveGroup()" *ngIf="currentEntity.ly_status !== 'Publish'">
      保存分组信息
    </button>
    <!--
    <button class="btn btn-primary" type="button" (click)="uploadRoom()" *ngIf="currentEntity.focus_flag === 'InActive'">
      选择考场文件
    </button>
    -->
    <button class="btn btn-secondary ml-2" type="button" (click)="closeWindow()">关闭窗口</button>
  </div>
</div>
