Skip to content

Commit

Permalink
Merge pull request #111 from Sohith-code/cbrelease-4.8.20-custom-regi…
Browse files Browse the repository at this point in the history
…stration-sohith

fix: roles and access issue
  • Loading branch information
vishnubansaltarento authored Dec 2, 2024
2 parents 917434e + 649a245 commit 2c8c7d8
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ export class InfoModalComponent {
constructor(public dialogRef: MatDialogRef<InfoModalComponent>, @Inject(MAT_DIALOG_DATA) public data: any) { }

ngOnInit(): void {
console.log('dialog ref', this.data)

}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export class UIAdminUserTableComponent implements OnInit, AfterViewInit, OnChang
isReports = false
reportsPath: any
orgName!: string
subOrgType: string = ''
constructor(
private router: Router, public dialog: MatDialog,
private activatedRoute: ActivatedRoute,
Expand Down Expand Up @@ -93,6 +94,8 @@ export class UIAdminUserTableComponent implements OnInit, AfterViewInit, OnChang
this.orgName = params['orgName']
this.departmentId = params['roleId']
this.reportsPath = params['path']
this.subOrgType = params['subOrgType']

if (this.needCreateUser !== false && (this.departmentRole && this.departmentRole !== 'ministry') && this.departmentId) {
this.needAddAdmin = true
this.needCreateUser = true
Expand Down Expand Up @@ -258,6 +261,8 @@ export class UIAdminUserTableComponent implements OnInit, AfterViewInit, OnChang
createDept: JSON.stringify(this.otherInput),
orgName: this.orgName,
redirectionPath: window.location.href,
subOrgType: this.subOrgType && this.subOrgType.toLowerCase() === 'ministry' ? 'mdo' : 'state'

},
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,14 @@ export class RolesAccessComponent implements OnInit, AfterViewInit {
this.activatedRoute.queryParams.subscribe(params => {
this.deparmentId = params['roleId']
this.deparmentName = params['depatName']
this.currentDept = params['currentDept']
// this.currentDept = params['currentDept']
this.currentDept = params['subOrgType']
})
if (this.currentDept === 'CBP Providers' || this.currentDept === 'cbp-providers') {
this.currentDept = 'CBP'
}
else if (this.currentDept.toLowerCase() === 'ministry') this.currentDept = 'mdo'
else if (this.currentDept.toLowerCase() === 'state') this.currentDept = 'state'

}

Expand Down Expand Up @@ -139,8 +142,8 @@ export class RolesAccessComponent implements OnInit, AfterViewInit {
this.usersService.getAllKongUsers(this.deparmentId).subscribe(data => {
if (data.result.response.content.length > 0) {
this.userWholeData = data.result.response.content || []
this.fetchRoles()
}
this.fetchRoles()
})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,6 @@
</div>
<div class="flex-display">

<!-- <ws-widget-ui-user-table [hidden]="currentTab==='rolesandaccess'
|| currentTab === 'mentormanage'
|| currentTab === 'grade_setting'
|| currentTab === 'designation_master'" [tableData]="tabledata" [data]="data" [otherInput]="createdDepartment"
[needAddAdmin]="true" [needCreateUser]="true" (actionsClick)="editUser($event)"
(searchByEnterKey)="onEnterkySearch($event)">
</ws-widget-ui-user-table>
<ws-app-roles-access [hidden]="currentTab==='users'
|| currentTab === 'mentormanage'
|| currentTab === 'grade_setting'
|| currentTab === 'designation_master'" (clickedDepartment)="fClickedDepartment($event)">
</ws-app-roles-access>
<ws-app-mentor-manage [hidden]="currentTab==='users'
|| currentTab === 'rolesandaccess'
|| currentTab === 'grade_setting'
|| currentTab === 'designation_master'">
</ws-app-mentor-manage> -->

<ws-widget-ui-user-table *ngIf="currentTab==='users'" [tableData]="tabledata" [data]="data"
[otherInput]="createdDepartment" [needAddAdmin]="true" [needCreateUser]="true" (actionsClick)="editUser($event)"
(searchByEnterKey)="onEnterkySearch($event)">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export class UsersComponent implements OnInit, AfterViewInit, OnDestroy {
private defaultSideNavBarOpenedSubscription: any
@ViewChild('stickyMenu', { static: true }) menuElement!: ElementRef
goToImportMaster = false
subOrgType: any
@HostListener('window:scroll', ['$event'])
handleScroll() {
const windowScroll = window.pageYOffset
Expand Down Expand Up @@ -90,7 +91,8 @@ export class UsersComponent implements OnInit, AfterViewInit, OnDestroy {
this.id = params['roleId']
this.currentDept = params['currentDept']
this.deptName = params['depatName']
this.currentTab = params['tab']
this.currentTab = params['tab'] || 'users'
this.subOrgType = params['subOrgType']

if (this.currentTab.split('/').length > 1 && this.currentTab.split('/')[1] === 'import-designation') {
this.currentTab = 'designation_master'
Expand Down Expand Up @@ -274,6 +276,7 @@ export class UsersComponent implements OnInit, AfterViewInit, OnDestroy {
createDept: JSON.stringify({ depName: this.deptName }),
orgName: this.deptName,
redirectionPath: window.location.href,
subOrgType: this.subOrgType && this.subOrgType.toLowerCase() === 'ministry' ? 'mdo' : 'state'
}, state: { userData: event.row, updateButton: true },
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
Please enter a valid email ID
</mat-error>
<div *ngIf="emailLengthVal" class="email-error">
Max 64 characters before "@" & 255 characters after "@" are valid.
Max 64 characters before "&#64;" & 255 characters after "&#64;" are valid.
</div>
</mat-form-field>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ export class CreateUserComponent implements OnInit {
this.queryParam = params['id']
this.deptId = params['id']
this.orgName = params['orgName']
this.currentDept = params['currentDept']
// this.currentDept = params['currentDept']
this.currentDept = params['subOrgType']
this.redirectionPath = params['redirectionPath']
if (this.currentDept === 'CBP Providers' || this.currentDept === 'cbp-providers') {
this.currentDept = 'CBP'
Expand Down Expand Up @@ -330,11 +331,11 @@ export class CreateUserComponent implements OnInit {
this.disableCreateButton = false
if (err.error.params.errmsg) {
// this.openSnackbar(`${err.error.params.errmsg}`)
if (err.error.params.errmsg === 'phone already exists') {
this.openSnackbar('Phone number already exists')
} else if (err.error.params.errmsg === 'email already exists') {
if (err.error.params.errmsg.toLowerCase() === 'this phone is already registered with an existing user') {
this.openSnackbar('This Phone is already registered with an existing User')
} else if (err.error.params.errmsg.toLowerCase() === 'email already exists') {
this.openSnackbar('Email Id already exists')
} else if (err.error.params.errmsg === 'Invalid format for given phone.') {
} else if (err.error.params.errmsg.toLowerCase() === 'Invalid format for given phone.') {
this.openSnackbar('Please enter valid phone number')
} else {
this.openSnackbar('User creation error')
Expand Down Expand Up @@ -365,7 +366,15 @@ export class CreateUserComponent implements OnInit {

navigateTo() {
if (this.createdDepartment) {
this.router.navigate([`/app/roles/${this.deptId}/users`], { queryParams: { currentDept: this.currentDept, roleId: this.deptId, depatName: this.createdDepartment.depName } })
this.router.navigate([`/app/roles/${this.deptId}/users`],
{
queryParams:
{
currentDept: this.currentDept === 'mdo' || 'state' ? 'organisation' : this.currentDept,
roleId: this.deptId,
depatName: this.createdDepartment.depName
}
})

} else {
this.router.navigate([`/app/home/users`])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ export class DirectoryViewComponent implements OnInit {
roleId: role.data.id,
depatName: role.data.channel,
orgName: role.data.mdo || role.data.organisation,
tab: role.type
tab: role.type,
subOrgType: role.data.type
}
})
}
Expand Down

0 comments on commit 2c8c7d8

Please sign in to comment.