Skip to content

Commit

Permalink
Merge pull request #516 from NandiniAV/cbrelease-4.8.15
Browse files Browse the repository at this point in the history
Cbrelease 4.8.15
  • Loading branch information
vishnubansaltarento authored Jun 12, 2024
2 parents e3af174 + 5578f47 commit 94359ac
Show file tree
Hide file tree
Showing 7 changed files with 184 additions and 74 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@
<button mat-button type="button" class="search-btn" [routerLink]="['/app/home/user-creation']"
[ngClass]="{'disable': isContentLive}">Create user</button>
</div>
<div class="flex flex-end margin-right-s" *ngIf="isApprovals && showApproveALL">
<div class="flex flex-end margin-right-s"
*ngIf="isApprovals && showApproveALL && currentFilter === 'profileverification'">
<button mat-button type="button" class="search-btn" (click)="approveAll()"
[disabled]="disableApproveALL">Approve all requests</button>
</div>
<div class="flex flex-end" *ngIf="isApprovals">
<div class="flex flex-end" *ngIf="isApprovals && currentFilter === 'profileverification'">
<button mat-button type="button" class="search-btn" [routerLink]="['/app/home/approvals/bulkupdate']"
[ngClass]="{'disable': isContentLive}">Bulk profile update</button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

.search-icon {
position: absolute;
top: 16px;
top: 15px;
font-size: 20px;
left: 10px;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
user?.profileDetails?.professionalDetails[0]?.designation ?
user?.profileDetails?.professionalDetails[0]?.designation : '-'}}</div>
<div class="mat-caption ws-mat-black40-text">
Marked on: {{user?.profileDetails?.profileStatusUpdatedOn || ' -'}}</div>
Marked on: {{user?.profileDetails?.profileStatusUpdatedOn || ' NA'}}</div>
<!-- <div class="mat-caption ws-mat-black40-text" *ngIf="!user?.profileDetails?.profileStatusUpdatedOn">-</div> -->
</div>
</div>
Expand All @@ -49,7 +49,7 @@
*ngIf="currentFilter !== 'notmyuser' && !user?.enableEdit">
<mat-icon>edit</mat-icon> Edit
</div>
<div class="button margin-top-m mat-body" (click)="confirmReassign(confirm, user);$event.stopPropagation();"
<div class="button mat-body" (click)="confirmReassign(confirm, user);$event.stopPropagation();"
*ngIf="currentFilter === 'notmyuser'">Reassign</div>
</div>
</mat-expansion-panel-header>
Expand All @@ -62,10 +62,10 @@
<mat-slide-toggle (click)="markStatus('NOT-VERIFIED', user)">Mark this user as
non-verified</mat-slide-toggle>
</p>
<!-- <p class="float-right mat-body-2" *ngIf="user?.profileDetails?.profileStatus === 'NOT-VERIFIED'">
<p class="float-right mat-body-2" *ngIf="user?.profileDetails?.profileStatus === 'NOT-VERIFIED'">
<mat-slide-toggle (click)="markStatus('NOT-MY-USER', user)" [checked]="true">This is my
user</mat-slide-toggle>
</p> -->
</p>
<div class="flex flex-row margin-top-m">
<div class="md:w-1/3">
<label class="margin-remove-bottom form-label required">Group</label>
Expand Down Expand Up @@ -565,14 +565,19 @@
</div>
</mat-expansion-panel-header>

<div class="panel-body">
<div class="panel-body profile-box">
<form [formGroup]="approveUserDataForm" class="margin-top-m">
<!-- <button mat-button class="my-4 mr-4" (click)="addRejection()">add reason</button>
<button mat-button class="my-4 mr-4" (click)="updateRejection()">update reason</button> -->
<div class="inner-body mat-body-2">
<div class="margin-bottom-m">
<span class="font-bold">Primary Details</span> <mat-icon
class="ws-mat-black40-text infoicon">info_outline</mat-icon>
<p class="float-right mat-body-2" *ngIf="currentFilter === 'transfers'">
<mat-slide-toggle #toggleElement (change)="confirmNotMyUser(notmyuserconfirm, appData, $event)"
[checked]="appData.enableToggle">
This is my user</mat-slide-toggle>
</p>
</div>
<div class="flex flex-row margin-top-m">
<ng-container *ngFor="let field of appData.needApprovalList">
Expand Down Expand Up @@ -613,9 +618,9 @@
<mat-radio-group aria-label="Select an option" name="approveDesignation"
formControlName="approveDesignation" class="mat-caption margin-top-s">
<mat-radio-button value="approvedesg" class="margin-right-s"
(click)="onClickHandleWorkflow(field,'APPROVE', appData)">Approve</mat-radio-button>
(click)="onClickHandleWorkflow(field,'APPROVE')">Approve</mat-radio-button>
<mat-radio-button value="rejectdesg"
(click)="onClickHandleWorkflow(field,'REJECT', appData)">Reject</mat-radio-button>
(click)="onClickHandleWorkflow(field,'REJECT')">Reject</mat-radio-button>
<mat-icon class="margin-left-m editreasonicon cursor-pointer"
*ngIf="field.action === 'REJECT' && comment !== ''"
(click)="updateRejection(field)">chat_bubble</mat-icon>
Expand Down Expand Up @@ -747,7 +752,7 @@
</div>

<div class="flex flex-row margin-top-l">
<button mat-raised-button type="submit" (click)="confirmApproval(approvalconfirm, panel)"
<button mat-raised-button type="submit" (click)="confirmApproval(approvalconfirm, panel, appData)"
class="margin-right-m btn-success btn-responsive successbtn"
[disabled]="appData.needApprovalList.length !== actionList.length">
<span class="text-white" i18n>
Expand Down Expand Up @@ -881,4 +886,26 @@
</button>
</div>
</div>
</ng-template>

<ng-template #notmyuserconfirm>
<div class="confirm-dialog text-center padding-l">
<mat-icon class="infoIcon orangeicon-dialog">error_outline</mat-icon>
<div mat-dialog-content i18n class="margin-top-xs blue-text">
Are you sure you want to cancel this transfer request?
</div>
<div mat-dialog-actions class="flex-center margin-top-s">
<button mat-raised-button type="submit" [mat-dialog-close]="false"
class="margin-right-m btn-success btn-responsive cancelbtn">
<span i18n>
No
</span>
</button>
<button mat-raised-button type="submit" [mat-dialog-close]="true" class="btn-success btn-responsive successbtn">
<span class="text-white" i18n>
Yes
</span>
</button>
</div>
</div>
</ng-template>
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, QueryList, TemplateRef, ViewChild, ViewChildren } from '@angular/core'
import {
Component, ElementRef, EventEmitter, Input, OnChanges, OnInit, Output,
QueryList, TemplateRef, ViewChild, ViewChildren,
} from '@angular/core'
import { FormGroup, FormControl, Validators } from '@angular/forms'
import { UsersService } from '../../../users/services/users.service'
import {
Expand Down Expand Up @@ -52,6 +55,9 @@ export class UserCardComponent implements OnInit, OnChanges {
updaterejectDialog!: TemplateRef<any>

@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator | any

@ViewChild('toggleElement', { static: true }) ref!: ElementRef

startIndex = 0
lastIndex = 20
pageSize = 20
Expand Down Expand Up @@ -111,7 +117,8 @@ export class UserCardComponent implements OnInit, OnChanges {
constructor(private usersSvc: UsersService, private roleservice: RolesService,
private dialog: MatDialog, private approvalSvc: ApprovalsService,
private route: ActivatedRoute, private snackBar: MatSnackBar,
private events: EventService, private datePipe: DatePipe) {
private events: EventService,
private datePipe: DatePipe) {
this.updateUserDataForm = new FormGroup({
designation: new FormControl('', []),
group: new FormControl('', [Validators.required]),
Expand Down Expand Up @@ -216,6 +223,9 @@ export class UserCardComponent implements OnInit, OnChanges {
this.usersSvc.getUserById(id).subscribe((res: any) => {
if (res) {
data.user = res
if (this.currentFilter === 'transfers') {
data.enableToggle = res.profileDetails.profileStatus !== 'NOT-MY-USER' ? true : false
}

if (data.user) {
if (data.needApprovalList && data.needApprovalList.length === 1) {
Expand Down Expand Up @@ -698,7 +708,7 @@ export class UserCardComponent implements OnInit, OnChanges {
}
/* tslint:disable */
// for approval & rejection
onClickHandleWorkflow(field: any, action: string, appData: any = undefined) {
onClickHandleWorkflow(field: any, action: string) {
field.action = action
const req = {
action,
Expand Down Expand Up @@ -754,20 +764,21 @@ export class UserCardComponent implements OnInit, OnChanges {
}
)

if (this.currentFilter === 'transfers' && appData !== undefined) {
appData.needApprovalList.forEach((otherField: any) => {
if (otherField.label !== field.label) {
this.onClickHandleWorkflow(field, action)
}
})
if (field.label === 'Group') {
const designationValue = action === 'APPROVE' ? 'approvedesg' : 'rejectdesg'
this.approveUserDataForm.controls.approveDesignation.setValue(designationValue)
} else {
const groupValue = action === 'APPROVE' ? 'approvegroup' : 'rejectgroup'
this.approveUserDataForm.controls.approveGroup.setValue(groupValue)
}
}
// if (this.currentFilter === 'transfers' && appData !== undefined) {
// appData.needApprovalList.forEach((otherField: any) => {
// if (otherField.label !== field.label) {
// console.log('field', field)
// this.onClickHandleWorkflow(field, action)
// }
// })
// if (field.label === 'Group') {
// const designationValue = action === 'APPROVE' ? 'approvedesg' : 'rejectdesg'
// this.approveUserDataForm.controls.approveDesignation.setValue(designationValue)
// } else {
// const groupValue = action === 'APPROVE' ? 'approvegroup' : 'rejectgroup'
// this.approveUserDataForm.controls.approveGroup.setValue(groupValue)
// }
// }
}
/* tslint:enable */
// single aprrove or reject
Expand All @@ -779,32 +790,82 @@ export class UserCardComponent implements OnInit, OnChanges {
})
}

onApprovalSubmit(panel: any) {
onApprovalSubmit(panel: any, appData: any) {
if (this.actionList.length > 0) {
const datalength = this.actionList.length
this.actionList.forEach((req: any, index: any) => {
if (req.action === 'APPROVE') {
req.comment = ''
}
this.onApproveOrRejectClick(req)
if (index === datalength - 1) {
panel.close()
this.comment = ''
setTimeout(() => {
this.openSnackbar('Request approved successfully')
this.updateList.emit()
// tslint:disable-next-line
}, 100)
}
// tslint:disable-next-line
// this.approvalData = this.approvalData.filter((wf: any) => { wf.userWorkflow.userInfo.wid !== req.userId })
if (this.approvalData.length === 0) {
this.disableButton.emit()
}
})
if (this.currentFilter === 'transfers') {
this.onTransferSubmit(panel, appData)
} else {
const datalength = this.actionList.length
this.actionList.forEach((req: any, index: any) => {
if (req.action === 'APPROVE') {
req.comment = ''
}
this.onApproveOrRejectClick(req)
if (index === datalength - 1) {
panel.close()
this.comment = ''
setTimeout(() => {
this.openSnackbar('Request approved successfully')
this.updateList.emit()
// tslint:disable-next-line
}, 100)
}
// tslint:disable-next-line
// this.approvalData = this.approvalData.filter((wf: any) => { wf.userWorkflow.userInfo.wid !== req.userId })
if (this.approvalData.length === 0) {
this.disableButton.emit()
}
})
}
}
}

onTransferSubmit(panel: any, appData: any) {
let orgReq = {}
appData.userWorkflow.wfInfo.forEach((wf: any) => {
const fields = JSON.parse(wf.updateFieldValues)
if (fields.length > 0) {
fields.forEach((field: any) => {
const labelKey = Object.keys(field.toValue)[0]
if (labelKey === 'name') {
orgReq = {
action: 'APPROVE',
actorUserId: wf.actorUUID,
applicationId: wf.applicationId,
serviceName: wf.serviceName,
state: 'SEND_FOR_APPROVAL',
updateFieldValues: fields,
userId: wf.userId,
wfId: wf.wfId,
}
}
})
}
})

this.actionList.push(orgReq)
const datalength = this.actionList.length
this.actionList.forEach((req: any, index: any) => {
if (req.action === 'APPROVE') {
req.comment = ''
}
this.onApproveOrRejectClick(req)
if (index === datalength - 1) {
panel.close()
this.comment = ''
setTimeout(() => {
this.openSnackbar('Request approved successfully')
this.updateList.emit()
// tslint:disable-next-line
}, 100)
}
if (this.approvalData.length === 0) {
this.disableButton.emit()
}
})

}

updateRejection(field: any) {
this.comment = field.comment
const dialogRef = this.dialog.open(this.updaterejectDialog, {
Expand Down Expand Up @@ -862,6 +923,22 @@ export class UserCardComponent implements OnInit, OnChanges {
})
}

confirmNotMyUser(template: any, data: any, event: any) {
data.enableToggle = true
const dialog = this.dialog.open(template, {
width: '500px',
})
dialog.afterClosed().subscribe((v: any) => {
if (v) {
this.markStatus('NOT-MY-USER', data.user)
data.enableToggle = false
} else {
event.source.checked = true
data.enableToggle = true
}
})
}

confirmUpdate(template: any, updateUserDataForm: any, user: any, panel: any) {
const dialog = this.dialog.open(template, {
width: '500px',
Expand All @@ -875,13 +952,13 @@ export class UserCardComponent implements OnInit, OnChanges {
})
}

confirmApproval(template: any, panel: any) {
confirmApproval(template: any, panel: any, appData: any) {
const dialog = this.dialog.open(template, {
width: '500px',
})
dialog.afterClosed().subscribe((v: any) => {
if (v) {
this.onApprovalSubmit(panel)
this.onApprovalSubmit(panel, appData)
} else {
panel.close()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@
<div class="flex flex-1 flex-column margin-fix">
<div class="flex flex-1 filter max-height-60">
<a routerLink="/app/home/approvals/profileverification" class="filter-option"
[ngClass]="{'ws-mat-accent-border-active' : currentFilter === 'profileverification', 'ws-mat-accent-border font-medium':currentFilter !== 'profileverification'}"
[ngClass]="{'ws-mat-accent-border-active' : currentFilter === 'profileverification', 'ws-mat-accent-border font-medium': currentFilter !== 'profileverification'}"
mat-button (click)="filter('profileverification'); tabTelemetry('toapprove', 0)" role="button">Profile
Verifications ({{profileVerificationCount}})</a>

<!-- <a routerLink="/app/home/approvals/transfers" class="filter-option"
[ngClass]="{'ws-mat-accent-border-active' : currentFilter === 'transfers', 'ws-mat-accent-border font-medium':currentFilter !== 'transfers'}"
<a routerLink="/app/home/approvals/transfers" class="filter-option"
[ngClass]="{'ws-mat-accent-border-active' : currentFilter === 'transfers', 'ws-mat-accent-border font-medium': currentFilter !== 'transfers'}"
mat-button (click)="filter('transfers'); tabTelemetry('transfers', 1)" role="button">Transfers
({{transfersCount}})</a> -->
({{transfersCount}})</a>
</div>
</div>
<ng-container *ngIf="currentFilter === 'profileverification'">
Expand All @@ -61,10 +61,15 @@
</ng-container>
<ng-container *ngIf="currentFilter === 'transfers'">
<!-- <ws-app-profle-approval-bulk-upload></ws-app-profle-approval-bulk-upload> -->
<div class="searchfilter">
<ws-app-searchuser (handleApiData)="onSearch($event)" [isApprovals]="true" (handleapproveAll)="onApproveALL()"
[showApproveALL]="false"></ws-app-searchuser>
</div>
<ng-container *ngIf="transfersData && transfersData.length > 0">
<ws-widget-user-card [currentFilter]="currentFilter" [usersData]="transfersData" [isApprovals]="true"
[totalRecords]="transfersCount" [tabChangeIndex]="pageIndex" (searchByEnterKey)="onEnterkySearch($event)"
(disableButton)="showButton()" (paginationData)="onPaginateChange($event)"></ws-widget-user-card>
(disableButton)="showButton()" (paginationData)="onPaginateChange($event)"
(updateList)="fetchApprovals()"></ws-widget-user-card>
</ng-container>
<ng-container *ngIf="!transfersData || transfersData.length === 0">
<p class="margin-top-xl margin-bottom-xl">No approvals</p>
Expand Down
Loading

0 comments on commit 94359ac

Please sign in to comment.