<form nz-form [formGroup]="form" (ngSubmit)="submit()" role="form">
  <nz-alert *ngIf="type === 0 && error && code != '651'" [nzType]="'error'" [nzMessage]="error" [nzShowIcon]="true" class="mb-lg">
  </nz-alert>
  <nz-alert
    *ngIf="error && code == '651'"
    [nzType]="'error'"
    [nzMessage]="error"
    [nzCloseText]="'申请license'"
    (nzOnClose)="getComputerInfo()"
  ></nz-alert>
  <nz-form-item>
    <nz-form-control [nzErrorTip]="'ic.action.enter.accout' | i18n">
      <nz-input-group nzSize="large" nzPrefixIcon="user">
        <input nz-input formControlName="userName" [placeholder]="'ic.action.enter.accout' | i18n" (focus)="clearError()" />
      </nz-input-group>
    </nz-form-control>
  </nz-form-item>
  <nz-form-item>
    <nz-form-control [nzErrorTip]="'ic.action.enter.password' | i18n">
      <nz-input-group nzSize="large" nzPrefixIcon="lock" [nzSuffix]="suffixTemplate">
        <input
          nz-input
          [type]="passwordVisible ? 'text' : 'password'"
          formControlName="password"
          [placeholder]="'ic.action.enter.password' | i18n"
          (focus)="clearError()"
        />
      </nz-input-group>
      <ng-template #suffixTemplate>
        <span nz-icon *ngIf="passwordVisible" [nzType]="'eye-invisible'" (click)="passwordVisible = !passwordVisible"></span>
        <span nz-icon *ngIf="!passwordVisible" [nzType]="'eye'" (click)="passwordVisible = !passwordVisible"></span>
      </ng-template>
    </nz-form-control>
  </nz-form-item>
  <nz-form-item>
    <nz-form-control [nzErrorTip]="'请获取手机号!' | i18n">
      <nz-input-group nzSize="large" nzPrefixIcon="phone">
        <input
          nz-input
          type="text"
          formControlName="mobile"
          [placeholder]="'ic.menu.click.right.to.get.captcha' | i18n"
          [(ngModel)]="phone"
          [disabled]="true"
        />
      </nz-input-group>
    </nz-form-control>
    <button
      nz-button
      nzType="primary"
      style="width: 112px"
      type="button"
      [disabled]="btnContent >= 1"
      (click)="getCaptcha(); $event.preventDefault()"
      nzSize="large"
      >{{ btnContent == 0 ? ('ic.menu.get.captcha' | i18n) : btnContent }}</button
    >
  </nz-form-item>
  <nz-form-item>
    <nz-form-control [nzErrorTip]="'validation.verification-code.required' | i18n">
      <nz-input-group nzSize="large" nzPrefixIcon="code">
        <input nz-input type="text" formControlName="captcha" [placeholder]="'ic.action.enter.captcha' | i18n" />
      </nz-input-group>
    </nz-form-control>
  </nz-form-item>

  <nz-form-item>
    <button class="ic-login-button" nz-button type="submit" nzType="primary" nzSize="large" nzBlock>
      {{ 'app.login.login' | i18n }}
    </button>
  </nz-form-item>

  <nz-form-item nz-row nzJustify="end">
    <!--    <nz-col-->
    <!--      *ngIf="showForgetPasswordButton"-->
    <!--      [nzSpan]="12"-->
    <!--      [ngClass]="{ 'text-right': !showRegisterButton }"-->
    <!--      class="login-forget-button-wrapper"-->
    <!--    >-->
    <!--      <ng-container>-->
    <!--        <label nz-checkbox>{{ '记住密码' | i18n }}</label>-->
    <!--      </ng-container>-->
    <!--    </nz-col>-->
    <nz-col *ngIf="showRegisterButton" [nzSpan]="12" class="text-right login-register-button-wrapper">
      <ng-container>
        <!--        <a class="forgot login-register-button" (click)="goToRegister()">{{ registerButtonName | i18n }}</a>-->
        <a class="forgot login-forget-button" (click)="forgetPassword()">{{ 'app.forget.password' | i18n }}</a>
      </ng-container>
    </nz-col>
  </nz-form-item>
</form>

<nz-modal
  [(nzVisible)]="isPwVisible"
  [nzTitle]="modalTitle"
  [nzContent]="modalContent"
  [nzFooter]="modalFooter"
  (nzOnCancel)="handleCancel()"
>
  <ng-template #modalTitle><span>密码已过期，请修改密码！</span></ng-template>

  <ng-template #modalContent>
    <sf #baseSf [formData]="formData" [schema]="schema" [button]="'none'" [cleanValue]="true"></sf>
  </ng-template>

  <ng-template #modalFooter>
    <button nz-button nzType="primary" (click)="destroyTplModal($event)" [nzLoading]="tplModalButtonLoading"> 提交 </button>
  </ng-template>
</nz-modal>

<nz-upload nzAction="inControlServer/sys/license/install?_allow_anonymous=true" *ngIf="code == '651'">
  <button nz-button><i nz-icon nzType="upload"></i><span>证书安装</span></button>
</nz-upload>

<nz-modal [(nzVisible)]="computerModel" nzTitle="本机信息" (nzOnCancel)="computerModel = false" nzFooter=" ">
  <nz-alert [nzType]="'error'" [nzMessage]="promptInfo" class="mb-lg"></nz-alert>
  <label>ip</label><input nz-input [(ngModel)]="computerIp" /> <label>mac</label><input nz-input [(ngModel)]="computerMac" />
  <label>cpu序列号</label><input nz-input [(ngModel)]="computerSerial" /> <label>主板序列号</label
  ><input nz-input [(ngModel)]="mainBoardSerial" />
</nz-modal>
