mes.component.ts 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. import { Component, AfterViewInit } from '@angular/core';
  2. import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
  3. import { Router } from '@angular/router';
  4. import { IAMService } from 'src/app/services/iam/iam.service';
  5. import { USERInterface } from 'src/app/interfaces/user-interface';
  6. import { ENCService } from 'src/app/services/enc/enc.service';
  7. @Component({
  8. selector: 'app-mes',
  9. templateUrl: './mes.component.html',
  10. styleUrls: ['./mes.component.css']
  11. })
  12. export class MESComponent implements AfterViewInit {
  13. title = 'vacaciones';
  14. anio: number;
  15. menuMCO = false;
  16. isLoggedIn:Boolean = false;
  17. events: string[] = [];
  18. opened: boolean = false;
  19. pantallaGrande:boolean = !this.breakpointObserver.isMatched('(max-width: 1700px)');
  20. nombreUsuario: string;
  21. usuario_session:USERInterface = JSON.parse(localStorage.getItem('TIMUSERENC')!);
  22. empresa:string = "";
  23. public auxCont:boolean = false
  24. razonSocial: string = "";
  25. public perfil : string;
  26. public activateMenu( response:Boolean ){
  27. this.isLoggedIn = response;
  28. }
  29. constructor( private _encService:ENCService, private breakpointObserver:BreakpointObserver, private _IAMService:IAMService) {
  30. this.anio = new Date().getFullYear();
  31. this.isLoggedIn = (localStorage.getItem('jwt') !== "");
  32. this.nombreUsuario = this.usuario_session.NOMBRE;
  33. this.razonSocial = this._encService.desencriptar(this.usuario_session.RAZONSOCIAL);
  34. this.empresa = this._encService.desencriptar( this.usuario_session.RFCEMPRESA);
  35. this.perfil = this._encService.desencriptar(this.usuario_session.NOMBREPERFIL);
  36. }
  37. ngAfterViewInit(): void {
  38. this.cargarColores();
  39. if(!this.pantallaGrande){
  40. this.auxCont = true;
  41. }else{
  42. this.auxCont = false;
  43. }
  44. }
  45. onResize(event:any) {
  46. this.pantallaGrande = event.target.innerWidth > 1700
  47. if(!this.pantallaGrande){
  48. this.auxCont = true;
  49. }else{
  50. this.auxCont = false;
  51. }
  52. }
  53. smallMenu(){
  54. if (this.auxCont) {
  55. this.pantallaGrande = !this.pantallaGrande;
  56. }
  57. }
  58. async cargarColores(){
  59. if(this.pantallaGrande){
  60. document.getElementById("colorApp4")!.classList.remove('primary');
  61. document.getElementById("colorApp4")!.classList.add(this.empresa);
  62. document.getElementById("colorApp5")!.classList.remove('primary');
  63. document.getElementById("colorApp5")!.classList.add(this.empresa);
  64. /* document.getElementById("colorApp6")!.classList.remove('primary');
  65. document.getElementById("colorApp6")!.classList.add(this.empresa); */
  66. document.getElementById("colorAppText3")!.classList.remove('text-primary');
  67. document.getElementById("colorAppText3")!.classList.add(`text-${this.empresa}`);
  68. }else{
  69. document.getElementById("colorApp1")!.classList.remove('primary');
  70. document.getElementById("colorApp1")!.classList.add(this.empresa);
  71. document.getElementById("colorApp2")!.classList.remove('primary');
  72. document.getElementById("colorApp2")!.classList.add(this.empresa);
  73. document.getElementById("colorApp3")!.classList.remove('primary');
  74. document.getElementById("colorApp3")!.classList.add(this.empresa);
  75. document.getElementById("colorAppText1")!.classList.remove('text-primary');
  76. document.getElementById("colorAppText1")!.classList.add(`text-${this.empresa}`);
  77. document.getElementById("colorAppText1")!.classList.remove('text-primary');
  78. document.getElementById("colorAppText1")!.classList.add(`text-${this.empresa}`);
  79. }
  80. }
  81. imagenLogo(){
  82. let empresa = localStorage.getItem("RFCEMPRESA")!;
  83. if (window.location.href.includes("ferrariventilatori")) {
  84. return `https://ferrariventilatori.mx/vacaciones/assets/img/${empresa}-NO-BG.png`
  85. }else{
  86. return `../assets/img/${ this._encService.desencriptar(empresa)}-NO-BG.png`
  87. }
  88. }
  89. imagenLogoITTEC(){
  90. if (window.location.href.includes("ferrariventilatori")) {
  91. return "https://ferrariventilatori.mx/vacaciones/assets/img/ITTEC-NO-BG.png"
  92. }else{
  93. return "../assets/img/ITTEC-NO-BG.png"
  94. }
  95. }
  96. logout() {
  97. this._IAMService.logout();
  98. this.isLoggedIn = false;
  99. }
  100. }