<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>
        省内已录{{drArray[0].i05}}人，省外已录{{drArray[0].i06}}人
    </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-2 mt-3"></div>
    <div class="col-lg-8 mt-3">
        <div class="card card-default">
            <div class="card-header">
                <div class="form-horizontal" method="get">

                    <fieldset>
                        <div class="form-group row mt-8">
                            <label class="col-lg-2 col-form-label text-right">选择面试科目</label>
                            <div class="col-lg-8">
                                <div>
                                    <ngx-select [items]="subjectArray" [(ngModel)]="param.subject_id"
                                        [autoClearSearch]="true" optionValueField="subject_id"
                                        optionTextField="subject_full_name"></ngx-select>
                                </div>
                            </div>
                            <div class="col-lg-2">
                                <button class="btn btn-primary" type="button" (click)="addSubject()">增加科目</button>
                            </div>
                        </div>
                    </fieldset>

                    <fieldset>
                        <div class="form-group row">
                            <label class="col-lg-2 col-form-label text-right">录入类型</label>
                            <div class="col-lg-3">
                                <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-3">
                                <input type="number" class="form-control"  [(ngModel)]="param.judge_num"
                                    (ngModelChange)="setJudge($event)" />
                            </div>
                        </div>
                    </fieldset>

                    <fieldset>
                        <div class="form-group row">
                            <label class="col-lg-2 col-form-label text-right">保留几位前缀</label>
                            <div class="col-lg-3">
                                <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-2" *ngIf="param.input_score_type === 'One'">
                                <input type="text" class="form-control" [(ngModel)]="param.tag" />
                            </div>
                        </div>
                    </fieldset>

                    <fieldset *ngIf="chooseSubject.length>0">
                        <div class="form-group row">
                            <div class="col-lg-2"></div>
                            <div class=" table-responsive bg-white col-lg-8">
                                <table class="table table-striped table-hover table-bordered">
                                    <thead>
                                        <tr>
                                            <td>#</td>
                                            <td>科目代码</td>
                                            <td>科目名称</td>
                                            <td>操作</td>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr *ngFor="let subject of chooseSubject; let j=index">
                                            <td>{{j+1}}</td>
                                            <td>{{subject.subject_code}}</td>
                                            <td>{{subject.subject_name}}</td>
                                            <td><button class="btn btn-danger" type="button"
                                                    (click)="removeSubject(subject)">删除</button></td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </fieldset>

                    <div *ngIf="param.input_score_type === 'One'">
                        <fieldset *ngFor="let v of param.judgeIds;let i =index">
                            <div class="form-group row">
                                <label class="col-lg-2 col-form-label text-right">设置评委</label>
                                <div class="col-lg-8">
                                    <ngx-select [items]="judgeArray" [(ngModel)]="v.judge" [autoClearSearch]="true"
                                        optionValueField="judge_id" optionTextField="full_judge_name"></ngx-select>
                                </div>
                            </div>
                        </fieldset>
                    </div>

                    <fieldset *ngIf="chooseSubject.length>0 && param.input_score_type && param.judge_num
                         && param.judgeIds.length === param.judge_num ">
                        <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-2"></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;">专业序列号</th>
                    <th>考生姓名</th>
                    <th>报考专业</th>
                </tr>
                </thead>
                <tbody>
                    <tr>
                        <td><input type="text" class="form-control" [(ngModel)]="param.ticket_num"  (keyup.enter)="searchStd($event)"  
                            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">
                <thead>
                <tr>
                    <th width="200px;">科目</th>
                    <th *ngFor="let item of param.judgeIds; let i =index">{{i+1}}号{{item.judge_name}}</th>
                </tr>
                </thead>
                <tbody>
                    <tr *ngFor="let s of chooseSubject; let i = index">
                        <td>{{s.subject_name}}</td>
                        <td *ngFor="let v of param.judgeIds">
                            <input type="text" class="form-control" [(ngModel)]="v['s0'+(i+1)]" 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.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>专业号码</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)">{{item.aspect_ticket_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:subject_ids,input_score_type: param?.input_score_type}"></frame-pager>
            </div>
        </div>

    </div>
</form>
