<h1 mat-dialog-title class="prevent-select">{{ isNew ? 'Registrar nuevo' : 'Editar' }} SCADA</h1>
<div mat-dialog-content class="prevent-select">
  <div class="is-loading animated fadeIn fast" *ngIf="isLoading">
    <mat-spinner align="center"></mat-spinner>
    <h3>Cargando datos ...</h3>
  </div>
  <div class="has-error animated fadeIn" *ngIf="!isLoading && hasError">
    <mat-icon class="red_primary_font">error</mat-icon>
    <h2>{{ errorStr }}</h2>
  </div>
  <div class="dialog_details_column animated fadeIn" *ngIf="!isLoading && !hasError">
    <div class="form-column" [formGroup]="scadaConfigFormGroup">
      <div class="form-row">
        <div class="form-cell C12">
          <mat-form-field appearance="outline" class="w-100 mt-8">
            <mat-label>Nombre del SCADA</mat-label>
            <input matInput placeholder="Ingrese el nombre del SCADA" formControlName="scadaNameControl">
            <mat-icon matSuffix>sensors</mat-icon>
            <mat-error *ngIf="scadaConfigFormGroup.invalid">{{ getErrorMessage("scadaNameControl") }}</mat-error>
          </mat-form-field>
        </div>
        <div class="form-cell C12">
          <mat-form-field appearance="outline" class="w-100 mt-8">
            <mat-label>Contraseña de acceso al Web Service</mat-label>
            <input matInput placeholder="Ingrese la contraseña del SCADA" [type]="showPassword ? 'text' : 'password'" 
            formControlName="scadaPassControl" [errorStateMatcher]="generalMatcher!" [readonly]="!isNew">
            <button mat-icon-button matSuffix (click)="showPassword = !showPassword">
              <mat-icon>{{ showPassword ? 'visibility_off' : 'visibility' }}</mat-icon>
            </button>
            <mat-error *ngIf="scadaConfigFormGroup.invalid">{{ getErrorMessage("scadaPassControl") }}</mat-error>
          </mat-form-field>
        </div>
      </div>
    </div>
  </div>
</div>
<mat-dialog-actions align="end">
  <button mat-button mat-dialog-close cdkFocusInitial>Cancelar</button>
  <button mat-button (click)="validateName()" [disabled]="scadaConfigFormGroup.invalid">
    {{ isNew ? 'Registrar SCADA' : 'Guardar cambios' }}
  </button>
</mat-dialog-actions>