Skip to content

Commit

Permalink
Merge pull request #469 from NandiniAV/cbrelease-4.8.14
Browse files Browse the repository at this point in the history
'Mark this user as nonverified' flow & cancel button flow added
  • Loading branch information
vishnubansaltarento authored May 17, 2024
2 parents 52ad6d5 + bc0d75a commit f81c802
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
<div class="inner-body">
Primary Details <mat-icon class="ws-mat-black40-text custominfo">info_outline</mat-icon>
<p class="float-right mat-body-2" *ngIf="user?.profileDetails?.profileStatus === 'VERIFIED'">
<mat-slide-toggle>Mark this user as non-verified</mat-slide-toggle>
<mat-slide-toggle (click)="markStatus('NOT-VERIFIED', user)">Mark this user as
non-verified</mat-slide-toggle>
</p>
<div class="flex flex-row margin-top-m">
<div class="md:w-1/3">
Expand Down Expand Up @@ -313,17 +314,19 @@
</div>

<div class="flex flex-row margin-top-m">
<div class="md:w-1/2" *ngIf="!isMdoAdmin">
<div class="md:w-1/1" *ngIf="!isMdoAdmin">
<label for="roles" class="margin-remove-bottom form-label required" i18n-aria-label
aria-label="Roles label" i18n="Role label|Label which explains the user to select the roles">
Role
</label>
<mat-selection-list id="roles" formControlName="roles" #roles class="roles-list">
<mat-list-option *ngFor="let role of rolesList" (click)="modifyUserRoles(role.roleName)"
[selected]="userRoles.has(role.roleName)" [value]="role?.roleName">
{{role.roleName}}
</mat-list-option>
</mat-selection-list>
<div>
<mat-selection-list id="roles" formControlName="roles" #roles class="roles-list">
<mat-list-option *ngFor="let role of rolesList" (click)="modifyUserRoles(role.roleName)"
[selected]="userRoles.has(role.roleName)" [value]="role?.roleName">
{{role.roleName}}
</mat-list-option>
</mat-selection-list>
</div>
</div>

<div class="md:w-1/2" *ngIf="isMdoAdmin">
Expand All @@ -345,7 +348,7 @@
Update
</span>
</button>
<button mat-raised-button type="submit" (click)="cancelSubmit()"
<button mat-raised-button type="submit" (click)="cancelSubmit(user)"
class="btn-success btn-responsive cancelbtn">
<span i18n>
Cancel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,8 @@ label {
margin-right: 12px;
height: auto;
padding: 0.7em 0;
display: ruby;
height: 50px;
}

.mat-form-field-disabled .mat-form-field-outline {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export class UserCardComponent implements OnInit {
@Output() paginationData = new EventEmitter()
@Output() searchByEnterKey = new EventEmitter()
@Output() disableButton = new EventEmitter()
@Output() updateList = new EventEmitter()
@ViewChildren(MatExpansionPanel) panels!: QueryList<MatExpansionPanel>

@ViewChild('rejectDialog', { static: false })
Expand Down Expand Up @@ -249,7 +250,8 @@ export class UserCardComponent implements OnInit {
countryCode: '+91',
})
},
(_err: any) => {
// tslint:disable-next-line
(_err: any) => {
})
}

Expand Down Expand Up @@ -433,8 +435,9 @@ export class UserCardComponent implements OnInit {
this.userwfData = approvalData
}

cancelSubmit() {
cancelSubmit(user: any) {
this.updateUserDataForm.reset()
user.enableEdit = !user.enableEdit
}

modifyUserRoles(role: string) {
Expand Down Expand Up @@ -559,30 +562,33 @@ export class UserCardComponent implements OnInit {
this.updateUserDataForm.reset({ roles: '' })
this.openSnackbar('User role updated Successfully')
panel.close()
this.updateList.emit()
// this.router.navigate(['/app/home/users/allusers'])

this.usersSvc.getUserById(user.userId).subscribe((_res: any) => {
if (_res) {
// tslint:disable-next-line
user = _res
user['enableEdit'] = false
}
})
// this.usersSvc.getUserById(user.userId).subscribe((_res: any) => {
// if (_res) {
// // tslint:disable-next-line
// user = _res
// user['enableEdit'] = false
// }
// })
}
})
} else {
this.openSnackbar('Select new roles')
}
} else {
user['enableEdit'] = false
this.usersSvc.getUserById(user.userId).subscribe((res: any) => {
if (res) {
// tslint:disable-next-line
user = res
user.enableEdit = false
panel.close()
}
})

panel.close()
this.updateList.emit()
// this.usersSvc.getUserById(user.userId).subscribe((res: any) => {
// if (res) {
// // tslint:disable-next-line
// user = res
// user.enableEdit = false
// }
// })
}
}
},
Expand Down Expand Up @@ -668,7 +674,8 @@ export class UserCardComponent implements OnInit {
this.comment = ''
setTimeout(() => {
this.openSnackbar('Request approved successfully')
}, 100)
// tslint:disable-next-line
}, 100)
}
// tslint:disable-next-line
this.approvalData = this.approvalData.filter((wf: any) => { wf.userWorkflow.userInfo.wid !== req.userId })
Expand Down Expand Up @@ -701,4 +708,26 @@ export class UserCardComponent implements OnInit {
showedit() {
this.showeditText = true
}

markStatus(status: any, user: any) {
const reqbody = {
request: {
userId: user.userId,
profileDetails: {
profileStatus: status,
},
},
}

this.usersSvc.updateUserDetails(reqbody).subscribe(dres => {
if (dres) {
this.openSnackbar('User status updated Successfully')
this.updateList.emit()
}
},
// tslint:disable-next-line: align
(err: { error: any }) => {
this.openSnackbar(err.error.params.errmsg)
})
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,26 +81,26 @@
<!-- <div *ngIf="activeUsersDataCount > 0"> -->
<ws-widget-user-card [userId]="currentUser" [currentFilter]="currentFilter" [usersData]="activeUsersData"
[totalRecords]="activeUsersDataCount" [tabChangeIndex]="pageIndex" [isApprovals]="false"
(searchByEnterKey)="onEnterkySearch($event)"
(paginationData)="onPaginateChange($event)"></ws-widget-user-card>
(searchByEnterKey)="onEnterkySearch($event)" (paginationData)="onPaginateChange($event)"
(updateList)="getUsers('')"></ws-widget-user-card>
<!-- </div> -->
<!-- <p class="margin-top-l margin-bottom-l" *ngIf="activeUsersDataCount === 0">No users found</p> -->
</ng-container>
<ng-container *ngIf="currentFilter === 'verified'">
<!-- <div *ngIf="verifiedUsersDataCount > 0"> -->
<ws-widget-user-card [userId]="currentUser" [currentFilter]="currentFilter" [usersData]="verifiedUsersData"
[totalRecords]="verifiedUsersDataCount" [tabChangeIndex]="pageIndex"
(searchByEnterKey)="onEnterkySearch($event)"
(paginationData)="onPaginateChange($event)"></ws-widget-user-card>
(searchByEnterKey)="onEnterkySearch($event)" (paginationData)="onPaginateChange($event)"
(updateList)="getVUsers('')"></ws-widget-user-card>
<!-- </div> -->
<!-- <p class="margin-top-l margin-bottom-l" *ngIf="verifiedUsersDataCount === 0">No users found</p> -->
</ng-container>
<ng-container *ngIf="currentFilter === 'nonverified'">
<!-- <div *ngIf="nonverifiedUsersDataCount > 0"> -->
<ws-widget-user-card [userId]="currentUser" [currentFilter]="currentFilter" [usersData]="nonverifiedUsersData"
[totalRecords]="nonverifiedUsersDataCount" [tabChangeIndex]="pageIndex"
(searchByEnterKey)="onEnterkySearch($event)"
(paginationData)="onPaginateChange($event)"></ws-widget-user-card>
(searchByEnterKey)="onEnterkySearch($event)" (paginationData)="onPaginateChange($event)"
(updateList)="getNVUsers('')"></ws-widget-user-card>
<!-- </div> -->
<!-- <p class="margin-top-l margin-bottom-l" *ngIf="nonverifiedUsersDataCount === 0">No users found</p> -->
</ng-container>
Expand Down

0 comments on commit f81c802

Please sign in to comment.