profile.component.html 4.69 KB
<mat-card>
  <mat-toolbar color="primary">Operator</mat-toolbar>
  <mat-tab-group>
    <mat-tab>
      <ng-template matTabLabel>Profile</ng-template>
      <mat-card-content>
        <form fxLayout="column">
          <div fxLayout="row wrap">
            <div class="pb-1" fxLayout="row" fxLayout.sm="column" fxLayout.xs="column" fxLayoutGap="15px">
              <mat-form-field fxFlex style="width: 30%">
                <input matInput placeholder="First name" value="alex" disabled>
              </mat-form-field>
              <mat-form-field fxFlex style="width: 30%">
                <input matInput placeholder="Last name" value="paul" disabled>
              </mat-form-field>
              <mat-form-field fxFlex style="width: 30%">
                <input matInput placeholder="User Name" value="alex123" disabled>
              </mat-form-field>
            </div>
          </div>
          <div fxLayout="row wrap">
            <div class="pb-1" fxLayout="row" fxLayout.sm="column" fxLayout.xs="column" fxLayoutGap="15px">
              <mat-form-field fxFlex style="width: 30%">
                <input matInput placeholder="Email address" value="alex@ymail.com" disabled>
              </mat-form-field>
              <mat-form-field>
                <mat-select placeholder="Role" [(value)]="selectedRole" disabled>
                  <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>
            </div>
          </div>
          <hr>
          <mat-card-actions>
            <button mat-raised-button color="primary" type="submit">Submit</button>
            <button mat-raised-button color="accent" (click)="dialogRef.close(false)">Close</button>
          </mat-card-actions>
        </form>
      </mat-card-content>
    </mat-tab>
    <mat-tab>
      <ng-template matTabLabel>Change Password</ng-template>
      <mat-card-content>
        <form [formGroup]="form" >
          <div fxLayout="row wrap">
            <div class="pb-1" fxLayoutGap="15px">
              <mat-form-field fxFlex style="width: 250px">
                <input matInput placeholder="User Name" [formControl]="form.controls['uname']" required>
                <mat-error *ngIf="form.controls['uname'].hasError('required') && form.controls['uname'].touched"
                  class="mat-text-warn">You must include username.</mat-error>
              </mat-form-field>
              <mat-form-field fxFlex style="width: 250px">
                <input matInput placeholder="Old Password" type="password" [formControl]="form.controls['old_password']" required>
                <mat-error
                  *ngIf="form.controls['old_password'].hasError('required') && form.controls['old_password'].touched"
                  class="mat-text-warn">You must include old password.</mat-error>
              </mat-form-field>
            </div>
          </div>
          <div fxLayout="row wrap">
            <div class="pb-1" fxLayoutGap="15px">
              <mat-form-field fxFlex style="width: 250px">
                <input matInput placeholder="New Password" type="password" [formControl]="form.controls['new_password']"required>
                <mat-error
                  *ngIf="form.controls['new_password'].hasError('required') && form.controls['new_password'].touched"
                  class="mat-text-warn">You must include new password.</mat-error>
              </mat-form-field>
              <mat-form-field fxFlex style="width: 250px">
                <input matInput placeholder="Confirm Password" type="password" [formControl]="form.controls['confirm_password']"required>
                <mat-error
                  *ngIf="form.controls['confirm_password'].hasError('required') && form.controls['confirm_password'].touched"
                  class="mat-text-warn">You must include confirm password.</mat-error>
                <mat-error *ngIf="form.controls['confirm_password'].errors?.equalTo" class="mat-text-warn">Passwords
                  do not match.</mat-error>
              </mat-form-field>
            </div>
          </div>
          <hr>
          <mat-card-actions>
            <button mat-raised-button color="primary" type="submit" [disabled]="!form.valid">Submit</button>
            <button mat-raised-button color="accent" (click)="dialogRef.close(false)">Close</button>
          </mat-card-actions>
        </form>
      </mat-card-content>
    </mat-tab>
  </mat-tab-group>
</mat-card>