add-operator-dialog.component.html 4.51 KB
<mat-card>
  <mat-toolbar color="primary">Add Operator</mat-toolbar>
  <form [formGroup]="form">
    <mat-card-content>
      <div fxLayout="row wrap">
        <div class="mb-1">
          <mat-form-field style="width: 100%">
            <input matInput placeholder="First name" autofocus [formControl]="form.controls['fname']">
          </mat-form-field>
          <small *ngIf="form.controls['fname'].hasError('required') && form.controls['fname'].touched"
            class="mat-text-warn">You must include a first name.</small>
          <small *ngIf="form.controls['fname'].hasError('minlength') && form.controls['fname'].touched"
            class="mat-text-warn">Your first name must be at least 5 characters long.</small>
          <small *ngIf="form.controls['fname'].hasError('maxlength') && form.controls['fname'].touched"
            class="mat-text-warn">Your first name cannot exceed 10 characters.</small>
        </div>
      </div>

      <div fxLayout="row wrap">
        <div class="mb-1">
          <mat-form-field style="width: 100%">
            <input matInput placeholder="Last name" [formControl]="form.controls['lname']">
          </mat-form-field>
          <small *ngIf="form.controls['lname'].hasError('required') && form.controls['lname'].touched"
            class="mat-text-warn">You must include a last name.</small>
          <small *ngIf="form.controls['lname'].hasError('minlength') && form.controls['lname'].touched"
            class="mat-text-warn">Your last name must be at least 5 characters long.</small>
          <small *ngIf="form.controls['lname'].hasError('maxlength') && form.controls['lname'].touched"
            class="mat-text-warn">Your last name cannot exceed 10 characters.</small>
        </div>
      </div>

      <div fxLayout="row wrap">
        <div class="mb-1">
          <mat-form-field style="width: 100%">
            <input matInput placeholder="User name" [formControl]="form.controls['uname']">
          </mat-form-field>
          <small *ngIf="form.controls['uname'].hasError('required') && form.controls['uname'].touched"
            class="mat-text-warn">You must include a user name.</small>
          <small *ngIf="form.controls['uname'].hasError('minlength') && form.controls['uname'].touched"
            class="mat-text-warn">Your user name must be at least 5 characters long.</small>
          <small *ngIf="form.controls['uname'].hasError('maxlength') && form.controls['uname'].touched"
            class="mat-text-warn">Your user name cannot exceed 10 characters.</small>
        </div>
      </div>

      <div class="mb-1">
        <mat-form-field style="width: 100%">
          <input matInput placeholder="Email address" [formControl]="form.controls['email']" type="email">
        </mat-form-field>
        <small *ngIf="form.controls['email'].hasError('required') && form.controls['email'].touched"
          class="mat-text-warn">You must include an email address.</small>
        <small *ngIf="form.controls['email'].errors?.email && form.controls['email'].touched" class="mat-text-warn">You
          must include a valid email address.</small>
      </div>
      <div class="mb-1">
        <mat-form-field style="width: 100%">
          <input matInput placeholder="Password" [formControl]="form.controls['password']" type="password">
        </mat-form-field>
        <small *ngIf="form.controls['password'].hasError('required') && form.controls['password'].touched"
          class="mat-text-warn">You must include password.</small>
      </div>
      <div class="mb-1">
        <mat-form-field style="width: 100%">
          <mat-select placeholder="Role" [formControl]="form.controls['role']">
            <mat-option>--</mat-option>
            <mat-option value="SUPERADMIN">Super Admin</mat-option>
            <mat-option value="ADMIN">Admin</mat-option>
            <mat-option value="MARKETING">Marketing</mat-option>
            <mat-option value="DEVELOPER">Developer</mat-option>
            <mat-option value="QA">QA</mat-option>
            <mat-option value="CS">CS</mat-option>
          </mat-select>
        </mat-form-field>
        <small *ngIf="form.controls['role'].hasError('required') && form.controls['role'].touched"
          class="mat-text-warn">You must include role.</small>
      </div>
    </mat-card-content>
    <hr>
    <mat-card-actions>
      <button mat-raised-button color="primary" type="submit" [disabled]="!form.valid">Submit</button>
      <button mat-raised-button class="shadow-none" (click)="dialogRef.close(true)">Close</button>
    </mat-card-actions>
  </form>
</mat-card>