{ "version": 3, "sources": ["src/app/_services/sidenav.service.ts"], "sourcesContent": ["import {Subject} from 'rxjs';\nimport {Injectable} from '@angular/core';\nimport {SidenavLink} from '../_models/SidenavLink';\nimport {AuthService} from './auth.service';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class SidenavService {\n sectionLinksSub = new Subject();\n navLinksSub = new Subject();\n\n constructor(private auth: AuthService) {\n }\n\n updateLinks(links: any[]) {\n this.createNavLinks();\n this.sectionLinksSub.next(links);\n }\n\n private createNavLinks() {\n const navLinks = [\n {name: 'Home', href: ['/'], icon: 'home'},\n {name: 'Orders', href: ['/orders'], icon: 'assignment'},\n {name: 'Receiving', href: ['/receiving'], icon: 'archive'},\n {name: 'Shipment', href: ['/shipment'], icon: 'local_shipping'},\n {name: 'Reconciliation', href: ['/recon'], icon: 'compare_arrows'},\n {name: 'Inventory', href: ['/inventory'], icon: 'view_module'},\n {name: 'Suppliers', href: ['/suppliers'], icon: 'contacts'},\n {name: 'Invoices', href: ['/invoices'], icon: 'folder_open'},\n {name: 'Payments', href: ['/payments'], icon: 'account_balance_wallet'},\n {name: 'Reports', href: ['/reports'], icon: 'visibility'},\n {name: 'My Organization', href: ['/my-organization'], icon: 'groups'},\n ];\n\n const user = this.auth.user;\n\n if (user) {\n if (this.auth.hasPermission('ManageUsers') || user.role === 'SuperUser') {\n navLinks.push({name: 'Users', href: ['/users'], icon: 'lock'});\n }\n\n if (user.role === 'SuperUser') {\n navLinks.push({name: 'Products', href: ['/product'], icon: 'lock'});\n navLinks.push({name: 'Organizations', href: ['/organizations'], icon: 'lock'});\n }\n }\n\n this.navLinksSub.next(navLinks.slice());\n }\n}\n"], "mappings": "gGAQA,IAAaA,GAAc,IAAA,CAArB,IAAOA,EAAP,MAAOA,CAAc,CAIvBC,YAAoBC,EAAiB,CAAjB,KAAAA,KAAAA,EAHpB,KAAAC,gBAAkB,IAAIC,EACtB,KAAAC,YAAc,IAAID,CAGlB,CAEAE,YAAYC,EAAY,CACpB,KAAKC,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EAAAC,CAAA,CAAA,CAAA,wBAAdpB,EAAcqB,QAAdrB,EAAcsB,UAAAC,WAFX,MAAM,CAAA,EAEhB,IAAOvB,EAAPwB,SAAOxB,CAAc,GAAA", "names": ["SidenavService", "constructor", "auth", "sectionLinksSub", "Subject", "navLinksSub", "updateLinks", "links", "createNavLinks", "next", "navLinks", "name", "href", "icon", "user", "hasPermission", "role", "push", "slice", "\u0275\u0275inject", "AuthService", "factory", "\u0275fac", "providedIn", "_SidenavService"] }