Skip to content

Commit

Permalink
# (#816)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajithmuthukumar-bc authored Oct 19, 2022
1 parent b8b2356 commit b59e42b
Show file tree
Hide file tree
Showing 2 changed files with 126 additions and 116 deletions.
42 changes: 21 additions & 21 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -593,27 +593,27 @@ const routes: Routes = [
canActivate: [AuthGuard, RoleGuard],
component: ManageUserAddSelectionComponent,
},
{
path: 'manage-users/bulk-users',
data: { title: 'Bulk Upload - Manage Users', roles: ['MANAGE_USERS'] },
pathMatch: 'full',
canActivate: [AuthGuard, RoleGuard],
component: ManageUserBulkUploadComponent,
},
{
path: 'manage-users/bulk-users/status/:id',
data: { title: 'Bulk Upload - Manage Users', roles: ['MANAGE_USERS'] },
pathMatch: 'full',
canActivate: [AuthGuard, RoleGuard],
component: ManageUserBulkUploadStatusComponent,
},
{
path: 'manage-users/bulk-users/migration-status/:id',
data: { title: 'Bulk Upload - Manage Users', roles: ['MANAGE_USERS'] },
pathMatch: 'full',
canActivate: [AuthGuard, RoleGuard],
component: ManageUserBulkUploadMigrationStatusComponent,
},
// {
// path: 'manage-users/bulk-users',
// data: { title: 'Bulk Upload - Manage Users', roles: ['MANAGE_USERS'] },
// pathMatch: 'full',
// canActivate: [AuthGuard, RoleGuard],
// component: ManageUserBulkUploadComponent,
// },
// {
// path: 'manage-users/bulk-users/status/:id',
// data: { title: 'Bulk Upload - Manage Users', roles: ['MANAGE_USERS'] },
// pathMatch: 'full',
// canActivate: [AuthGuard, RoleGuard],
// component: ManageUserBulkUploadStatusComponent,
// },
// {
// path: 'manage-users/bulk-users/migration-status/:id',
// data: { title: 'Bulk Upload - Manage Users', roles: ['MANAGE_USERS'] },
// pathMatch: 'full',
// canActivate: [AuthGuard, RoleGuard],
// component: ManageUserBulkUploadMigrationStatusComponent,
// },
{
path: 'manage-users/add-user/details',
data: { title: 'Add/Edit - Manage Users', roles: ['MANAGE_USERS'] },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,107 +1,117 @@
import { Component } from "@angular/core";
import { OnInit } from "@angular/core";
import { Store } from "@ngrx/store";
import { Component } from '@angular/core';
import { OnInit } from '@angular/core';
import { Store } from '@ngrx/store';
import { ViewportScroller } from '@angular/common';
import { BaseComponent } from "src/app/components/base/base.component";
import { UIState } from "src/app/store/ui.states";
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
import { slideAnimation } from "src/app/animations/slide.animation";
import { User, UserGroup, UserListInfo, UserListResponse, UserProfileRequestInfo } from "src/app/models/user";
import { WrapperUserService } from "src/app/services/wrapper/wrapper-user.service";
import { WrapperUserContactService } from "src/app/services/wrapper/wrapper-user-contact.service";
import { ContactPoint, UserContactInfoList } from "src/app/models/contactInfo";
import { Router } from "@angular/router";
import { OperationEnum } from "src/app/constants/enum";
import { ScrollHelper } from "src/app/services/helper/scroll-helper.services";
import { WrapperOrganisationService } from "src/app/services/wrapper/wrapper-org-service";
import { environment } from "src/environments/environment";
import { AuditLoggerService } from "src/app/services/postgres/logger.service";
import { SessionStorageKey } from "src/app/constants/constant";
import { BaseComponent } from 'src/app/components/base/base.component';
import { UIState } from 'src/app/store/ui.states';
import { slideAnimation } from 'src/app/animations/slide.animation';
import {UserListInfo,UserListResponse} from 'src/app/models/user';
import { Router } from '@angular/router';
import { ScrollHelper } from 'src/app/services/helper/scroll-helper.services';
import { WrapperOrganisationService } from 'src/app/services/wrapper/wrapper-org-service';
import { environment } from 'src/environments/environment';
import { AuditLoggerService } from 'src/app/services/postgres/logger.service';
import { SessionStorageKey } from 'src/app/constants/constant';

@Component({
selector: 'app-manage-user-profiles',
templateUrl: './manage-user-profiles-component.html',
styleUrls: ['./manage-user-profiles-component.scss'],
animations: [
slideAnimation({
close: { 'transform': 'translateX(12.5rem)' },
open: { left: '-12.5rem' }
})
]
selector: 'app-manage-user-profiles',
templateUrl: './manage-user-profiles-component.html',
styleUrls: ['./manage-user-profiles-component.scss'],
animations: [
slideAnimation({
close: { transform: 'translateX(12.5rem)' },
open: { left: '-12.5rem' },
}),
],
})

export class ManageUserProfilesComponent extends BaseComponent implements OnInit {
userList: UserListResponse;
organisationId: string;
searchingUserName: string = "";
currentPage: number = 1;
pageCount: number = 0;
pageSize: number = environment.listPageSize;
usersTableHeaders = ['NAME', 'EMAIL'];
usersColumnsToDisplay = ['name', 'userName'];
searchSumbited:boolean=false;
constructor(private wrapperOrganisationService: WrapperOrganisationService,
protected uiStore: Store<UIState>, private router: Router, protected viewportScroller: ViewportScroller, protected scrollHelper: ScrollHelper,
private auditLogService: AuditLoggerService) {
super(uiStore, viewportScroller, scrollHelper);
this.organisationId = localStorage.getItem('cii_organisation_id') || '';
this.userList = {
currentPage: this.currentPage,
pageCount: 0,
rowCount: 0,
organisationId: this.organisationId,
userList: []
}
sessionStorage.removeItem(SessionStorageKey.ManageUserUserName);
sessionStorage.removeItem(SessionStorageKey.OperationSuccessUserName);
}
public userList: UserListResponse;
private organisationId: string;
public searchingUserName: string = '';
public currentPage: number = 1;
public pageCount: number = 0;
public pageSize: number = environment.listPageSize;
public usersTableHeaders = ['NAME', 'EMAIL'];
public usersColumnsToDisplay = ['name', 'userName'];
public searchSumbited: boolean = false;

constructor(
private wrapperOrganisationService: WrapperOrganisationService,
protected uiStore: Store<UIState>,
private router: Router,
protected viewportScroller: ViewportScroller,
protected scrollHelper: ScrollHelper,
private auditLogService: AuditLoggerService
) {
super(uiStore, viewportScroller, scrollHelper);
this.organisationId = localStorage.getItem('cii_organisation_id') || '';
this.userList = {
currentPage: this.currentPage,
pageCount: 0,
rowCount: 0,
organisationId: this.organisationId,
userList: [],
};
sessionStorage.removeItem(SessionStorageKey.ManageUserUserName);
sessionStorage.removeItem(SessionStorageKey.OperationSuccessUserName);
}

async ngOnInit() {
await this.auditLogService.createLog({
eventName: "Access", applicationName: "Manage-user-account",
referenceData: `UI-Log`
}).toPromise();
this.getOrganisationUsers();
}
async ngOnInit() {
await this.auditLogService
.createLog({
eventName: 'Access',
applicationName: 'Manage-user-account',
referenceData: `UI-Log`,
})
.toPromise();
this.getOrganisationUsers();
}

getOrganisationUsers() {
this.wrapperOrganisationService.getUsers(this.organisationId, this.searchingUserName, this.currentPage, this.pageSize).subscribe({
next: (userListResponse: UserListResponse) => {
if (userListResponse != null) {
this.userList = userListResponse;
this.pageCount = this.userList.pageCount;
}
},
error: (error: any) => {
}
});
}
private getOrganisationUsers(): void {
this.wrapperOrganisationService.getUsers(this.organisationId,this.searchingUserName,this.currentPage,this.pageSize)
.subscribe({
next: (userListResponse: UserListResponse) => {
if (userListResponse != null) {
this.userList = userListResponse;
this.pageCount = this.userList.pageCount;
}
},
error: (error: any) => {},
});
}

onAddClick() {
this.router.navigateByUrl("manage-users/add-user-selection");
}
public onAddClick(): void {
this.router.navigateByUrl('manage-users/add-user/details');
}

searchTextChanged(event: any) {
this.searchingUserName = event.target.value;
}
private searchTextChanged(event: any) {
this.searchingUserName = event.target.value;
}

onSearchClick() {
this.searchSumbited=true
this.currentPage = 1;
this.getOrganisationUsers();
}
public onSearchClick(): void {
this.searchSumbited = true;
this.currentPage = 1;
this.getOrganisationUsers();
}

setPage(pageNumber: any) {
this.currentPage = pageNumber;
this.getOrganisationUsers();
}
public setPage(pageNumber: any): void {
this.currentPage = pageNumber;
this.getOrganisationUsers();
}

onEditRow(dataRow: UserListInfo) {
console.log(dataRow);
let data = {
'isEdit': true,
'rowData':dataRow.userName
};
sessionStorage.setItem(SessionStorageKey.ManageUserUserName, dataRow.userName);
this.router.navigateByUrl('manage-users/add-user/details?data=' + btoa(JSON.stringify(data)));
}
}
public onEditRow(dataRow: UserListInfo): void {
console.log(dataRow);
let data = {
isEdit: true,
rowData: dataRow.userName,
};
sessionStorage.setItem(
SessionStorageKey.ManageUserUserName,
dataRow.userName
);
this.router.navigateByUrl(
'manage-users/add-user/details?data=' + btoa(JSON.stringify(data))
);
}
}

0 comments on commit b59e42b

Please sign in to comment.