<div class="panel panel-default">
  <div>
    <!--标题-->
    <div class="panel-title">
      <nav aria-label="breadcrumb">
        <ol class="breadcrumb">
          <li class="breadcrumb-item">外省转入</li>
          <li class="breadcrumb-item active" aria-current="page">外省转入审核</li>
        </ol>
      </nav>
    </div>
  </div>

  <div class="panel-body ml-sm " [hidden]="editShowType=='only'">
    <!--查询条件-->
    <div class="row mb-3 ml-1" [hidden]="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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;关键字：</label>
            <input name="query" [(ngModel)]="query.query" class="input-sm form-control" type="text" value="" maxlength="64"
              placeholder="请输入查询关键字">
          </div>
        </td>
        <td>
          <div class="input-group mr-1 input-group-sm">
            <label class="ml-sm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;转考批次：</label>
            <flex-select [allowClear]="true" [url]="TIME_URL" respDataPath="array" optionValueField="id"
              optionTextField="year_time" [(ngModel)]="query.time_config_id" placeholder="请选择" [ngModelOptions]="{standalone: true}"
              width="100" noResultsFound="无数据">
            </flex-select>
          </div>
        </td>
        <td>
          <div class="input-group mr-1 input-group-sm">
            <label class="ml-sm">状态：</label>
            <select
                width = "100"
                [(ngModel)]="query.status" 
                frameDict [dictName]="'TurnInStatus'" 
                [ngModelOptions]="{standalone: true}"
                class="form-control">
            </select>
          </div>
        </td>
          </tr>
          <tr>
              <td>
          <div class="input-group mr-1 input-group-sm">
              <label class="ml-sm">  审核机构主考学校：</label>
            <flex-select [allowClear]="true" [url]="SCHOOL_URL" respDataPath="array" optionValueField="id"
            optionTextField="org_name" [(ngModel)]="query.audit_school_id" placeholder="请选择" [ngModelOptions]="{standalone: true}"
            width="150" noResultsFound="无数据">
          </flex-select>
          </div>
          </td>
          <td>
          <div class="input-group mr-1 input-group-sm">
              <label class="ml-sm">  审核机构市考办：</label>
            <flex-select [allowClear]="true" [url]="CITY_URL" respDataPath="array" optionValueField="id"
              optionTextField="org_name" [(ngModel)]="query.autid_city_id" placeholder="请选择" [ngModelOptions]="{standalone: true}"
              width="100" noResultsFound="无数据">
            </flex-select>
          </div>
        </td>
        <td>
          <button class="btn btn-primary btn-rounded btn-outline btn-sm  mr-1">
            <i class="fa fa-search"></i> 查询</button>
          </td>
          </tr>
          </table>
          </form>
      </div>
    </div>

    <!-- 工具栏 -->
    <div class="row mb-2" [hidden]="editShowType=='only'">
      <div class="col-lg-12">
        <div class="pull-left" style="text-align: right;">
          <!--
          <button class="btn btn-primary mr-1 btn-sm" data-toggle="tooltip" data-placement="left" (click)="showAudit(editTemplateModal,'only')"
            title="审批">
            <i class="fa fa-check"></i>  审批</button>
          -->
            <button class="btn btn-primary mr-1 btn-sm" data-toggle="tooltip" data-placement="left" (click)= "printTurnin()"
            title="转入登记表">
            <i class="fa icon-cloud-download"></i>  转入登记表</button>
        </div>

      </div>
    </div>

    <!--表格-->
    <div class="row" [hidden]="editShowType=='only'">
      <div class="col-sm-12 ml-0">
        <table class="table table-sm table-striped table-hover table-bordered bg-white">
          <thead>
            <tr>
              <th>
                <div class="checkbox c-checkbox">
                  <label>
                    <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>转出省专业名称</th>
              <th>考生电话</th>
              <th>转出省份</th>
              <th align="center">转入准考证</th>
              <th>审核机构</th>
              <th>审核状态</th>
              <th align="center" style="width: 80px;">操作</th>
            </tr>
          </thead>
          <tbody>
            <tr *ngFor="let item of framePager.getRecords(); let i = index">
              <td>
                <div class="checkbox c-checkbox input-group-sm">
                  <label>
                    <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.ks_zkz}}</td>
              <td>{{item.ks_sfz}}</td>
              <td>{{item.ks_xm}}</td>
              <td>{{item.zy_dm}}</td>
              <td>{{item.zy_mc}}</td>
              <td>{{item.ks_phone}}</td>
              <td>{{item.out_province_name}}</td>
              <td align="center">{{item.zk_in_zkz}}</td>
              <td>{{item.org_name}}</td>
              <td *ngIf="item.status === 1">待市考办或主考学校审核</td>
              <!-- <td *ngIf="item.std_source === 3 && item.status === 1"> 待主考学校审核</td> -->
              <td>{{item.status | frameDict: 'TurnInStatus'}}</td>
              <td align="center">
               
                  <a href="#" 
                  (click)="showAudit(editTemplateModal,'only',item)" title="审批"><em
                    class="fa-lg fas fa-edit mr-1"></em></a>
                </td>
            </tr>
          </tbody>
        </table>
        <frame-pager [url]="QUERY_URL" hideSearch="true" hasCheck="true" #framePager (preReqEvent)="search($event)"></frame-pager>
      </div>
      <!-- 编辑页面 -->
      <div class="col-lg-12" *ngIf="item && editShowType != null &&editShowType!='modal'">
        <ng-container *ngTemplateOutlet="editTemplateModal">
        </ng-container>
      </div>

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

<!--编辑界面模板-->
<ng-template #editFormTemplate>
  <form [formGroup]="formModel" (ngSubmit)="audit()" class="form-validate form-horizontal" novalidate>

    <div class="row mt-3">
      <div class="col-lg-3"></div>
      <div class="col-lg-6">
        <h3>广西高等教育自学考试外省转入申请信息</h3>
      </div>
      <div class="col-lg-3"></div>
    </div>

    <div class="row mt-3">
      <div class="col-lg-12">
        <table class="table table-sm table-striped table-hover table-bordered bg-white">
          <tr>
            <td align="right">准考证号</td>
            <td>{{apply.ks_zkz}}</td>
            <td align="right">姓名</td>
            <td>{{apply.ks_xm}}</td>
            <td align="right">身份证</td>
            <td>{{apply.ks_sfz}}</td>
            <td rowspan="6" colspan="1" align="center"><img src="{{apply.std_photo_url}}" alt="考生头像" style="width: 180px;height: 240px;border:solid 1.5px #000000;" /></td>
            <td rowspan="6" colspan="1" align="center"><img src="{{turnin_photo_url}}" alt="考生转入头像" style="width: 180px;height: 240px;border:solid 1.5px #000000;" /></td>

          </tr>
          <tr>
              <td align="right">英文姓名</td>
            <td>{{apply.ks_exm}}</td>
            <td align="right">性别</td>
            <td>{{apply.ks_xb | frameDict: 'StdSexType'}}</td>
            <td align="right">户籍</td>
            <td>{{apply.hj_dm | frameDict: 'std_family_reg'}}</td>
          </tr>
          <tr>
              <td align="right">政治面貌</td>
            <td>{{apply.mm_dm | frameDict: 'std_political_status'}}</td>
            <td align="right">民族</td>
            <td>{{apply.mz_dm | frameDict: 'std_nation'}}</td>
            <td align="right">学历</td>
            <td>{{apply.xl_dm | frameDict: 'std_edu'}}</td>
          </tr>
          <tr>
              <td align="right">职业</td>
            <td>{{apply.zhiy_dm | frameDict: 'std_occupation'}}</td>
            <td align="right">专业代码</td>
            <td>{{apply.zy_dm}}</td>
            <td align="right">专业名称</td>
            <td>{{apply.zy_mc}}</td>
           
          </tr>
          <tr>
              <td align="right">专业层次</td>
            <td>{{apply.zy_ccdm | frameDict: 'MajorLevel'}}</td>
            <td align="right">专业类型</td>
            <td>{{apply.zy_lxdm | frameDict: 'major_type_code'}}</td>
            <td align="right">专业方向</td>
            <td>{{apply.zy_fx}}</td>
            
          </tr>
          <tr>
              <td align="right">证件类型</td>
              <td>{{apply.ks_zjlx| frameDict: 'CERT_TYPE'}}</td>
              <td align="right">考生生日</td>
              <td>{{apply.ks_birthday}}</td>
            <td align="right">考生邮编</td>
            <td>{{apply.ks_zip}}</td>
          </tr>
          <tr>
              
              <td align="right">考生电话</td>
              <td>{{apply.ks_phone}}</td>
              <td align="right">电子邮件</td>
              <td>{{apply.ks_email}}</td>
              <td align="right">奖罚记录</td>
              <td>{{apply.ks_jcjl}}</td>
              <td align="right">转出编号</td>
            <td>{{apply.zk_bh}}</td>
          </tr>
          <tr>
            
              <td align="right">转出省</td>
            <td>{{apply.out_province_name}}</td>
            <td align="right">转出时间</td>
            <td>{{apply.zk_out_sj}}</td>
            <td align="right">转出办理人</td>
            <td>{{apply.zk_out_blr}}</td>
            <td align="right">转出审核人</td>
            <td>{{apply.zk_out_shr}}</td>
          </tr>
          <tr>
            
              <td align="right">转出原因</td>
            <td>{{apply.zk_out_yy| frameDict: 'turn_out_reason'}}</td>
            <td align="right">转入省</td>
            <td>{{apply.in_province_name}}</td>
            <td align="right">转入准考证</td>
            <td>{{apply.zk_in_zkz}}</td>
            <td align="right">转入专业代码</td>
            <td>{{apply.zk_in_zy_dm}}</td>
          </tr>
          <tr>
            
              <td align="right">转入专业名称</td>
            <td>{{apply.zk_in_zy_mc}}</td>
            <td align="right">转入专业层次</td>
            <td>{{apply.zk_in_zy_ccdm | frameDict: 'MajorLevel'}}</td>
            <td align="right">转入专业类型</td>
            <td>{{apply.zk_in_zy_lxdm | frameDict: 'major_type_code'}}</td>
            <td align="right">转入专业方向</td>
            <td>{{apply.zk_zy_fx}}</td>
          </tr>
          <tr>
           
              <td align="right">审批状态</td>
            <td *ngIf="apply.status === 1">待市考办或者主考学校审核</td>
            <!-- <td *ngIf="apply.std_source === 3 && apply.status === 1"> 待主考学校审核</td> -->
            <td *ngIf="apply.status!==1">{{apply.status | frameDict: 'TurnInStatus'}}</td>
            <td align="right">考生地址</td>
            <td colspan="5">{{apply.ks_address}}</td>
          </tr>
        </table>
      </div>
    </div>

    <div class="row mt-3">
      <div class="col-lg-12">
        <table class="table table-sm table-striped table-hover table-bordered bg-white">
          <thead>
            <tr>
              <th align="center">准考证号</th>
              <th align="center">课程代码</th>
              <th>课程名称</th>
              <th align="center">成绩</th>
              <th align="center">学分</th>
              <th>合格原因</th>
              <th align="center">合格时间</th>
              <th align="center">考次号</th>
            </tr>
          </thead>
          <tbody>
            <tr *ngFor="let item of scoreList; let i=index">
              <td align="center">{{item.ks_zkz}}</td>
              <td align="center">{{item.kc_dm}}</td>
              <td>{{item.kc_mc}}</td>
              <td align="right">{{item.bk_cj}}</td>
              <td align="right">{{item.kc_xf}}</td>
              <td>{{item.hg_yydm | frameDict: 'pass_reason'}}</td>
              <td align="center">{{item.hg_sj | date: 'yyyy-MM-dd'}}</td>
              <td align="center">{{item.et_dm}}</td>
            </tr>
          </tbody>
        </table>
      </div>
    </div>


    <div class="row mt-3">
      <label class="col-lg-2 col-form-label text-lg-right">审批类型：</label>
      <div class="col-lg-4" *ngIf="curOrg.org_type == 0">
        <select [(ngModel)]="appr_type" formControlName="appr_type" [formControl]="formModel.controls['appr_type']"
          frameDict [dictName]="'AuditStatusProvince'" [(dictValue)]="appr_type" class="form-control">
        </select>
        <span class="text-danger" *ngIf="formModel.get('appr_type').hasError('required') && (formModel.get('appr_type').dirty || formModel.get('appr_type').touched)">请选择审批类型</span>
      </div>

      <div class="col-lg-4" *ngIf="curOrg.org_type != 0">
        <select [(ngModel)]="appr_type" formControlName="appr_type" [formControl]="formModel.controls['appr_type']"
          frameDict [dictName]="'AuditStatus'" [(dictValue)]="appr_type" class="form-control">
        </select>
        <span class="text-danger" *ngIf="formModel.get('appr_type').hasError('required') && (formModel.get('appr_type').dirty || formModel.get('appr_type').touched)">请选择审批类型</span>
      </div>

    </div>
    

    <div class="row mt-3">
      <label class="col-lg-2 col-form-label text-lg-right">审批意见：</label>
      <div class="col-lg-10">
        <textarea class="form-control" formControlName="reject_advice" [formControl]="formModel.controls['reject_advice']"
          placeholder="请填写审批意见" [(ngModel)]="reject_advice" rows="5"></textarea>
      </div>
    </div>


  </form>
</ng-template>


<ng-template #editTemplateModal>
  <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)="hideModal()">×</button>
    </div>

    <div class="modal-body">
      <div [ngTemplateOutlet]="editFormTemplate"></div>

    </div>
    <div class="modal-footer">
      <button class="btn btn-info" (click)="audit()">
        <i class="fa fa-info-circle"> </i> 审核
      </button>
      <button class="btn btn-default" (click)="hideModal()">
        <i class="icon-close"> </i> 取消
      </button>
    </div>
  </div>
</ng-template>