sidebar.component.ts 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. import { Component, OnInit } from "@angular/core";
  2. import { AuthService } from "../../../services/auth2.service";
  3. import { Router } from "@angular/router";
  4. import Swal from "sweetalert2";
  5. declare const $: any;
  6. declare interface RouteInfo {
  7. path: string;
  8. title: string;
  9. icon: string;
  10. class: string;
  11. allowed_roles?: any;
  12. }
  13. export const ROUTES: RouteInfo[] = [
  14. {
  15. path: "/dashboard",
  16. title: "Dashboard",
  17. icon: "dashboard",
  18. class: ""
  19. },
  20. {
  21. path: "/investment-proposals",
  22. title: "Propuestas de inversión",
  23. icon: "wb_incandescent",
  24. class: ""
  25. //allowed_roles: [2, 3]
  26. },
  27. {
  28. path: "/investments",
  29. title: "Inversiones",
  30. icon: "work",
  31. class: ""
  32. //allowed_roles: [2, 3]
  33. }
  34. /*
  35. {
  36. path: "/arbitrations",
  37. title: "Arbitrajes",
  38. icon: "flag",
  39. class: ""
  40. //allowed_roles: [2, 3]
  41. },
  42. {
  43. path: "/performances",
  44. title: "Rendimientos",
  45. icon: "playlist_add",
  46. class: ""
  47. //allowed_roles: [2, 3]
  48. },
  49. {
  50. path: "/users",
  51. title: "Usuarios",
  52. icon: "people",
  53. class: ""
  54. //allowed_roles: [2, 3]
  55. }*/
  56. ];
  57. @Component({
  58. selector: "app-sidebar",
  59. templateUrl: "./sidebar.component.html",
  60. styleUrls: ["./sidebar.component.scss"]
  61. })
  62. export class SidebarComponent implements OnInit {
  63. menuItems: any[];
  64. adminMenuItems: any[];
  65. adminMenu: boolean = false;
  66. role_number: any;
  67. constructor(private auth: AuthService, private router: Router) {}
  68. ngOnInit() {
  69. this.menuItems = ROUTES.filter(menuItem => menuItem);
  70. }
  71. isMobileMenu() {
  72. if ($(window).width() > 991) {
  73. return false;
  74. }
  75. return true;
  76. }
  77. logout() {
  78. Swal.fire({});
  79. Swal.showLoading();
  80. this.auth.logout();
  81. //this.router.navigateByUrl("login");
  82. }
  83. }