users.component.html 20.9 KB
<div class="row">
  <div class="col-sm-12 pageHeading" style="margin-left: 15px;">
    <h4> {{modalTitle}}</h4>
  </div>
  <div class="col-sm-12">
    <div [className]="divClass">
      <div class="container-fluid main-full">
        <form [formGroup]="Users">
          <div [style.visibility]="(Mode == 'Manage') ? 'visible' : 'hidden'" class="row">
            <div class="row">
              <div class="well no-margin-btm">
                <div class="row">
                  <div class="col-lg-3 col-sm-3">
                    <div class="row">
                      <div class="col-sm-12">
                        <div class="form-group marginTop5">
                          <label for="FirstName" class="col-sm-12 col-lg-6 control-label text-right-lg paddTop7 padd-left0">First Name :</label>
                          <div class="col-sm-12 col-lg-6 padd-left0 padd-right0">
                            <input type="text" class="form-control input-sm" id="FirstNames" placeholder="First Name" formControlName="FirstName">
                          </div>
                        </div>
                      </div>

                      <div class="col-sm-12">
                        <div class="form-group marginTop5">
                          <label for="LastName" class="col-sm-12 col-lg-6 control-label text-right-lg paddTop7 padd-left0">Last Name :</label>
                          <div class="col-sm-12 col-lg-6 padd-left0 padd-right0">
                            <input type="text" class="form-control input-sm" id="LastNames" placeholder="Last Name" formControlName="LastName">
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                  <div class="col-lg-3 col-sm-3">
                    <div class="row">
                      <div class="col-sm-12">
                        <div class="form-group marginTop5">
                          <label for="Email" class="col-sm-12 col-lg-6 control-label text-right-lg paddTop7 padd-left0">Email ID :</label>
                        </div>
                        <div class="col-sm-12 col-lg-6 padd-left0 padd-right0">
                          <input type="email" class="form-control input-sm" id="Email" placeholder="Email ID" formControlName="EmailId">
                        </div>
                      </div>

                      <div class="col-sm-12">
                        <div class="form-group marginTop5">
                          <label for="Account" class="col-sm-12 col-lg-6 control-label text-right-lg paddTop7 padd-left0">Account Number :</label>
                        </div>
                        <div class="col-sm-12 col-lg-6 padd-left0 padd-right0">
                          <input type="text" class="form-control input-sm" id="account" placeholder="Account Number" formControlName="AccountNumber">
                        </div>
                      </div>

                    </div>
                  </div>
                  <div class="col-lg-3 col-sm-3">
                    <div class="row">
                      <div class="col-sm-12">
                        <div class="form-group marginTop5">
                          <label for="State" class="col-sm-12 col-lg-6 control-label text-right-lg paddTop7 padd-left0">User Type :</label>
                          <div class="col-sm-12 col-lg-6 padd-left0 padd-right0">

                            <select class="form-control input-sm " id="State" [formControl]="Users.controls['UserTypeId']">
                              <option value="0">All</option>
                              <option *ngFor="let UserTypeEntity of UserTypeList" value="{{UserTypeEntity.Id}}">{{ UserTypeEntity.Title }}</option>
                            </select>
                          </div>
                        </div>
                      </div>


                      <div class="col-sm-12">
                        <div class="form-group marginTop5">
                          <label for="State" class="col-sm-12 col-lg-6 control-label text-right-lg paddTop7 padd-left0">Account Type :</label>
                          <div class="col-sm-12 col-lg-6 padd-left0 padd-right0">
                            <select class="form-control input-sm " id="AccountTypes" [formControl]="Users.controls['AccountTypeId']">
                              <option value="0">All</option>
                              <option *ngFor="let AccountTypeEntity of AccountTypeList" value="{{AccountTypeEntity.Id}}">{{ AccountTypeEntity.Title }}</option>
                            </select>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>


                  <div class="col-lg-2 col-sm-3">
                    <div class="row">
                      <div class="col-sm-12"><div class="form-group marginTop5">&nbsp;</div></div>

                      <div class="col-sm-12">
                        <div class="form-group marginTop5">
                          <div class="checkbox text-right-lg">
                            <!--<label class="marginR5">
                              <input type="checkbox" checked> Pagination Results
                            </label>-->
                            <button class="btn btn-primary btn-sm" (click)="SearchRecords(this)">Go <i class="fa fa-arrow-right"></i></button>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>

              </div>

              <div class="well">
                <table id="fixed_hdr2" class="table-hover ">
                  <thead>
                    <tr>
                      <th>First Name</th>
                      <th>Last Name</th>
                      <th>User ID</th>
                      <th>Password</th>
                      <th>Email ID</th>
                      <th>User Type</th>
                      <th>Created Date</th>
                      <th>Last Modified Date</th>
                      <th>Account Number</th>
                      <th>Product Edition</th>
                      <th>Status</th>
                    </tr>
                  </thead>

                  <tbody>
                    <tr *ngIf="NoRecord !== ''">

                      <td colspan="6"><b style="color: red;text-align: center; padding-left: 606px;"><span [innerHTML]="NoRecord"></span></b></td>
                    </tr>

                    <tr *ngFor="let UserEntity of UserList ;let i = index" (click)="SetClickedRow(i, UserEntity)" [class.active]="i == selectedRow" [class.inactive]="i != selectedRow">
                      <td><input type="hidden" value="{{UserEntity.Id}}">{{UserEntity.FirstName}}</td>
                      <td>{{UserEntity.LastName}}</td>
                      <td>{{UserEntity.LoginId}}</td>
                      <td>{{UserEntity.Password}}</td>
                      <td>{{UserEntity.EmailId}}</td>
                      <td>{{UserEntity.UserTypeTitle}}</td>
                      <td>{{UserEntity.CreationDate| date: 'MM/dd/yyyy'}}</td>
                      <td>{{UserEntity.ModifiedDate | date: 'MM/dd/yyyy'}}</td>
                      <td>{{UserEntity.AccountNumber}}</td>
                      <td>{{UserEntity.EditionType}}</td>
                      <td>
                        <span *ngIf="UserEntity.UserStatus=='Active'" class="label label-success">Active</span>
                        <span *ngIf="UserEntity.UserStatus!='Active'" class="label label-default">Inactive</span>
                      </td>
                    </tr>



                  </tbody>
                </table>
                <admin-pager [recordCount]="recordCount" [pageNo]="pageNo" [pageLength]="pageLength" (pagerEvent)="SearchUserList($event)"></admin-pager>
                <div class="row">
                  <div class="col-sm-12 marginTop20 text-center">
                    <button class="btn btn-primary btn-sm" (click)="EditManageUserRights()" [ngClass]="{disabled : !buttonStatus}"><i class="fa fa-thumbs-up"></i> Manage Rights</button>
                    <button class="btn btn-primary btn-sm" (click)="EditUser()" [ngClass]="{disabled : !EditbuttonStatus}"><i class="fa fa-edit"></i> Edit</button>
                  </div>
                </div>
              </div>

            </div>
          </div>
        </form>

        <div style="position: absolute; z-index: 100; width: 80%" [style.top]="topPos" [style.display]="(Mode=='Add' || Mode=='Edit') ? 'block' : 'none'"
             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>
                  <h5 class="text-center text-success"><strong>**To update your details fill all the text fields carefully.</strong></h5>
                  <!--<span class="help-block">**To update your details fill all the text fields carefully.</span>-->
                  <div class="form-group">
                    <label for="inputEmail3" class="col-sm-5 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-5 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-5 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.dirty" class="alert alert-danger" style="padding: 2px; margin-bottom: 2px;">Confirm Password is required</div>
                    </div>
                  </div>
                  <div class="form-group">
                    <label for="inputPassword3" class="col-sm-5 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-5 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-5 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 class="form-group">
                    <label for="status" class="col-sm-5 control-label">Status :</label>
                    <div class="col-sm-7">

                      <label class="radio-inline">
                        <input name="UserStatusActive" value="true" type="radio" formControlName="UserStatusActive" (change)="handleChange($event)">
                        Active
                      </label>
                      <label class="radio-inline">
                        <input name="UserStatusActive" value="false" type="radio" formControlName="UserStatusActive" (change)="handleChange($event)">
                        Inactive
                      </label>
                    </div>
                  </div>
                  <div class="form-group">
                    <label for="inputEmail3" class="col-sm-5 control-label">User Type:</label>
                    <div class="col-sm-7">

                      <input class="form-control input-sm" id="UserType" placeholder="" type="text" formControlName="UserType" [attr.disabled]="true">
                    </div>
                  </div>
                  <div class="form-group">
                    <label for="inputEmail3" class="col-sm-5 control-label">Account Type :</label>
                    <div class="col-sm-7">

                      <input class="form-control input-sm" id="AccountType" placeholder="" type="text" formControlName="AccountType" [attr.disabled]="true">
                    </div>
                  </div>
                  <div class="form-group">
                    <label for="inputEmail3" class="col-sm-5 control-label">Account Number  :</label>
                    <div class="col-sm-7">
                      <input class="form-control input-sm" id="AccountNumber" placeholder="" type="text" formControlName="AccountNumber" [attr.disabled]="true">

                    </div>
                  </div>
                  <div class="form-group">
                    <label for="inputEmail3" class="col-sm-5 control-label">Created Date  :</label>
                    <div class="col-sm-7">
                      <input class="form-control input-sm" id="Createddate" placeholder="" type="text" formControlName="Createddate" [attr.disabled]="true">

                    </div>
                  </div>
                  <div class="form-group">
                    <label for="inputEmail3" class="col-sm-5 control-label">Last Modified Date  :</label>
                    <div class="col-sm-7">
                      <input class="form-control input-sm" id="LastModifiedDate" placeholder="" type="text" formControlName="LastModifiedDate" [attr.disabled]="true">

                    </div>
                  </div>
                  <div class="form-group">
                    <label for="inputEmail3" class="col-sm-5 control-label">Created By  :</label>
                    <div class="col-sm-7">
                      <input class="form-control input-sm" id="Createdby" placeholder="" type="text" formControlName="Createdby" [attr.disabled]="true">

                    </div>
                  </div>
                  <div class="form-group">
                    <label for="inputEmail3" class="col-sm-5 control-label">Modified By  :</label>
                    <div class="col-sm-7">
                      <input class="form-control input-sm" id="Modifiedby" placeholder="" type="text" formControlName="Modifiedby" [attr.disabled]="true">

                    </div>
                  </div>
                  <div class="form-group">
                    <label for="inputEmail3" class="col-sm-5 control-label">Deactivation Date  :</label>
                    <div class="col-sm-7">
                      <input class="form-control input-sm" id="DeactivationDate" placeholder="" type="text" formControlName="DeactivationDate" [attr.disabled]="true">

                    </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)="UpdateUser(this)"><i class="fa fa-plus-circle"></i> Update</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)="EditUser()"><i class="fa fa-refresh"></i> Reset</button>
                      <button class="btn btn-primary btn-sm" (click)="CancelEditUser()"><i class="fa fa-close"></i> Cancel</button>
                    </div>

                  </div>
                </form>
                <!-- form -->
              </div>
            </div>
          </div>
        </div>
        
        <div style="position: absolute; z-index: 100; width: 80%" [style.top]="topPos" [style.display]="(Mode=='ManageRight') ? 'block' : 'none'"
             class="well">
          <div class="row">
            <div class="well">
              <div class="row">
                <div class="form-group" *ngIf="alerts !== ''">
                  <div class="col-xs-12">
                    <div class="alert alert-danger" [innerHTML]="alerts">
                    </div>

                  </div>
                </div>
                <div class="col-sm-12">
                  <div class="panel-body">

                    <div class="table-responsive blue">
                      <table class="table table-condensed table-bordered margin-btm0 table-striped table-hover">

                        <tr>
                          <th>Select</th>
                          <th>Module Names</th>
                        </tr>
                        <tr *ngFor="let UserRightEntity of UserManageRightsList; let j = index">
                          <td><input [checked]="UserRightEntity.MenuStatus==1" type="checkbox" (change)="onChange(j, UserRightEntity.Id, $event.target.checked)"></td>
                          <td>{{UserRightEntity.Title}}</td>
                        </tr>

                      </table>
                    </div>
                  </div>
                </div>
              </div>
              <div class="row">
                <div class="col-sm-12 marginTop20 text-center">
                  <button type="button" class="btn btn-primary btn-sm" (click)="UpdateManageUserRights(this)"><i class="fa fa-check"></i> Update</button>
                  <button type="submit" class="btn btn-primary btn-sm" (click)="CancelAddEdit()"><i class="fa fa-close"></i> Cancel</button>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      </div>
  </div>
  </div>