adduser.component.html 10.8 KB
<div class="row" style="margin-right: 0px;">
  <!-- main-heading -->
  <div class="col-sm-12 pageHeading" style="margin-left: 15px;">
    <h4> Add User</h4>
  </div>
  <div class="col-sm-10 col-sm-offset-1 col-md-8 col-md-offset-2 col-lg-6 col-lg-offset-3">
    <div class="container-fluid main-full">
      <div class="row">
        <div class="well">
          <div class="row">
            <div class="col-sm-12">
              <div class="panel-body">
                <!-- form -->
                <form class="form-horizontal" [formGroup]="adduserFrm">
                  <div class="form-group" *ngIf="alerts !== ''">
                    <div class="col-xs-12">
                      <div class="alert alert-danger" [innerHTML]="alerts">
                      </div>

                    </div>
                  </div>
                  <div class="form-group">
                    <label for="inputEmail3" class="col-sm-4 control-label">User Name <span class="red">*</span> :</label>
                    <div class="col-sm-7">
                      <input type="text" class="form-control input-sm" id="name" placeholder="User Name" formControlName="UserName">
                      <span class="help-block">(Minimum 8 characters)</span>
                      <div *ngIf="!adduserFrm.controls.UserName.valid && adduserFrm.controls.UserName.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">User Name of minimum 8 characters is required.</div>
                    </div>
                  </div>
                  <div class="form-group">
                    <label for="inputPassword3" class="col-sm-4 control-label">Password <span class="red">*</span> :</label>
                    <div class="col-sm-7">
                      <input type="password" class="form-control input-sm" id="password" placeholder="" formControlName="Password">
                      <span class="help-block">(Minimum 8 characters)</span>
                      <div *ngIf="!adduserFrm.controls.Password.valid && adduserFrm.controls.Password.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Password of minimum 8 characters is required</div>
                    </div>
                  </div>
                  <div class="form-group">
                    <label for="inputPassword3" class="col-sm-4 control-label">Confirm Password <span class="red">*</span> :</label>
                    <div class="col-sm-7">
                      <input type="password" class="form-control input-sm" id="cpassword" placeholder="" formControlName="ConfirmPassword">
                      <div *ngIf="!adduserFrm.controls.ConfirmPassword.valid && !adduserFrm.controls.ConfirmPassword.value && adduserFrm.controls.ConfirmPassword.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Confirm Password is required</div>
                     
                      <div *ngIf="adduserFrm.controls.ConfirmPassword.value!=adduserFrm.controls.Password.value && adduserFrm.controls.ConfirmPassword.valid" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">
                        Password not match.
                      </div>
                    </div>
                  </div>
                  <div class="form-group">
                    <label for="inputPassword3" class="col-sm-4 control-label">Email Id <span class="red">*</span> :</label>
                    <div class="col-sm-7">
                      <input type="text" class="form-control" id="inputPassword3" placeholder="Email Id" formControlName="EmailId" pattern="[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,3}$">
                      <div *ngIf="adduserFrm.controls.EmailId.invalid && !adduserFrm.controls.EmailId.value &&  adduserFrm.controls.EmailId.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Email Id is required</div>

                      <div *ngIf="adduserFrm.controls.EmailId.invalid && adduserFrm.controls.EmailId.value" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">
                        Please enter the correct email.
                      </div>
                    </div>
                  </div>
                  <div class="form-group">
                    <label for="inputEmail3" class="col-sm-4 control-label">First Name <span class="red">*</span> :</label>
                    <div class="col-sm-7">
                      <input class="form-control input-sm" id="FirstName" placeholder="First Name" type="text" formControlName="FirstName">
                      <div *ngIf="!adduserFrm.controls.FirstName.valid && adduserFrm.controls.FirstName.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">First Name is required</div>
                    </div>
                  </div>
                  <div class="form-group">
                    <label for="inputEmail3" class="col-sm-4 control-label">Last Name <span class="red">*</span> :</label>
                    <div class="col-sm-7">
                      <input class="form-control input-sm" id="LastName" placeholder="Last Name" type="text" formControlName="LastName">
                      <div *ngIf="!adduserFrm.controls.LastName.valid && adduserFrm.controls.LastName.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Last Name is required</div>
                    </div>
                  </div>
                  <div *ngIf="this.router.url === '/adduser'">
                  <div class="form-group" #accountNo *ngIf="this.commonService.UserType == 1 || this.commonService.UserType == 2">
                    <label for="inputEmail3" class="col-sm-4 control-label">Account Number <span class="red">*</span> :</label>
                    <div class="col-sm-7" dropdown (isOpenChange)="onOpenChange($event)" (keyup)="onKeyPress($event)" [dropup]="isDropup">
                      <button id="button-dropup" dropdownToggle type="button" class="btn btn-primary dropdown-toggle col-sm-12 col-xs-12"
                              aria-controls="dropdown-dropup" style="height: 30px;">
                        <span class="pull-left" style="margin-top: -1px;">{{accountDropDownText}}</span>
                        <span class="caret pull-right" style="margin-top: 6px;"></span>
                      </button>
                      <ul id="dropdown-basic" *dropdownMenu class="dropdown-menu" role="menu" aria-labelledby="button-basic" style="overflow: scroll; height: 200px;" (scroll)="onScroll($event)">
                        <li role="menuitem">
                          <a class="dropdown-item" href="#" (click)="AccountNumberChanged(0, 'Select')">Select</a>
                        </li>
                        <li role="menuitem" *ngFor="let item of tempLstAccountNumbers">
                          <a class="dropdown-item" href="#" (click)="AccountNumberChanged(item.Id, item.AccountNumber)">{{item.AccountNumber}}</a>
                        </li>
                      </ul>
                    </div>
                  </div>
                  
                  <div class="form-group" #accountNo *ngIf="this.commonService.UserType > 2">
                    <label for="inputEmail3" class="col-sm-4 control-label">Account Number <span class="red">*</span> :</label>
                    <div class="col-sm-7" dropdown (isOpenChange)="onOpenChange($event)" (keyup)="onKeyPress($event)" [dropup]="isDropup">
                      <button id="button-dropup" dropdownToggle type="button" class="btn btn-primary dropdown-toggle col-sm-12 col-xs-12"
                              aria-controls="dropdown-dropup" style="height: 30px;">
                        <span class="pull-left" style="margin-top: -1px;">{{accountDropDownText}}</span>
                      </button>
                    </div>
                  </div>
                  <div class="form-group">
                    <label for="inputEmail3" class="col-sm-4 control-label">User Type <span class="red">*</span> :</label>
                    <div class="col-sm-7">
                      <select class="form-control input-sm" id="UserType" [formControl]="adduserFrm.controls['UserTypeId']">
                        <option value="0">Select</option>
                        <option *ngFor="let UserTypeEntity of UserTypeList" value="{{UserTypeEntity.Id}}">{{ UserTypeEntity.Title }}</option>
                      </select>
                    </div>
                  </div>
                  <div class="form-group">
                    <label for="inputEmail3" class="col-sm-4 control-label">Product Edition <span class="red">*</span> :</label>
                    <div class="col-sm-7">
                      <select class="form-control input-sm" id="ProductEdition" [formControl]="adduserFrm.controls['ProductEditionId']">
                        <option value="0">Select</option>
                        <option *ngFor="let ProductEditionEntity of ProductEditionList" value="{{ProductEditionEntity.Id}}">{{ ProductEditionEntity.Title }}</option>
                      </select>
                    </div>
                  </div>
                </div>
                  <div class="row">
                    <div class="col-sm-12 marginTop20 text-center">
                      <button type="button" class="btn btn-primary btn-sm" data-toggle="modal" (click)="AddUser()"><i class="fa fa-plus-circle"></i> Add</button>
                      <!--modal-->
                      <div class="modal fade bs-example-modal-sm text-left" tabindex="-1" role="dialog" id="mymodal">
                        <div class="modal-dialog modal-sm" role="document">
                          <div class="modal-content">
                            <div class="modal-header annotation-modal-header ui-draggable-handle">
                              <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                              <h4 class="modal-title" id="">Alert</h4>
                            </div>
                            <div class="modal-body">
                              <h5>Please enter a username</h5>
                            </div>
                            <div class="modal-footer">
                              <div class="row">
                                <div class="col-sm-12"><button class="btn btn-primary btn-sm">Ok</button></div>
                              </div>
                            </div>

                          </div><!-- /.modal-content -->
                        </div><!-- /.modal-dialog -->
                      </div>

                      <button class="btn btn-primary btn-sm" (click)="ResetForm()"><i class="fa fa-refresh"></i> Reset</button>
                      <button class="btn btn-primary btn-sm" (click)="redirect()"><i class="fa fa-close"></i> Cancel</button>
                    </div>

                  </div>
                </form>
                <!-- form -->
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>