<div class="content-heading justify-content-between">
  <div>基础配置 -考点管理</div>
  <div>
      <a [hidden]="viewStep !=='page' " href="#" (click) = "optrAgent('add', initAgent)"><em class="fa-lg fas icon-plus "></em></a>
  </div>
</div>
<div class="text-gray ml-0 table-responsive bg-white" [hidden]="viewStep !== 'page'">
  <table class="table table-striped table-hover table-bordered">
    <thead>
    <tr>
      <th>#</th>
      <th><a (click)="page.sort('agent_code')">编号</a></th>
      <th></th>
      <th><a (click)="page.sort('agent_name')">考点名称</a></th>
      <th><a (click)="page.sort('short_name')">考点简称</a></th>
      <th>状态</th>
      <th>报名时间</th>
      <th>联系信息</th>
      <th style="width:140px;"></th>
    </tr>
    </thead>
    <tbody>
    <tr *ngFor="let v of page.getRecords(); let i = index">
      <td>{{i + 1}}</td>
      <td><img *ngIf="v.agent_image" [src]="('MateialWebPath' | frameParam) + '/Agent/' + v.agent_image" style="width:24px;height:24px;"></td>
      <td>{{v.agent_code}}</td>
      <td>{{v.agent_name}}</td>
      <td>{{v.short_name}}</td>
      <td [innerHTML]="v.agent_status | frameStatus"></td>
      <td>{{v.enrol_start_time}}<span *ngIf="v.enrol_end_time"> 至 {{v.enrol_end_time}}</span></td>
      <td>{{v.link_man_name}}<span *ngIf="v.link_man_tel">({{v.link_man_tel}})</span></td>
      <td nowrap>
        <a href="#" (click)="uploadAgentImage(v)" tooltip="上传考点图标"><em class="fa-lg fas fa-cloud-upload-alt"></em></a>
        <a class="ml-3" href="#" (click)="optrAgent('edit', v, 'cf/agent/find.htm')"><em class="fa-lg fas fa-edit "></em></a>
        <a frameRole res="cf_manage" class="ml-3" href="#" (click)="page.optr('cf/agent/del.htm',{agent_id:v.agent_id},undefined,'考点【'+v.agent_id+'】已成功删除！')"><em class="fa-lg fas fa-trash text-danger"></em></a>
      </td>
    </tr>
    </tbody>
  </table>
  <frame-pager [url]="'cf/agent/page.htm'" #page></frame-pager>
</div>


<div  [hidden]="viewStep === 'page' ">
  <div class="card card-default">
    <div class="card-body">
      <form [formGroup]="valForm"  class="form-validate form-horizontal" novalidate="">
        <div class="row" >
          <label class="col-lg-1 col-form-label text-lg-right">考点名称</label>
          <div class="col-lg-7">
            <input class="form-control" #elAutoFocus type="text" formControlName="agent_name" [formControl]="valForm.controls['agent_name']" [(ngModel)]="entity.agent_name" />
            <span class="text-danger" *ngIf="valForm.controls['agent_name'].hasError('required') && (valForm.controls['agent_name'].dirty || valForm.controls['agent_name'].touched)">请输入考点名称</span>
            <span class="text-danger" *ngIf="valForm.controls['agent_name'].hasError('rangewords') && (valForm.controls['agent_name'].dirty ||valForm.controls['agent_name'].touched)">最少需要2个字符，最大允许32个字符</span>
          </div>
          <label class="col-lg-1 col-form-label text-lg-right">考点状态</label>
          <div class="col-lg-3">
            <select class="custom-select" formControlName="agent_status" [formControl]="valForm.controls['agent_status']" [(ngModel)]="entity.agent_status" frameDict [dictName]="'FrameStatus'"></select>
            <span class="text-danger" *ngIf="valForm.controls['agent_status'].hasError('required') && (valForm.controls['agent_status'].dirty || valForm.controls['agent_status'].touched)">考点状态不允许为空</span>
          </div>
        </div>

      </form>
      <div class="row mt-3" >
        <label class="col-lg-1 col-form-label text-lg-right">考点简称</label>
        <div class="col-lg-3">
          <input class="form-control" type="text"[(ngModel)]="entity.short_name" />
        </div>
        <label class="col-lg-1 col-form-label text-lg-right">考点代码</label>
        <div class="col-lg-3">
          <input class="form-control" type="text"[(ngModel)]="entity.agent_code" />
        </div>
        <label class="col-lg-1 col-form-label text-lg-right">登录密码</label>
        <div class="col-lg-3">
          <input class="form-control" type="text" [(ngModel)]="entity.agent_alias" />
        </div>
      </div>

      <div class="row mt-3" >
        <label class="col-lg-1 col-form-label text-lg-right">考点地址</label>
        <div class="col-lg-7">
          <input class="form-control" type="text"[(ngModel)]="entity.agent_addr" />
        </div>
        <label class="col-lg-1 col-form-label text-lg-right">考点微信号</label>
        <div class="col-lg-3">
          <select class="custom-select" [(ngModel)]="entity.agent_weixin" >
            <option value="">请选择微信号</option>
            <option *ngFor="let v of weixinArray" value="{{v.wx_id}}">{{v.wx_name}}</option>
          </select>
        </div>
      </div>

      <div class="row mt-3" >
        <label class="col-lg-1 col-form-label text-lg-right">邮政编码</label>
        <div class="col-lg-3">
          <input class="form-control" type="text"[(ngModel)]="entity.agent_postal" />
        </div>
        <label class="col-lg-1 col-form-label text-lg-right">联系电话</label>
        <div class="col-lg-3">
          <input class="form-control" type="text"[(ngModel)]="entity.agent_tel" />
        </div>
        <label class="col-lg-1 col-form-label text-lg-right">传真号码</label>
        <div class="col-lg-3">
          <input class="form-control" type="text" [(ngModel)]="entity.agent_fax" />
        </div>
      </div>

      <div class="row mt-3" >
        <label class="col-lg-1 col-form-label text-lg-right">考点网址</label>
        <div class="col-lg-3">
          <input class="form-control" type="text" [(ngModel)]="entity.agent_url" />
        </div>
        <label class="col-lg-1 col-form-label text-lg-right">联系人姓名</label>
        <div class="col-lg-3">
          <input class="form-control" type="text"[(ngModel)]="entity.link_man_name" />
        </div>
        <label class="col-lg-1 col-form-label text-lg-right">联系人电话</label>
        <div class="col-lg-3">
          <input class="form-control" type="text"[(ngModel)]="entity.link_man_tel" />
        </div>
      </div>


      <div class="row mt-3" >
        <label class="col-lg-1 col-form-label text-lg-right">报考开始时间</label>
        <div class="col-lg-3">
          <input class="form-control" type="text" [(ngModel)]="entity.enrol_start_time" />
        </div>
        <label class="col-lg-1 col-form-label text-lg-right">报考结束时间</label>
        <div class="col-lg-3">
          <input class="form-control" type="text"[(ngModel)]="entity.enrol_end_time" />
        </div>
        <label class="col-lg-1 col-form-label text-lg-right">考试开始日期</label>
        <div class="col-lg-3">
          <input class="form-control" type="text"[(ngModel)]="entity.exam_start_date" />
        </div>
      </div>


      <div class="row mt-3" >
        <label class="col-lg-1 col-form-label text-lg-right">准考证开放</label>
        <div class="col-lg-3">
          <input class="form-control" type="text" [(ngModel)]="entity.ticket_start_time" />
        </div>
        <label class="col-lg-1 col-form-label text-lg-right">准考证关闭</label>
        <div class="col-lg-3">
          <input class="form-control" type="text"[(ngModel)]="entity.ticket_end_time" />
        </div>
        <label class="col-lg-1 col-form-label text-lg-right">考试结束日期</label>
        <div class="col-lg-3">
          <input class="form-control" type="text"[(ngModel)]="entity.exam_end_date" />
        </div>
      </div>

      <div class="row mt-3" >
        <label class="col-lg-1 col-form-label text-lg-right">接口参数</label>
        <div class="col-lg-3">
          <textarea class="form-control" [(ngModel)]="entity.agent_socket" rows="5"></textarea>
        </div>
        <label class="col-lg-1 col-form-label text-lg-right">备注信息</label>
        <div class="col-lg-3">
          <textarea class="form-control" [(ngModel)]="entity.agent_desc" rows="5"></textarea>
        </div>
        <label class="col-lg-1 col-form-label text-lg-right">乘车路线</label>
        <div class="col-lg-3">
          <textarea class="form-control" [(ngModel)]="entity.agent_desc" rows="5"></textarea>
        </div>
      </div>
      <div class="card-footer mt-2 text-center">
        <button class="btn btn-info" (click)="submitForm('cf/agent/')">{{getStepName()}}报考考点</button>&nbsp;&nbsp;&nbsp;
        <button class="btn btn-default" (click)="viewStep ='page'">取消操作</button>
      </div>
    </div>
  </div>
</div>
<div  class="mt-5">
<frame-uploader #uploader [silenceUpload]="true" [autoUpload]="true" [uploadUrl]="'cf/agent/icon/upload.htm'"></frame-uploader>
</div>
