<div class="panel panel-default">
    <!--标题-->
    <div class="panel-title">
        <nav aria-label="breadcrumb">
            <ol class="breadcrumb">
                <!-- TODO -->
                <li class="breadcrumb-item">免考管理</li>
                <li class="breadcrumb-item active" aria-current="page">学历免考申请管理</li>
            </ol>
        </nav>
    </div>
    <div class="panel-body ml-sm" [hidden]="this.editShowType=='only'">
        <div class="card card-default">
            <div class="card-body">
                <!--查询条件-->
                <div class="row mb-3 ml-1" [hidden]="this.editShowType=='only'">
                    <div class="col-lg-12">
                        <form (ngSubmit)="framePager.goSearch()" class="form-inline">
                            <table>
                                <tr>
                                <td>
                                <div class="input-group mr-1 input-group-sm">
                                <label>准考证号：</label>
                                <input name="keyword" [(ngModel)]="query.ticket_no" style="width:150px" class="input-sm form-control" type="text" value="" maxlength="64">
                                
                                </div>
                            </td>
                            <td>
                                <div class="input-group mr-1 input-group-sm">
                                    <label>姓名：</label>
                                    <input name="keyword" [(ngModel)]="query.std_name" style="width: 150px" class="input-sm form-control" type="text" value="" maxlength="64">
                                
                                </div>
                            </td>
                            <td>
                                <div class="input-group mr-1 input-group-sm">
                                    <label>证件号：</label>
                                    <input name="keyword" [(ngModel)]="query.std_cert_no" style="width: 210px" class="input-sm form-control" type="text" value="" maxlength="64">
                                
                                </div>
                            </td>
                            </tr>
                            <tr>
                                    <td colspan="2">
                                <div class="input-group mr-1 input-group-sm">
                                    <label>证件类型：</label>
                                    <select class="input-sm form-control" [ngModelOptions]="{standalone: true}"  [(ngModel)]="query.cert_type_id">
                                        <option value="">请选择</option>
                                        <option *ngFor="let item of certTypeList" [value]="item.id">
                                            {{item.cert_code}}-{{item.cert_name}}
                                        </option>
                                    </select>
                                
                                
                                </div>
                                </td>
                                <td>
                                    <div class="input-group mr-1 input-group-sm">
                                        <label>是否一网通办办件：</label>
                                        <select class="input-sm form-control" [ngModelOptions]="{standalone: true}"  [(ngModel)]="query.is_atg">
                                                <option value="">请选择</option>
                                                <option value="1">是</option>
                                                <option value="0">否</option>
                                            </select>
                                        </div> 
                                </td>
                                
                                <!--<div class="input-group mr-1 input-group-sm">
                                    <label>批次：</label>
                                    <flex-select 
                                        [allowClear]="true"
                                        [url]= "'mk/mkCertTimeConfig/listAllByType.htm?type=2'"
                                        respDataPath= "array"
                                        optionValueField="id"
                                        optionTextField="year_time"
                                        [(ngModel)]="query.time_config_id"
                                        placeholder="请选择"
                                        [ngModelOptions]="{standalone: true}"
                                        width = "80"
                                        noResultsFound = "无数据"
                                        >
                                     </flex-select>
                                </div>-->
                                <td>
                            <button class="btn btn-primary btn-rounded btn-outline btn-sm  mr-1" (click)="framePager.goSearch()">
                                <i class="fa fa-search"></i> 查询</button>
                            <button class="btn btn-primary btn-rounded btn-outline btn-sm  mr-1" (click)="reset()">
                                <i class="fa fa-undo"></i> 重置</button>
                            <!-- <button type="submit">提交</button> -->
                        </td>
                        </tr>
                        </table>
                        </form>
                    </div>
                </div>

                <!-- 工具栏 -->
                <div class="row mb-2" [hidden]="this.editShowType=='only'">
                    <div class="col-lg-12">
                        <div class="pull-left" style="text-align: right;">
                            <button class="btn btn-primary btn-rounded btn-outline btn-sm  mr-1" data-toggle="tooltip" data-placement="left" (click)="downApplyPDF()"
                            title="下载免考申请文档">
                            下载免考申请文档</button>
                            &nbsp;
                            <button class="btn btn-primary btn-rounded btn-outline btn-sm  mr-1" data-toggle="tooltip" data-placement="left" (click)="syncScores()"
                            title="同步分数">
                            同步分数</button>
                        </div>
            
                    </div>
                </div>

                <!--表格-->
                <div class="row">
                    <div class="col-lg-12 ml-0" [hidden]="this.editShowType=='only'">
                        <table class="table table-sm table-striped table-hover table-bordered bg-white">
                            <thead>
                                <tr>
                                    <th>
                                        <div class="checkbox c-checkbox">
                                            <label class="nomargin">
                                                <input type="checkbox" (change)="framePager.checkedMasterToggle($event)" />
                                                <span class="fa fa-check"></span>
                                            </label>
                                        </div>
                                    </th>
                                    <th align="center">批次</th>
                                    <th align="center">准考证号</th>
                                    <th>姓名</th>
                                    <th>证件号</th>
                                    <th>已考课程名称</th>
                                    <th align="center">已考分数</th>
                                    <th>申请免考课程名称</th>
                                    <th>学历证书</th>
                                    <th>状态</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr *ngFor="let item of framePager.getRecords(); let i = index">
                                    <td>
                                        <div class="checkbox c-checkbox input-group-sm">
                                            <label nomargin>
                                                <input type="checkbox" [value]="item.id" [(checked)]="item.isChecked" [(ngModel)]="item.isChecked" />
                                                <span class="fa fa-check"></span>
                                            </label>
                                        </div>
                                    </td>

                                    <td align="center">{{item.year_time}}</td>
                                    <td align="center">{{item.ticket_no}}</td>
                                    <td>{{item.std_name}}</td>
                                    <td>{{item.std_cert_no}}</td>
                                    <td>{{item.done_course_name}}</td>
                                    <td align="right">{{item.done_course_score}}</td>
                                    <td>{{item.course_name}}</td>
                                    <td>{{item.cert_name}}</td>
                                    <td>{{item.status_text}}</td>
                
                                </tr>
                            </tbody>
                        </table>
                        <!-- TODO -->
                        <frame-pager [url]="QUERY_URL" hideSearch="true" hasCheck="true" #framePager (preReqEvent)="this.search($event)"></frame-pager>
                    </div>

                    <!-- 编辑页面 -->
                    <div class="col-lg-12" *ngIf="this.item && this.editShowType != null &&this.editShowType!='modal'">
                        <ng-container *ngTemplateOutlet="editTemplateModal">
                        </ng-container>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- only编辑页面 -->
    <div class="col-lg-12" *ngIf="this.item && this.editShowType != null && this.editShowType =='only'">
        <ng-container *ngTemplateOutlet="shouModalWin_verify">
        </ng-container>
    </div>
</div>

<ng-template #editFormTemplate>
    <table style="width:100%" class="table table-sm table-striped table-hover table-bordered bg-white">
        <tr>
            <td>准考证：</td>
            <td>{{item.ticket_no}}</td>
        </tr>
        <tr>
            <td>姓名：</td>
            <td>{{item.std_name}}</td>
        </tr>
        <tr>
            <td>身份证：</td>
            <td>{{item.std_cert_no}}</td>
        </tr>
        <tr>
            <td>课程：</td>
            <td>{{item.cert_course_name}}</td>
        </tr>
        <tr>
            <td>已考课程：</td>
            <td>{{item.done_course_name}}</td>
        </tr>
        <tr>
            <td>已考成绩：</td>
            <td>{{item.done_course_score}}</td>
        </tr>
        <tr>
            <td>学历证书：</td>
            <td>{{item.cert_name}}</td>
        </tr>
        <tr>
            <td>附件：</td>
            <td>
                <img *ngIf="!isPakage(item.file_path)" style="width:200px;height: 200px" [src]="item.file_path">
                <a *ngIf="isPakage(item.file_path)" [href]="item.file_path">打包压缩文件下载</a>
            </td>
        </tr>
        <tr>
            <td>评审结果：</td>
            <td>
                <label class="radio-inline c-radio">
                    <input type="radio" name="status" value="1" [(ngModel)]="item.status" />
                    <span class="fa fa-circle"></span>通过
                </label>
                <label class="radio-inline c-radio">
                    <input type="radio" name="status" value="0" [(ngModel)]="item.status" />
                    <span class="fa fa-circle"></span>不通过
                </label>
            </td>
        </tr>
        <tr>
            <td>初审意见</td>
            <td>
                <textarea [(ngModel)]="item.verify1_remark" rows="3" cols="100"></textarea>
            </td>
        </tr>
    </table>
 
</ng-template>

<ng-template #shouModalWin_verify>
    <div class="modal-content">
        <div class="modal-header info-success-qm">
            <div class="pull-left">
                <em class="fa-lg fas fa-edit "></em> 审批页面
            </div>
            <button type="button" class="close" (click)="this.hideModal()">×</button>
        </div>

        <!-- 1@3 -->
        <div class="modal-body">
            <div [ngTemplateOutlet]="editFormTemplate"></div>
        </div>

        <div class="modal-footer">
            <button class="btn btn-info" (click)="this.saveVerify()">
                <i class="fa fa-info-circle"> </i> 保存
            </button>
            <button class="btn btn-default" (click)="this.hideModal()">
                <i class="icon-close"> </i> 取消
            </button>
        </div>
    </div>
</ng-template>