<div class="modal-header">
  <h4 class="modal-title pull-left">修改【{{currentEntity?.optr_name}}（{{currentEntity?.login_name}}）】登录密码</h4>
</div>
<div class="modal-body" [formGroup]="detailForm">
  <div class="card card-default">
    <div class="card-body">
      <div class="form-group row" *ngIf="optrModel === 'edit'">
        <label class="col-lg-5 col-form-label text-lg-right">原始密码</label>
        <div class="col-lg-7 col-md-7">
          <input class="form-control" type="password" formControlName="old_pass" maxlength="16" [(ngModel)]="currentEntity.old_password"/>
          <form-valid [form]="detailForm" fieldName="old_password"></form-valid>
          <form-valid [form]="detailForm" fieldName="old_password" errorCode="minlength"></form-valid>
        </div>
      </div>

      <ng-container formGroupName="passwordGroup">
        <div class="form-group row">
          <label class="col-lg-5 col-form-label text-lg-right">新密码</label>
          <div class="col-lg-7 col-md-7">
            <input class="form-control" type="password" formControlName="password" maxlength="16" [(ngModel)]="currentEntity.new_pass"/>
            <span class="text-danger"
                  *ngIf="detailForm.hasError('required',['passwordGroup','password']) && (detailForm.get('passwordGroup').get('password').dirty || detailForm.get('passwordGroup').get('password').touched)">请输入登录密码</span>
            <span class="text-danger"
                  *ngIf="detailForm.hasError('minlength',['passwordGroup','password']) && (detailForm.get('passwordGroup').get('password').dirty || detailForm.get('passwordGroup').get('password').touched)">密码至少需要6位</span>

          </div>
        </div>
        <div class="form-group row">
          <label class="col-lg-5 col-form-label text-lg-right">密码确认</label>
          <div class="col-lg-7 col-md-7">
            <input class="form-control" type="password" formControlName="pconfirm" maxlength="16"/>
            <span class="text-danger"
                  *ngIf="detailForm.hasError('required',['passwordGroup','pconfirm']) && (detailForm.get('passwordGroup').get('pconfirm').dirty || detailForm.get('passwordGroup').get('pconfirm').touched)">请输入确认密码</span>
            <span class="text-danger"
                  *ngIf="detailForm.hasError('minlength',['passwordGroup','pconfirm']) && (detailForm.get('passwordGroup').get('pconfirm').dirty || detailForm.get('passwordGroup').get('pconfirm').touched)">密码至少需要6位</span>
            <span class="text-danger"
                  *ngIf="detailForm.hasError('password','passwordGroup') && !detailForm.hasError('required',['passwordGroup','pconfirm'])  && !detailForm.hasError('minlength',['passwordGroup','pconfirm']) && (detailForm.get('passwordGroup').get('pconfirm').dirty || detailForm.get('passwordGroup').get('pconfirm').touched)">{{detailForm.getError('password', 'passwordGroup')}}</span>
          </div>

        </div>
      </ng-container>

    </div>
  </div>
</div>
<div class="modal-footer">
  <button class="btn btn-primary" type="button"
          (click)="savePassword()">修改密码
  </button>
  <button class="btn btn-secondary" type="button" (click)="closeWindow()">取消操作</button>
</div>
