app.component.ts
3.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import { Component, OnInit } from '@angular/core';
import { UserService } from './components/userentity/user.service';
import { ManageDiscountCodeService } from './components/managediscountcode/managediscountcode.service';
import { SubscriptionPriceService } from './components/subscriptionprice/subscriptionprice.service';
import { LicenseService } from './components/licenseentity/license.service';
import { ReportService } from './components/reports/report.service';
import { UserManageRightsModel } from './components/userentity/datamodel';
//import { MyAuthService } from './shared/my-auth.service';
import { GlobalService } from './shared/global';
import { Router, NavigationEnd } from '@angular/router';
//import { HttpClient } from '@angular/common/http';
//import { HttpErrorResponse } from '@angular/common/http';
//import { Observable } from 'rxjs/Observable';
@Component({
selector: 'app-component',
templateUrl: '../app/app.component.html',
providers: [UserService, ManageDiscountCodeService, SubscriptionPriceService, LicenseService, ReportService]
})
export class AppComponent implements OnInit {
public obj: any;
public objMenu: Array<any>=[];
public objMenuGernal: any;
public menustaus: string;
public submenustaus: string;
public UpdateProfileVisible: boolean;
public UserManageRightsList: Array<UserManageRightsModel>;
constructor(private userservice: UserService, public global: GlobalService, private router: Router,
) { }
ngOnInit(): void {
this.menustaus = "True";
this.global.getJSON().subscribe(data => {
this.obj = data["AdminSections"]
for (let i = 0; i < 7; i++) {
if (this.obj[i].Id == this.global.UserType) {
if (this.global.UserTypeName == "General Admin") {
this.userservice.GetGeneralAdminMenu({
UserId: this.global.UserId,
UserType: this.global.UserTypeName
}).subscribe(x => {
console.log(x); this.UserManageRightsList = x;
this.objMenuGernal = this.obj[i].HeaderMenu;
//this.objMenuGernal = this.objMenu;
//this.objMenu='';
for (var imenu = 0; imenu < this.objMenuGernal.length; imenu++) {
for (var k = 0; k < this.UserManageRightsList.length; k++) {
if (this.objMenuGernal[imenu].HeaderMenuName == this.UserManageRightsList[k].Title) {
// this.global.objMenu.push(this.objMenuGernal[imenu]);
this.objMenu.push(this.objMenuGernal[imenu]);
break;
}
}
}
this.router.navigate(['/updateuserprofile']);
}, error => {
});
}
else {
this.objMenu = this.obj[i].HeaderMenu;
this.router.navigate(['/updateuserprofile']);
}
}
}
}, error => console.log(error));
}
logout() {
localStorage.removeItem('loggedInUserDetails');
window.location.href = this.global.LiveURL;
}
Product() {
debugger;
//localStorage.removeItem('loggedInUserDetails');
window.location.href = this.global.LiveURL;
//this.router.navigate([this.global.LiveURL]);
}
}