[update] - fix login
This commit is contained in:
35
package-lock.json
generated
35
package-lock.json
generated
@@ -21,6 +21,7 @@
|
||||
"@ng-select/ng-select": "^10.0.3",
|
||||
"bootstrap-icons": "^1.10.3",
|
||||
"date-fns": "^2.29.3",
|
||||
"f": "^1.4.0",
|
||||
"rxjs": "~7.8.0",
|
||||
"sweetalert2": "^11.7.3",
|
||||
"tslib": "^2.3.0",
|
||||
@@ -6451,6 +6452,11 @@
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/f": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/f/-/f-1.4.0.tgz",
|
||||
"integrity": "sha512-THMsoTpFuIFoQ538jpbW7x/9pVaE0jdKN2O+nd7xpeUT17lECGX8M+QOaZ186ipc3XSzSFOytaXFidItHix44Q=="
|
||||
},
|
||||
"node_modules/fast-deep-equal": {
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
||||
@@ -15357,8 +15363,7 @@
|
||||
"version": "15.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-15.2.2.tgz",
|
||||
"integrity": "sha512-xHd5CC0Wi0a/CKfKoOC4Bwb1FVjy0esj22eQAkVh0iDKeiAQH4UG/VRmsdSHvto1z0IzGbMSt4hRbv4h2aYIdw==",
|
||||
"dev": true,
|
||||
"requires": {}
|
||||
"dev": true
|
||||
},
|
||||
"@nodelib/fs.scandir": {
|
||||
"version": "2.1.5",
|
||||
@@ -15957,8 +15962,7 @@
|
||||
"version": "1.8.0",
|
||||
"resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.8.0.tgz",
|
||||
"integrity": "sha512-m7VZ3jwz4eK6A4Vtt8Ew1/mNbP24u0FhdyfA7fSvnJR6LMdfOYnmuIrrJAgrYfYJ10F/otaHTtrtrtmHdMNzEw==",
|
||||
"dev": true,
|
||||
"requires": {}
|
||||
"dev": true
|
||||
},
|
||||
"acorn-node": {
|
||||
"version": "1.8.2",
|
||||
@@ -17549,6 +17553,11 @@
|
||||
"tmp": "^0.0.33"
|
||||
}
|
||||
},
|
||||
"f": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/f/-/f-1.4.0.tgz",
|
||||
"integrity": "sha512-THMsoTpFuIFoQ538jpbW7x/9pVaE0jdKN2O+nd7xpeUT17lECGX8M+QOaZ186ipc3XSzSFOytaXFidItHix44Q=="
|
||||
},
|
||||
"fast-deep-equal": {
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
||||
@@ -18086,8 +18095,7 @@
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/icss-utils/-/icss-utils-5.1.0.tgz",
|
||||
"integrity": "sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA==",
|
||||
"dev": true,
|
||||
"requires": {}
|
||||
"dev": true
|
||||
},
|
||||
"ieee754": {
|
||||
"version": "1.2.1",
|
||||
@@ -18763,8 +18771,7 @@
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/karma-jasmine-html-reporter/-/karma-jasmine-html-reporter-2.0.0.tgz",
|
||||
"integrity": "sha512-SB8HNNiazAHXM1vGEzf8/tSyEhkfxuDdhYdPBX2Mwgzt0OuF2gicApQ+uvXLID/gXyJQgvrM9+1/2SxZFUUDIA==",
|
||||
"dev": true,
|
||||
"requires": {}
|
||||
"dev": true
|
||||
},
|
||||
"karma-source-map-support": {
|
||||
"version": "1.4.0",
|
||||
@@ -20260,8 +20267,7 @@
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/postcss-modules-extract-imports/-/postcss-modules-extract-imports-3.0.0.tgz",
|
||||
"integrity": "sha512-bdHleFnP3kZ4NYDhuGlVK+CMrQ/pqUm8bx/oGL93K6gVwiclvX5x0n76fYMKuIGKzlABOy13zsvqjb0f92TEXw==",
|
||||
"dev": true,
|
||||
"requires": {}
|
||||
"dev": true
|
||||
},
|
||||
"postcss-modules-local-by-default": {
|
||||
"version": "4.0.0",
|
||||
@@ -21515,8 +21521,7 @@
|
||||
"version": "3.5.2",
|
||||
"resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz",
|
||||
"integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==",
|
||||
"dev": true,
|
||||
"requires": {}
|
||||
"dev": true
|
||||
},
|
||||
"json-schema-traverse": {
|
||||
"version": "0.4.1",
|
||||
@@ -21943,8 +21948,7 @@
|
||||
"version": "3.5.2",
|
||||
"resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz",
|
||||
"integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==",
|
||||
"dev": true,
|
||||
"requires": {}
|
||||
"dev": true
|
||||
},
|
||||
"json-schema-traverse": {
|
||||
"version": "0.4.1",
|
||||
@@ -22143,8 +22147,7 @@
|
||||
"version": "8.11.0",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz",
|
||||
"integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==",
|
||||
"dev": true,
|
||||
"requires": {}
|
||||
"dev": true
|
||||
},
|
||||
"xtend": {
|
||||
"version": "4.0.2",
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
"@ng-select/ng-select": "^10.0.3",
|
||||
"bootstrap-icons": "^1.10.3",
|
||||
"date-fns": "^2.29.3",
|
||||
"f": "^1.4.0",
|
||||
"rxjs": "~7.8.0",
|
||||
"sweetalert2": "^11.7.3",
|
||||
"tslib": "^2.3.0",
|
||||
|
||||
@@ -1,96 +1,96 @@
|
||||
|
||||
export interface MENU {
|
||||
link?: string;
|
||||
type: | 'link' | 'heading' | 'collapsable';
|
||||
icon?: string;
|
||||
name?: string;
|
||||
params?: any[];
|
||||
badge?: string;
|
||||
roles?: any[];
|
||||
children?: any[];
|
||||
permission?: string;
|
||||
collapsed?: boolean;
|
||||
notShowing?: boolean;
|
||||
isChecked?: boolean;
|
||||
link?: string;
|
||||
type: | 'link' | 'heading' | 'collapsable';
|
||||
icon?: string;
|
||||
name?: string;
|
||||
params?: any[];
|
||||
badge?: string;
|
||||
roles?: any[];
|
||||
children?: any[];
|
||||
permission?: string;
|
||||
collapsed?: boolean;
|
||||
notShowing?: boolean;
|
||||
isChecked?: boolean;
|
||||
}
|
||||
|
||||
export const ROLE_ADMIN = 'admin'
|
||||
export const ROLE_ADMIN = 'admin'
|
||||
export const NOT_ADMIN = 'not-admin'
|
||||
export const MENU: MENU[] = [
|
||||
{
|
||||
name: 'Manage',
|
||||
link: 'manage',
|
||||
permission: 'manage',
|
||||
icon: 'bi bi-card-checklist',
|
||||
{
|
||||
name: 'Manage',
|
||||
link: 'manage',
|
||||
permission: 'manage',
|
||||
icon: 'bi bi-card-checklist',
|
||||
params: [],
|
||||
roles: [ROLE_ADMIN],
|
||||
badge: '',
|
||||
type: 'collapsable',
|
||||
children: [
|
||||
{
|
||||
name: 'KYC',
|
||||
link: 'manage/kyc',
|
||||
permission: 'manage-kyc',
|
||||
type: 'link',
|
||||
icon: '',
|
||||
params: [],
|
||||
badge: '',
|
||||
roles: [ROLE_ADMIN],
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'Report',
|
||||
link: 'report',
|
||||
permission: 'report',
|
||||
icon: 'bi bi-file-bar-graph',
|
||||
params: [],
|
||||
roles: [ROLE_ADMIN, NOT_ADMIN],
|
||||
badge: '',
|
||||
type: 'collapsable',
|
||||
children: [
|
||||
{
|
||||
name: 'Transactions',
|
||||
link: 'report/transactions',
|
||||
permission: 'transactions',
|
||||
type: 'link',
|
||||
icon: '',
|
||||
params: [ROLE_ADMIN, NOT_ADMIN],
|
||||
badge: '',
|
||||
type: 'collapsable',
|
||||
children: [
|
||||
{
|
||||
name: 'KYC',
|
||||
link: 'manage/kyc',
|
||||
permission: 'manage-kyc',
|
||||
type: 'link',
|
||||
icon: '',
|
||||
params: [],
|
||||
badge: '',
|
||||
roles: [ROLE_ADMIN],
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'Report',
|
||||
link: 'report',
|
||||
permission: 'report',
|
||||
icon: 'bi bi-file-bar-graph',
|
||||
params: [],
|
||||
roles:[ROLE_ADMIN,NOT_ADMIN],
|
||||
badge: '',
|
||||
type: 'collapsable',
|
||||
children: [
|
||||
{
|
||||
name: 'Transactions',
|
||||
link: 'report/transactions',
|
||||
permission: 'transactions',
|
||||
type: 'link',
|
||||
icon: '',
|
||||
params: [ROLE_ADMIN,NOT_ADMIN],
|
||||
badge: '',
|
||||
roles: [],
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'Setting',
|
||||
link: 'setting',
|
||||
permission: 'setting',
|
||||
icon: 'bi bi-gear-fill',
|
||||
params: [],
|
||||
roles: [],
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'Setting',
|
||||
link: 'setting',
|
||||
permission: 'setting',
|
||||
icon: 'bi bi-gear-fill',
|
||||
params: [],
|
||||
roles: [ROLE_ADMIN],
|
||||
badge: '',
|
||||
type: 'collapsable',
|
||||
children: [
|
||||
{
|
||||
name: 'Banner',
|
||||
link: 'setting/banner',
|
||||
permission: 'banner',
|
||||
roles: [ROLE_ADMIN],
|
||||
type: 'link',
|
||||
icon: '',
|
||||
params: [],
|
||||
badge: '',
|
||||
type: 'collapsable',
|
||||
children: [
|
||||
{
|
||||
name: 'Banner',
|
||||
link: 'setting/banner',
|
||||
permission: 'banner',
|
||||
roles: [ROLE_ADMIN],
|
||||
type: 'link',
|
||||
icon: '',
|
||||
params: [],
|
||||
badge: '',
|
||||
},
|
||||
{
|
||||
name: 'Promotion',
|
||||
link: 'setting/promotion',
|
||||
roles: [ROLE_ADMIN],
|
||||
permission: 'promotion',
|
||||
type: 'link',
|
||||
icon: '',
|
||||
params: [],
|
||||
badge: '',
|
||||
},
|
||||
]
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'Promotion',
|
||||
link: 'setting/promotion',
|
||||
roles: [ROLE_ADMIN],
|
||||
permission: 'promotion',
|
||||
type: 'link',
|
||||
icon: '',
|
||||
params: [],
|
||||
badge: '',
|
||||
},
|
||||
]
|
||||
},
|
||||
];
|
||||
|
||||
@@ -10,65 +10,66 @@ import { ROLE_ADMIN } from 'src/app/@config/menus';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-login',
|
||||
templateUrl: './login.component.html',
|
||||
styles: []
|
||||
selector: 'app-login',
|
||||
templateUrl: './login.component.html',
|
||||
styles: []
|
||||
})
|
||||
export class LoginComponent implements OnInit {
|
||||
dataForm: any = {};
|
||||
cathayForm: any = {
|
||||
mobileDeviceId : "1234",
|
||||
userName: 'admin',
|
||||
password: 'P@ssword1'
|
||||
};
|
||||
isLoading = false;
|
||||
dataForm: any = {};
|
||||
cathayForm: any = {
|
||||
mobileDeviceId: "1234",
|
||||
userName: 'admin',
|
||||
password: 'P@ssword1'
|
||||
};
|
||||
isLoading = false;
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
private appService: AppService,
|
||||
private authService: AuthService,
|
||||
private cathayAuthService: CathayAuthService
|
||||
) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
// if (!environment.production) {
|
||||
// this.dataForm = {
|
||||
// username: 'admin',
|
||||
// password: 'admin',
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
async onSubmit(form: any) {
|
||||
if (!form.valid) return false;
|
||||
try {
|
||||
// const result = await lastValueFrom(this.authService.login(this.dataForm));
|
||||
let cathayResult: any = await lastValueFrom(this.cathayAuthService.login(this.cathayForm));
|
||||
let isAdmin = cathayResult.token.userName == ROLE_ADMIN ? true : false
|
||||
cathayResult = {
|
||||
...cathayResult,
|
||||
isAdmin: isAdmin
|
||||
}
|
||||
this.appService.setToken(cathayResult.token.token)
|
||||
this.appService.setAuth(cathayResult);
|
||||
|
||||
if(isAdmin){
|
||||
return this.router.navigate(['/pages']);
|
||||
}
|
||||
|
||||
if(!isAdmin){
|
||||
return this.router.navigate(['/pages/report/transactions']);
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
return this.appService.message(EAction.ERROR, EText.NO_DATA);
|
||||
}
|
||||
constructor(
|
||||
private router: Router,
|
||||
private appService: AppService,
|
||||
private authService: AuthService,
|
||||
private cathayAuthService: CathayAuthService
|
||||
) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
// if (!environment.production) {
|
||||
// this.dataForm = {
|
||||
// username: 'admin',
|
||||
// password: 'admin',
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
async onSubmit(form: any) {
|
||||
if (!form.valid) return false;
|
||||
try {
|
||||
// const result = await lastValueFrom(this.authService.login(this.dataForm));
|
||||
let cathayResult: any = await lastValueFrom(this.cathayAuthService.login(this.cathayForm));
|
||||
let isAdmin = cathayResult.userName == ROLE_ADMIN ? true : false
|
||||
cathayResult = {
|
||||
...cathayResult,
|
||||
isAdmin: isAdmin
|
||||
}
|
||||
|
||||
this.appService.setToken(cathayResult.token.token)
|
||||
this.appService.setAuth(cathayResult);
|
||||
|
||||
if (isAdmin) {
|
||||
return this.router.navigate(['/pages']);
|
||||
}
|
||||
|
||||
if (!isAdmin) {
|
||||
return this.router.navigate(['/pages/report/transactions']);
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
return this.appService.message(EAction.ERROR, EText.NO_DATA);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public isFieldValid(form: any, field: any) {
|
||||
return field.errors && (field.dirty || field.touched || form.submitted);
|
||||
}
|
||||
public isFieldValid(form: any, field: any) {
|
||||
return field.errors && (field.dirty || field.touched || form.submitted);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,135 +4,138 @@ import { AppService } from '../../app.service';
|
||||
import { MENU, NOT_ADMIN, ROLE_ADMIN } from "../../@config/menus";
|
||||
|
||||
@Component({
|
||||
selector: 'app-pages-layouts',
|
||||
templateUrl: './layouts.component.html',
|
||||
styles: [],
|
||||
selector: 'app-pages-layouts',
|
||||
templateUrl: './layouts.component.html',
|
||||
styles: [],
|
||||
})
|
||||
export class PagesLayoutsComponent implements OnInit {
|
||||
|
||||
menus = MENU;
|
||||
isToggleSidebar = false;
|
||||
innerWidth: any;
|
||||
auth: any = {};
|
||||
isCollapsed: any = [];
|
||||
breadcrumb: any = [];
|
||||
permissionCheck = false;
|
||||
permission: any = [];
|
||||
menus = MENU;
|
||||
isToggleSidebar = false;
|
||||
innerWidth: any;
|
||||
auth: any = {};
|
||||
isCollapsed: any = [];
|
||||
breadcrumb: any = [];
|
||||
permissionCheck = false;
|
||||
permission: any = [];
|
||||
|
||||
constructor(
|
||||
private app: AppService,
|
||||
private router: Router,
|
||||
public changeDetectorRef: ChangeDetectorRef,
|
||||
) {
|
||||
constructor(
|
||||
private app: AppService,
|
||||
private router: Router,
|
||||
public changeDetectorRef: ChangeDetectorRef,
|
||||
) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
async ngOnInit() {
|
||||
this.onCollapsed();
|
||||
this.getBreadcrumb();
|
||||
await this.initAuth();
|
||||
this.changeDetectorRef.markForCheck()
|
||||
}
|
||||
async initAuth() {
|
||||
this.auth = this.app.auth();
|
||||
console.log(this.auth.isAdmin)
|
||||
this.menus = this.menus.map(r => {
|
||||
if(this.auth.isAdmin){
|
||||
if(r.roles.includes(ROLE_ADMIN)) return {
|
||||
...r,
|
||||
children: r.children.length ? r.children.filter(c => r.roles.includes(ROLE_ADMIN)) : []
|
||||
}
|
||||
} else {
|
||||
if(r.roles.includes(NOT_ADMIN)) return {
|
||||
...r,
|
||||
children: r.children.length ? r.children.filter(c => r.roles.includes(NOT_ADMIN)) : []
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
if (!this.permissionCheck) {
|
||||
// const users = await lastValueFrom(this.app.get(`${API.users}/getById/${this.auth.id}`));
|
||||
// this.permission = users.permission;
|
||||
// this.permissionCheck = true;
|
||||
async ngOnInit() {
|
||||
this.onCollapsed();
|
||||
this.getBreadcrumb();
|
||||
await this.initAuth();
|
||||
this.changeDetectorRef.markForCheck()
|
||||
}
|
||||
async initAuth() {
|
||||
this.auth = this.app.auth();
|
||||
console.log(this.auth)
|
||||
console.log(this.auth.isAdmin)
|
||||
this.menus = this.menus.map(r => {
|
||||
if (this.auth.isAdmin) {
|
||||
if (r.roles.includes(ROLE_ADMIN)) return {
|
||||
...r,
|
||||
children: r.children.length ? r.children.filter(c => r.roles.includes(ROLE_ADMIN)) : []
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
roleCheck(perm: string){
|
||||
// if(!environment.production) return true
|
||||
// return this.permission.includes(perm)
|
||||
return true;
|
||||
}
|
||||
|
||||
getBreadcrumb() {
|
||||
this.breadcrumb = [];
|
||||
let router: any = this.router.url;
|
||||
router = router.split('/');
|
||||
this.mapBreadcrumb(router, this.menus)
|
||||
this.changeDetectorRef.markForCheck()
|
||||
|
||||
}
|
||||
|
||||
mapBreadcrumb(router: any, items: any) {
|
||||
items.map((item: any) => {
|
||||
this.addItemBreadcrumb(router, item);
|
||||
if (item.children) this.mapBreadcrumb(router, item.children);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
addItemBreadcrumb(router: any, item: any) {
|
||||
|
||||
const data = {
|
||||
name: item.name,
|
||||
link: item.link,
|
||||
} else {
|
||||
if (r.roles.includes(NOT_ADMIN)) return {
|
||||
...r,
|
||||
children: r.children.length ? r.children.filter(c => r.roles.includes(NOT_ADMIN)) : []
|
||||
}
|
||||
if (router[2]) {
|
||||
if (item.link === router[2]) this.breadcrumb.push(data);
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
if (!this.permissionCheck) {
|
||||
// const users = await lastValueFrom(this.app.get(`${API.users}/getById/${this.auth.id}`));
|
||||
// this.permission = users.permission;
|
||||
// this.permissionCheck = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
roleCheck(perm: string) {
|
||||
// if(!environment.production) return true
|
||||
// return this.permission.includes(perm)
|
||||
return true;
|
||||
}
|
||||
|
||||
getBreadcrumb() {
|
||||
this.breadcrumb = [];
|
||||
let router: any = this.router.url;
|
||||
router = router.split('/');
|
||||
this.mapBreadcrumb(router, this.menus)
|
||||
this.changeDetectorRef.markForCheck()
|
||||
|
||||
}
|
||||
|
||||
mapBreadcrumb(router: any, items: any) {
|
||||
items.map((item: any) => {
|
||||
this.addItemBreadcrumb(router, item);
|
||||
if (item.children) this.mapBreadcrumb(router, item.children);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
addItemBreadcrumb(router: any, item: any) {
|
||||
|
||||
const data = {
|
||||
name: item.name,
|
||||
link: item.link,
|
||||
}
|
||||
if (router[2]) {
|
||||
if (item.link === router[2]) this.breadcrumb.push(data);
|
||||
}
|
||||
if (router[3]) {
|
||||
if (item.link === `${router[2]}/${router[3]}`) this.breadcrumb.push(data);
|
||||
}
|
||||
if (router[4]) {
|
||||
if (item.link === `${router[2]}/${router[3]}/${router[4]}`) this.breadcrumb.push(data);
|
||||
}
|
||||
if (router[5]) {
|
||||
if (item.link === `${router[2]}/${router[3]}/${router[4]}/${router[5]}`) this.breadcrumb.push(data);
|
||||
}
|
||||
if (router[6]) {
|
||||
if (item.link === `${router[2]}/${router[3]}/${router[4]}/${router[5]}/${router[6]}`) this.breadcrumb.push(data);
|
||||
}
|
||||
}
|
||||
|
||||
onCollapsed() {
|
||||
let router: any = this.router.url;
|
||||
router = router.split('/');
|
||||
this.menus.forEach((item: any, i: number) => {
|
||||
// item.collapsed = false;
|
||||
if (item.type === 'collapsable') {
|
||||
if (router.includes(item.link)) {
|
||||
item.collapsed = true;
|
||||
}
|
||||
if (router[3]) {
|
||||
if (item.link === `${router[2]}/${router[3]}`) this.breadcrumb.push(data);
|
||||
}
|
||||
if (router[4]) {
|
||||
if (item.link === `${router[2]}/${router[3]}/${router[4]}`) this.breadcrumb.push(data);
|
||||
}
|
||||
if (router[5]) {
|
||||
if (item.link === `${router[2]}/${router[3]}/${router[4]}/${router[5]}`) this.breadcrumb.push(data);
|
||||
}
|
||||
if (router[6]) {
|
||||
if (item.link === `${router[2]}/${router[3]}/${router[4]}/${router[5]}/${router[6]}`) this.breadcrumb.push(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onCollapsed() {
|
||||
let router: any = this.router.url;
|
||||
router = router.split('/');
|
||||
this.menus.forEach((item: any, i: number) => {
|
||||
// item.collapsed = false;
|
||||
if (item.type === 'collapsable') {
|
||||
if (router.includes(item.link)) {
|
||||
item.collapsed = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
logout() {
|
||||
this.app.logout();
|
||||
return this.router.navigate(['/auth']);
|
||||
}
|
||||
logout() {
|
||||
this.app.logout();
|
||||
return this.router.navigate(['/auth']);
|
||||
}
|
||||
|
||||
|
||||
toggleSidebar() {
|
||||
this.isToggleSidebar = !this.isToggleSidebar;
|
||||
}
|
||||
toggleSidebar() {
|
||||
this.isToggleSidebar = !this.isToggleSidebar;
|
||||
}
|
||||
|
||||
closeSidebar() {
|
||||
this.isToggleSidebar = false;
|
||||
}
|
||||
closeSidebar() {
|
||||
this.isToggleSidebar = false;
|
||||
}
|
||||
|
||||
onDeactivate() {
|
||||
this.ngOnInit();
|
||||
}
|
||||
onDeactivate() {
|
||||
this.ngOnInit();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user