Skip to content

Commit 2c8c7d8

Browse files
Merge pull request #111 from Sohith-code/cbrelease-4.8.20-custom-registration-sohith
fix: roles and access issue
2 parents 917434e + 649a245 commit 2c8c7d8

File tree

8 files changed

+32
-33
lines changed

8 files changed

+32
-33
lines changed

project/ws/app/src/lib/head/info-modal/info-modal.component.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ export class InfoModalComponent {
1010
constructor(public dialogRef: MatDialogRef<InfoModalComponent>, @Inject(MAT_DIALOG_DATA) public data: any) { }
1111

1212
ngOnInit(): void {
13-
console.log('dialog ref', this.data)
14-
1513
}
1614

1715

project/ws/app/src/lib/head/ui-admin-table/user-list/ui-admin-user-table.component.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export class UIAdminUserTableComponent implements OnInit, AfterViewInit, OnChang
6161
isReports = false
6262
reportsPath: any
6363
orgName!: string
64+
subOrgType: string = ''
6465
constructor(
6566
private router: Router, public dialog: MatDialog,
6667
private activatedRoute: ActivatedRoute,
@@ -93,6 +94,8 @@ export class UIAdminUserTableComponent implements OnInit, AfterViewInit, OnChang
9394
this.orgName = params['orgName']
9495
this.departmentId = params['roleId']
9596
this.reportsPath = params['path']
97+
this.subOrgType = params['subOrgType']
98+
9699
if (this.needCreateUser !== false && (this.departmentRole && this.departmentRole !== 'ministry') && this.departmentId) {
97100
this.needAddAdmin = true
98101
this.needCreateUser = true
@@ -258,6 +261,8 @@ export class UIAdminUserTableComponent implements OnInit, AfterViewInit, OnChang
258261
createDept: JSON.stringify(this.otherInput),
259262
orgName: this.orgName,
260263
redirectionPath: window.location.href,
264+
subOrgType: this.subOrgType && this.subOrgType.toLowerCase() === 'ministry' ? 'mdo' : 'state'
265+
261266
},
262267
})
263268
}

project/ws/app/src/lib/routes/access/routes/roles-access/roles-access.component.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,14 @@ export class RolesAccessComponent implements OnInit, AfterViewInit {
3131
this.activatedRoute.queryParams.subscribe(params => {
3232
this.deparmentId = params['roleId']
3333
this.deparmentName = params['depatName']
34-
this.currentDept = params['currentDept']
34+
// this.currentDept = params['currentDept']
35+
this.currentDept = params['subOrgType']
3536
})
3637
if (this.currentDept === 'CBP Providers' || this.currentDept === 'cbp-providers') {
3738
this.currentDept = 'CBP'
3839
}
40+
else if (this.currentDept.toLowerCase() === 'ministry') this.currentDept = 'mdo'
41+
else if (this.currentDept.toLowerCase() === 'state') this.currentDept = 'state'
3942

4043
}
4144

@@ -139,8 +142,8 @@ export class RolesAccessComponent implements OnInit, AfterViewInit {
139142
this.usersService.getAllKongUsers(this.deparmentId).subscribe(data => {
140143
if (data.result.response.content.length > 0) {
141144
this.userWholeData = data.result.response.content || []
142-
this.fetchRoles()
143145
}
146+
this.fetchRoles()
144147
})
145148
}
146149

project/ws/app/src/lib/routes/create-mdo/routes/users/users.component.html

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,6 @@
99
</div>
1010
<div class="flex-display">
1111

12-
<!-- <ws-widget-ui-user-table [hidden]="currentTab==='rolesandaccess'
13-
|| currentTab === 'mentormanage'
14-
|| currentTab === 'grade_setting'
15-
|| currentTab === 'designation_master'" [tableData]="tabledata" [data]="data" [otherInput]="createdDepartment"
16-
[needAddAdmin]="true" [needCreateUser]="true" (actionsClick)="editUser($event)"
17-
(searchByEnterKey)="onEnterkySearch($event)">
18-
</ws-widget-ui-user-table>
19-
20-
<ws-app-roles-access [hidden]="currentTab==='users'
21-
|| currentTab === 'mentormanage'
22-
|| currentTab === 'grade_setting'
23-
|| currentTab === 'designation_master'" (clickedDepartment)="fClickedDepartment($event)">
24-
</ws-app-roles-access>
25-
26-
<ws-app-mentor-manage [hidden]="currentTab==='users'
27-
|| currentTab === 'rolesandaccess'
28-
|| currentTab === 'grade_setting'
29-
|| currentTab === 'designation_master'">
30-
</ws-app-mentor-manage> -->
31-
3212
<ws-widget-ui-user-table *ngIf="currentTab==='users'" [tableData]="tabledata" [data]="data"
3313
[otherInput]="createdDepartment" [needAddAdmin]="true" [needCreateUser]="true" (actionsClick)="editUser($event)"
3414
(searchByEnterKey)="onEnterkySearch($event)">

project/ws/app/src/lib/routes/create-mdo/routes/users/users.component.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export class UsersComponent implements OnInit, AfterViewInit, OnDestroy {
3333
private defaultSideNavBarOpenedSubscription: any
3434
@ViewChild('stickyMenu', { static: true }) menuElement!: ElementRef
3535
goToImportMaster = false
36+
subOrgType: any
3637
@HostListener('window:scroll', ['$event'])
3738
handleScroll() {
3839
const windowScroll = window.pageYOffset
@@ -90,7 +91,8 @@ export class UsersComponent implements OnInit, AfterViewInit, OnDestroy {
9091
this.id = params['roleId']
9192
this.currentDept = params['currentDept']
9293
this.deptName = params['depatName']
93-
this.currentTab = params['tab']
94+
this.currentTab = params['tab'] || 'users'
95+
this.subOrgType = params['subOrgType']
9496

9597
if (this.currentTab.split('/').length > 1 && this.currentTab.split('/')[1] === 'import-designation') {
9698
this.currentTab = 'designation_master'
@@ -274,6 +276,7 @@ export class UsersComponent implements OnInit, AfterViewInit, OnDestroy {
274276
createDept: JSON.stringify({ depName: this.deptName }),
275277
orgName: this.deptName,
276278
redirectionPath: window.location.href,
279+
subOrgType: this.subOrgType && this.subOrgType.toLowerCase() === 'ministry' ? 'mdo' : 'state'
277280
}, state: { userData: event.row, updateButton: true },
278281
})
279282
}

project/ws/app/src/lib/routes/home/routes/create-user/create-user.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
Please enter a valid email ID
6767
</mat-error>
6868
<div *ngIf="emailLengthVal" class="email-error">
69-
Max 64 characters before "@" & 255 characters after "@" are valid.
69+
Max 64 characters before "&#64;" & 255 characters after "&#64;" are valid.
7070
</div>
7171
</mat-form-field>
7272

project/ws/app/src/lib/routes/home/routes/create-user/create-user.component.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ export class CreateUserComponent implements OnInit {
7676
this.queryParam = params['id']
7777
this.deptId = params['id']
7878
this.orgName = params['orgName']
79-
this.currentDept = params['currentDept']
79+
// this.currentDept = params['currentDept']
80+
this.currentDept = params['subOrgType']
8081
this.redirectionPath = params['redirectionPath']
8182
if (this.currentDept === 'CBP Providers' || this.currentDept === 'cbp-providers') {
8283
this.currentDept = 'CBP'
@@ -330,11 +331,11 @@ export class CreateUserComponent implements OnInit {
330331
this.disableCreateButton = false
331332
if (err.error.params.errmsg) {
332333
// this.openSnackbar(`${err.error.params.errmsg}`)
333-
if (err.error.params.errmsg === 'phone already exists') {
334-
this.openSnackbar('Phone number already exists')
335-
} else if (err.error.params.errmsg === 'email already exists') {
334+
if (err.error.params.errmsg.toLowerCase() === 'this phone is already registered with an existing user') {
335+
this.openSnackbar('This Phone is already registered with an existing User')
336+
} else if (err.error.params.errmsg.toLowerCase() === 'email already exists') {
336337
this.openSnackbar('Email Id already exists')
337-
} else if (err.error.params.errmsg === 'Invalid format for given phone.') {
338+
} else if (err.error.params.errmsg.toLowerCase() === 'Invalid format for given phone.') {
338339
this.openSnackbar('Please enter valid phone number')
339340
} else {
340341
this.openSnackbar('User creation error')
@@ -365,7 +366,15 @@ export class CreateUserComponent implements OnInit {
365366

366367
navigateTo() {
367368
if (this.createdDepartment) {
368-
this.router.navigate([`/app/roles/${this.deptId}/users`], { queryParams: { currentDept: this.currentDept, roleId: this.deptId, depatName: this.createdDepartment.depName } })
369+
this.router.navigate([`/app/roles/${this.deptId}/users`],
370+
{
371+
queryParams:
372+
{
373+
currentDept: this.currentDept === 'mdo' || 'state' ? 'organisation' : this.currentDept,
374+
roleId: this.deptId,
375+
depatName: this.createdDepartment.depName
376+
}
377+
})
369378

370379
} else {
371380
this.router.navigate([`/app/home/users`])

project/ws/app/src/lib/routes/home/routes/directory/directroy.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ export class DirectoryViewComponent implements OnInit {
141141
roleId: role.data.id,
142142
depatName: role.data.channel,
143143
orgName: role.data.mdo || role.data.organisation,
144-
tab: role.type
144+
tab: role.type,
145+
subOrgType: role.data.type
145146
}
146147
})
147148
}

0 commit comments

Comments
 (0)