<div class="content-heading  justify-content-between">
  <div *ngIf="currentStep === 'Init'">分数录入</div>
  <div *ngIf="currentStep === 'Input'">分数录入&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <span class="text-primary">
        {{param.subject_names}}&nbsp;&nbsp;&nbsp;&nbsp;
      {{FrameService.getFrameDictText('InputScoreType', param.input_score_type)}}&nbsp;&nbsp;&nbsp;&nbsp;</span>
  </div>
  <div class="float-right" *ngIf="currentStep === 'Input'">
    <div class="row">
       <div *ngIf="param.input_score_type === 'Two'">
        <input class="form-control " type="text" [(ngModel)]="searchText" placeholder="输入专业序列号搜索"
               autocomplete="false" (keyup.enter)="searchStdScore()"/>
      </div>
      <div class="ml-3" *ngIf="param.input_score_type === 'Two'">
        <button class="btn btn-primary" (click)="searchStdScore()">查询一录</button>
      </div> 
      <div class="btn-group mr-4 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 text-danger" href="#" (click)="chooseSubjectAgain()">选择科目</a>
          <div class="dropdown-divider"></div>
        </div>
      </div>

    </div>
  </div>
</div>


<div class="row" *ngIf="currentStep === 'Init'">
  <div class="col-lg-1 mt-3"></div>
  <div class="col-lg-10 mt-3">
    <div class="card card-default">
      <div class="card-header">
        <div class="form-horizontal">


          <fieldset>
            <div class="form-group row mt-8">
              <label class="col-lg-2 col-form-label text-right">请选择专业</label>
              <div class="col-lg-10">
                <div>
                  <ngx-select [items]="aspectArray" [(ngModel)]="param.aspect_id" size="large"
                              [autoClearSearch]="true" optionValueField="aspect_id" 
                              optionTextField="aspect_name" (ngModelChange)="getSubject(param.aspect_id)"></ngx-select>
                </div>
              </div>
            </div>
          </fieldset>

          <fieldset>
            <div class="form-group row mt-8">
              <label class="col-lg-2 col-form-label text-right">请选择考试科目</label>
              <div class="col-lg-10">
                <div>
                  <ngx-select [items]="subjectArray" [(ngModel)]="param.subjectArray" size="large"
                              [autoClearSearch]="true" optionValueField="subject_id" [multiple]="true"
                              optionTextField="subject_full_name"></ngx-select>
                </div>
              </div>
            </div>
          </fieldset>

          <fieldset>
            <div class="form-group row">
              <label class="col-lg-2 col-form-label text-right">录入类型</label>
              <div class="col-lg-4">
                <select class="form-control" frameDict [dictName]="'InputScoreType'"
                        [(ngModel)]="param.input_score_type"> </select>
              </div>
              <label class="col-lg-2 col-form-label text-right">科目横排</label>
              <div class="col-lg-4">
                <select class="form-control" frameDict dictName="FrameStatus"
                                             [(ngModel)]="param.layout_type"> </select>
              </div>
             
            </div>
          </fieldset>
          <fieldset>
            <div class="form-group row">
              <label class="col-lg-2 col-form-label text-right">证件类型</label>
              <div class="col-lg-4">
                <select class="form-control" frameDict [dictName]="'ExamTicketType'"
                [(ngModel)]="param.examticket_type"> </select>
              </div>               
              <label class="col-lg-2 col-form-label text-right">评委数量</label>
              <div class="col-lg-4">
                <input type="number" class="form-control" [(ngModel)]="param.judge_num"/>
              </div>
            </div>
          </fieldset>          
          <fieldset>
            <div class="form-group row">
 
               <label class="col-lg-2 col-form-label text-right">保留几位前缀</label>
              <div class="col-lg-4">
                  <input type="number" class="form-control" value="5" [(ngModel)]="param.prefix" />
              </div> 
              <label class="col-lg-2 col-form-label text-right"  *ngIf="param.input_score_type === 'One'">袋号</label>
              <div class="col-lg-4" *ngIf="param.input_score_type === 'One'">
                  <input type="text" class="form-control" [(ngModel)]="param.tag" />
              </div>
            </div>
          </fieldset>

          <fieldset *ngIf="param.judge_num && param.input_score_type && param.layout_type">
            <div class="d-flex justify-content-center">
              <button class="btn btn-primary" type="button" (click)="startInput()">开始录入分数</button>
            </div>
          </fieldset>
        </div>

      </div>
    </div>
  </div>
  <div class="col-lg-1"></div>
</div>


<form name="subjectForm" class="showcase-form" novalidate>
  <div *ngIf="currentStep === 'Input'" class="row">
    <div class="col-lg-12">
      <div class="modal-body">
        <table class="table table-striped table-hover table-bordered">
          <thead>
          <tr>
            <th width="200px;" *ngIf="param.examticket_type==='Ticket'">准考证号</th>
            <th width="200px;" *ngIf="param.examticket_type==='Aspect'">专业考试序号</th>
            <th>考生姓名</th>
            <th>报考专业</th>
          </tr>
          </thead>
          <tbody>
          <tr>
            <td><input type="text"  class="form-control cert_field" [(ngModel)]="param.ticket_num" (keyup.enter)="searchStd($event, 'search')"
                       name="ticket_num" onmouseover="this.focus()" #ticketNum></td>
            <td>{{std.std_name}}</td>
            <td>{{std.cert_type}}</td>
          </tr>
          </tbody>
        </table>
      </div>
    </div>

    <div class="col-lg-12">
      <div class="modal-body">
        <table class="table table-striped table-hover table-bordered" *ngIf="param.layout_type==='InActive'">
          <thead>
          <tr>
            <th width="200px;">科目</th>
            <th *ngFor="let v of param.judge_num | numberArray">{{v}}号评委</th>
          </tr>
          </thead>
          <tbody>
          <tr *ngFor="let s of scoreArray; let i = index">
            <td>{{s.subject_name}}</td>
            <td *ngFor="let v of param.judge_num | numberArray">
              <input type="text" class="form-control" [(ngModel)]="s['js0'+v]" style="width:150px;"
                     (keyup.enter)="changScore($event)" [ngModelOptions]="{standalone: true}"/>
            </td>
          </tr>
          </tbody>
        </table>

        <table class="table table-striped table-hover table-bordered"  *ngIf="param.layout_type==='Active'">
          <thead>
          <tr>
            <td></td>
            <td  *ngFor="let s of scoreArray">{{s.subject_name}}</td>
          </tr>
          </thead>
          <tbody>
          <tr *ngFor="let v of param.judge_num | numberArray">
            <td>第{{v}}评委</td>
            <td *ngFor="let s of scoreArray; let i = index">
              <input type="text" class="form-control" [(ngModel)]="s['js0'+v]" style="width:150px;"
                     (keyup.enter)="changScore($event)" [ngModelOptions]="{standalone: true}"/>
            </td>
          </tr>
          </tbody>
        </table>

      </div>
    </div>

    <div class="col-lg-12">
      <div class="modal-footer justify-content-between">
        <div class="mb-1 mr-1">
          <button class="btn btn-info">本次输入了{{stdArray.length}}个考生</button>&nbsp;&nbsp;&nbsp;&nbsp;
          <button class="btn btn-info" *ngIf="param.tag && param.input_score_type === 'One'">当前袋号：{{param.tag}}</button>
        </div>
        <div class="float-right">
          <button class="btn btn-info" (click)="editScore()" *ngIf="param.input_score_type === 'One' && change">修改一录分数
          </button>
        </div>
      </div>
    </div>

    <div class="col-lg-12">
      <div class="modal-body">
        <table class="table table-striped table-hover table-bordered">
          <thead>
          <tr>
            <th>#</th>
            <th *ngIf="param.examticket_type==='Ticket'">准考证号</th>
            <th *ngIf="param.examticket_type==='Aspect'">专业考试序号</th>
            <th>姓名</th>
            <th>分数</th>
            <th></th>
          </tr>
          </thead>
          <tbody>
          <!-- <tr *ngFor="let item of stdArray; let i = index;">
            <td>{{i + 1}}</td>
            <td (click)="viewScore(item)">{{item.aspect_ticket_num}}</td>
            <td (click)="viewScore(item)">{{item.std_name}}</td>
            <td>
              <a (click)="viewScore(item)" *ngFor="let s of item.score">{{s}}&nbsp;&nbsp;&nbsp;&nbsp;</a>
            </td>
            <td>
              <button class="btn btn-danger" *ngIf="param.input_score_type==='One'" (click)="deleteScore(item)">删除
              </button>
            </td>
          </tr> -->

          <tr *ngFor="let item of pager.getRecords(); let i = index">
            <td>{{i+1}}</td>
            <td (click)="viewScore(item)" *ngIf="param.examticket_type==='Ticket'">{{item.ticket_no}}</td>
            <td (click)="viewScore(item)" *ngIf="param.examticket_type==='Aspect'">{{item.aspect_num}}</td>
            <td (click)="viewScore(item)">{{item.std_name}}</td>
            <td>
                <a (click)="viewScore(item)">
                    <span *ngIf="item.js01">{{item.js01}}</span>&nbsp;&nbsp;&nbsp;&nbsp;
                    <span *ngIf="item.js02">{{item.js02}}</span>&nbsp;&nbsp;&nbsp;&nbsp;
                    <span *ngIf="item.js03">{{item.js03}}</span>&nbsp;&nbsp;&nbsp;&nbsp;
                    <span *ngIf="item.js04">{{item.js04}}</span>&nbsp;&nbsp;&nbsp;&nbsp;
                    <span *ngIf="item.js05">{{item.js05}}</span>&nbsp;&nbsp;&nbsp;&nbsp;
                    <span *ngIf="item.js06">{{item.js06}}</span>&nbsp;&nbsp;&nbsp;&nbsp;
                    <span *ngIf="item.js07">{{item.js07}}</span>&nbsp;&nbsp;&nbsp;&nbsp;
                    <span *ngIf="item.js08">{{item.js08}}</span>&nbsp;&nbsp;&nbsp;&nbsp;
                    <span *ngIf="item.js09">{{item.js09}}</span>
                </a>
            </td>
            <td>
                <button class="btn btn-danger" *ngIf="param.input_score_type==='One'" (click)="deleteScore(item)">删除</button>
            </td>
        </tr>
          </tbody>
        </table>
        <frame-pager [url]="'./score/input/page/ago.htm'" #pager [pagerLimit]="10" [pagerParams]="{subject_ids:param?.subjectArray,input_score_type: param?.input_score_type}"></frame-pager>
      </div>
    </div>

  </div>
</form>
