list chenges based on role
This commit is contained in:
parent
6a508f2d2d
commit
70d1bf5712
@ -120,83 +120,16 @@
|
||||
</div>
|
||||
|
||||
<div fxFlex.sm="100" fxFlex.xs="100" fxFlex.md="33.33" fxFlex.lg="33.33" fxFlex.xl="33.33" fxFlex="100">
|
||||
<div class="menu-links">
|
||||
<span *ngFor="let menuitem of currentUser.short_name == 'MWISE' ? horizontalMenuItems.salesgetAll() : horizontalMenuItems.getAll() | roleMenuItems:'1'">
|
||||
<button mat-icon-button matTooltip="{{ menuitem.name}}" matTooltipPosition="below" [routerLink]="['/'+menuitem.state]" *ngIf="menuitem.type === 'link'">
|
||||
<div class="menu-links"*ngIf="status == false">
|
||||
|
||||
<span *ngFor="let menuitem of currentUser.short_name == 'MWISE' ? horizontalMenuItems.salesgetAll() : horizontalMenuItems.getAll() | roleMenuItems:'1'">
|
||||
<button mat-icon-button matTooltip="{{ menuitem.name}}" matTooltipPosition="below" [routerLink]="['/'+menuitem.state]" *ngIf="menuitem.type === 'link'">
|
||||
<mat-icon>{{ menuitem.icon }}</mat-icon>
|
||||
<!--<span>{{ menuitem.name | translate }}</span>-->
|
||||
</button>
|
||||
</span>
|
||||
<!-- <span *ngFor="let menuitem of horizontalMenuItems.getAll()">
|
||||
<span *ngIf="menuitem.type === 'multi'">
|
||||
<button [mat-menu-trigger-for]="multi" matTooltip="{{ menuitem.name}}" matTooltipPosition="below" mat-icon-button class="ml-xs" *ngIf="userRoleType=='10'">
|
||||
<mat-icon>{{ menuitem.icon }}</mat-icon>
|
||||
</button>
|
||||
<mat-menu #multi="matMenu" class="opt-menu" x-position="before">
|
||||
<div mat-menu-item class="head-menu grad-blue">
|
||||
{{ menuitem.name}}
|
||||
</div>
|
||||
<div class="dropdown">
|
||||
<div *ngFor="let childitem of menuitem.children">
|
||||
<button mat-menu-item [routerLink]="['/'+childitem.state ]">{{ childitem.name | translate }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</mat-menu>
|
||||
</span>
|
||||
</span> -->
|
||||
<!-- <button appToggleFullscreen matTooltip="Fullscreen" matTooltipPosition="below" mat-icon-button>
|
||||
<mat-icon>fullscreen</mat-icon>
|
||||
</button> -->
|
||||
<!--<button [mat-menu-trigger-for]="user2" mat-icon-button class="ml-xs overflow-visible">
|
||||
<mat-icon>message</mat-icon>
|
||||
</button>
|
||||
<mat-menu #user2="matMenu" class="opt-menu" x-position="after">
|
||||
<div mat-menu-item class="head-menu grad-blue">
|
||||
Message Menu
|
||||
</div>
|
||||
<button mat-menu-item>
|
||||
<img width="40" src="assets/images/user-1.jpg" alt="">
|
||||
Next Update for angular 5
|
||||
</button>
|
||||
<button mat-menu-item>
|
||||
<img width="40" src="assets/images/user-2.jpg" alt="">
|
||||
Check out our new admin theme
|
||||
</button>
|
||||
<button mat-menu-item>
|
||||
<img width="40" src="assets/images/user-3.jpg" alt="">
|
||||
Expedita quo, laboriosam officia.
|
||||
</button>
|
||||
<button mat-menu-item>
|
||||
<img width="40" src="assets/images/user-4.jpg" alt="">
|
||||
Lorem ipsum dolor sit amet consectetur.
|
||||
</button>
|
||||
</mat-menu>
|
||||
<button [mat-menu-trigger-for]="user1" mat-icon-button class="ml-xs overflow-visible">
|
||||
<mat-icon>reorder</mat-icon>
|
||||
<span class="notification-label">3</span>
|
||||
</button> -->
|
||||
<!-- <mat-menu #user1="matMenu" class="opt-menu" x-position="before">
|
||||
<div mat-menu-item class="head-menu grad-blue">
|
||||
User Menu
|
||||
</div>
|
||||
<button mat-menu-item>
|
||||
<mat-icon>show_chart</mat-icon>
|
||||
Charts
|
||||
</button>
|
||||
<button mat-menu-item>
|
||||
<mat-icon>navigation</mat-icon>
|
||||
Maps
|
||||
</button>
|
||||
<button mat-menu-item>
|
||||
<mat-icon>web</mat-icon>
|
||||
Calendar Settings
|
||||
</button>
|
||||
</mat-menu> -->
|
||||
<!-- <button (click)="end.toggle()" matTooltip="Notifications" matTooltipPosition="below" mat-icon-button class="ml-xs overflow-visible">
|
||||
<mat-icon>notifications</mat-icon> -->
|
||||
<!-- <span class="notification-label">2</span> -->
|
||||
<!-- <span *ngIf="alertCount != 0" style = "width:23px" class="notification-label" >{{alertCount}}</span>
|
||||
</button> -->
|
||||
|
||||
|
||||
<button [mat-menu-trigger-for]="user" mat-icon-button class="ml-xs">
|
||||
<mat-icon>person</mat-icon>
|
||||
</button>
|
||||
@ -206,22 +139,43 @@
|
||||
</div>
|
||||
<button mat-menu-item>
|
||||
<mat-icon>settings</mat-icon>
|
||||
Setting
|
||||
Settings
|
||||
</button>
|
||||
<button mat-menu-item (click)="userprofile()">
|
||||
<mat-icon>account_box</mat-icon>
|
||||
Profile
|
||||
</button>
|
||||
<!-- <button mat-menu-item>
|
||||
<mat-icon>notifications_off</mat-icon>
|
||||
Disable notifications
|
||||
</button> -->
|
||||
|
||||
<button mat-menu-item (click)="logout()">
|
||||
<mat-icon>exit_to_app</mat-icon>
|
||||
Sign Out
|
||||
</button>
|
||||
</mat-menu>
|
||||
</div>
|
||||
|
||||
<div class="menu-links" *ngIf="status ==true">
|
||||
<button [mat-menu-trigger-for]="user" mat-icon-button class="ml-xs">
|
||||
<mat-icon>person</mat-icon>
|
||||
</button>
|
||||
<mat-menu #user="matMenu" class="opt-menu" x-position="before">
|
||||
<div mat-menu-item class="head-menu grad-blue">
|
||||
Settings
|
||||
</div>
|
||||
<button mat-menu-item>
|
||||
<mat-icon>settings</mat-icon>
|
||||
Setting
|
||||
</button>
|
||||
<button mat-menu-item (click)="userprofile()">
|
||||
<mat-icon>account_box</mat-icon>
|
||||
Profile
|
||||
</button>
|
||||
|
||||
<button mat-menu-item (click)="logout()">
|
||||
<mat-icon>exit_to_app</mat-icon>
|
||||
Sign Out
|
||||
</button>
|
||||
</mat-menu>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="vertical-menu w-100">
|
||||
|
||||
@ -54,6 +54,8 @@ export class AdminLayoutComponent implements OnInit, OnDestroy {
|
||||
alertMsgAllocateType : any[];
|
||||
alertCount: any;
|
||||
userRoleType: String;
|
||||
userrole: any;
|
||||
status: boolean;
|
||||
constructor(private router: Router, public menuItems: MenuItems, public horizontalMenuItems : HorizontalMenuItems, public translate: TranslateService,public aws:AwsService,public users:UserService,private _dashboardService: DashboardService) {
|
||||
const browserLang: string = translate.getBrowserLang();
|
||||
translate.use(browserLang.match(/en|fr/) ? browserLang : 'en');
|
||||
@ -71,6 +73,19 @@ export class AdminLayoutComponent implements OnInit, OnDestroy {
|
||||
console.log('this.currentUser',this.currentUser);
|
||||
console.log(this.currentUser.userid);
|
||||
localStorage.setItem('len_user_role_id',this.currentUser.user_role);
|
||||
this.userrole=this.currentUser.user_role;
|
||||
if(this.userrole=='11')
|
||||
{
|
||||
this.status=true;
|
||||
}
|
||||
else if(this.userrole=='12')
|
||||
{
|
||||
this.status=true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.status=false;
|
||||
}
|
||||
localStorage.setItem('userid',this.currentUser.userid);
|
||||
localStorage.setItem('smc_agency_id',this.currentUser.smc_agency_id);
|
||||
window.localStorage.setItem('LenderRoleID', this.currentUser.user_role);
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<div *ngIf="role!='11'">
|
||||
|
||||
<mat-card-content style="padding: 0;">
|
||||
<mat-expansion-panel [(expanded)]="xpandStatus">
|
||||
<mat-expansion-panel-header>
|
||||
@ -280,8 +280,3 @@
|
||||
color: brown;">Showing data for last {{common}}. To see older records, please use advanced filter</h5>
|
||||
</mat-card-content>
|
||||
<notifier-container></notifier-container>
|
||||
</div>
|
||||
<div *ngIf="role=='11'">
|
||||
<p>data</p>
|
||||
|
||||
</div>
|
||||
@ -176,41 +176,8 @@ console.log(this.displayedColumns)
|
||||
// load inprogress pd list
|
||||
public LenderRoleID : string = localStorage.getItem('LenderRoleID');
|
||||
loadPDDetails() {
|
||||
const role=localStorage.getItem('len_user_role_id');
|
||||
alert(role);
|
||||
if(role=='11')
|
||||
{
|
||||
alert('if');
|
||||
this._pd.getSalesPd()
|
||||
.subscribe(
|
||||
data => {
|
||||
this.loaderService.closeMatSpinnerDialog();
|
||||
if (data.status == 200) {
|
||||
this.PdListData = data.records;
|
||||
console.log('pddataabi');
|
||||
console.log(this.PdListData);
|
||||
// this.PdListData = <GetOrInitializeYourListHere>;
|
||||
if(this.startIndex && this.endIndex) {
|
||||
this.pagedList.next(this.PdListData.slice(this.startIndex, this.endIndex));
|
||||
}
|
||||
else {
|
||||
this.pagedList.next(this.PdListData.slice(0, 10));
|
||||
}
|
||||
this.length = this.PdListData.length;
|
||||
this.PdListData.forEach(value=>{
|
||||
let original=value.pd_sno
|
||||
value.pd_sno_split={lender_name:original.replace(/[^a-z]/gi, ''),serial_no:original.match(/(\d+)/)[0]}
|
||||
})
|
||||
// this.dataLengthTab1 = data.records.length;
|
||||
// this.dataSourceTab1.data = this.PdListData;
|
||||
this.recordStatus=false;
|
||||
this.limitMsg = true
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
this.LenderRoleID = localStorage.getItem('LenderRoleID');
|
||||
|
||||
if(this.PdListData.length == 0) {
|
||||
@ -261,7 +228,7 @@ console.log(this.displayedColumns)
|
||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!' + '-' + error.error_text + ' occur');
|
||||
alert(error.html_format);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
OnPageChange(event: PageEvent){
|
||||
|
||||
@ -40,8 +40,8 @@ export class SalesPdComponent implements OnInit {
|
||||
|
||||
constructor(private _pdSales: PdTrigerService,private dialog:MatDialog,private route: ActivatedRoute, private router: Router,private _creditPdService:ApiServiceService) {
|
||||
|
||||
this.common = JSON.parse(localStorage.getItem('commonSettings')).default_pd_list_count;
|
||||
this.common = this.common.count+' '+this.common.factor
|
||||
// this.common = JSON.parse(localStorage.getItem('commonSettings')).default_pd_list_count;
|
||||
// this.common = this.common.count+' '+this.common.factor
|
||||
this.user_type = localStorage.getItem('len_user_role')
|
||||
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ export class LoginComponent implements OnInit{
|
||||
* AWS login service
|
||||
*/
|
||||
login() {
|
||||
|
||||
|
||||
const mailid = this.email.split(/\s/).join('');
|
||||
let auth = { 'Username': mailid, 'Password': this.password };
|
||||
this.loaderService.showMatSpinnerDialog('');
|
||||
@ -77,8 +77,17 @@ export class LoginComponent implements OnInit{
|
||||
console.log('ressss');
|
||||
console.log(res);
|
||||
// local storage for validate user access
|
||||
localStorage.setItem('user_role',res.idToken.payload["custom:role_id"]);
|
||||
this.router.navigate(['/']);
|
||||
|
||||
localStorage.setItem('user_role',res.idToken.payload["custom:role_id"]);
|
||||
//this.router.navigate(['/']);
|
||||
if(res.idToken.payload["custom:role_id"]=='11')
|
||||
{
|
||||
this.router.navigate(['sales-pd-list/list-pd']);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.router.navigate(['personal_discussion/pdlist']);
|
||||
}
|
||||
}
|
||||
this.loaderService.closeMatSpinnerDialog();
|
||||
}, err => {
|
||||
|
||||
@ -21,9 +21,7 @@ export interface Menu {
|
||||
children?: ChildrenItems[];
|
||||
}
|
||||
|
||||
const roleh=localStorage.getItem('len_user_role_id');
|
||||
alert(roleh);
|
||||
alert('tension1');
|
||||
|
||||
const HORIZONTALMENUITEMS = [
|
||||
// {
|
||||
// state: 'home',
|
||||
@ -104,6 +102,8 @@ const salesmenu = [
|
||||
@Injectable()
|
||||
export class HorizontalMenuItems {
|
||||
getAll(): Menu[] {
|
||||
console.log(HORIZONTALMENUITEMS);
|
||||
console.log('menus');
|
||||
return HORIZONTALMENUITEMS;
|
||||
}
|
||||
salesgetAll(): Menu[] {
|
||||
@ -112,6 +112,7 @@ export class HorizontalMenuItems {
|
||||
// if(user_type != 'credit'){
|
||||
// filtered_sales_menu = salesmenu.filter(vv=>vv.state != 'credit_pd')
|
||||
// }
|
||||
|
||||
return filtered_sales_menu;
|
||||
}
|
||||
add(menu: Menu) {
|
||||
|
||||
@ -31,8 +31,6 @@ export interface Menu {
|
||||
multichild?:Multichild[];
|
||||
}
|
||||
const role=localStorage.getItem('len_user_role_id');
|
||||
alert(role);
|
||||
alert('tension');
|
||||
|
||||
const MENUITEMS : Menu[] = [
|
||||
// {
|
||||
@ -178,13 +176,14 @@ const salesMenus: Menu[]= [
|
||||
// icon:'report',
|
||||
// }
|
||||
];
|
||||
console.log(salesMenus);
|
||||
console.log('salesman');
|
||||
if(role=='12')
|
||||
{
|
||||
const index = salesMenus.findIndex(user => user.name == 'Sales PD');
|
||||
salesMenus.splice(index, 1);
|
||||
}
|
||||
// console.log(salesMenus);
|
||||
// console.log('salesman');
|
||||
// if(role=='12')
|
||||
// {
|
||||
// alert('delete menu');
|
||||
// const index = salesMenus.findIndex(user => user.name == 'Sales PD');
|
||||
// salesMenus.splice(index, 1);
|
||||
// }
|
||||
@Injectable()
|
||||
export class MenuItems {
|
||||
getAll(): Menu[] {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user