Fernanda Zavala Alpuche 3 years ago
parent
commit
14daf372cc

+ 0 - 1
vacaciones/src/app/app.module.ts

@@ -107,7 +107,6 @@ import { MESMHSFORMDAYSComponent } from './components/mes/mesmhs/mesmhs-form-day
     /* SocketIoModule.forRoot(config) */
   ],
   providers: [
-    [{ provide: HTTP_INTERCEPTORS, useClass: ServerErrorInterceptor, multi: true }],
     [{ provide: DEFAULT_TIMEOUT, useValue: 5000 }],
     {provide: LocationStrategy, useClass: HashLocationStrategy}
   ],

+ 14 - 80
vacaciones/src/app/auth/auth.guard.ts

@@ -21,8 +21,9 @@ import { ValidationsService } from '../services/validations.service';
 export class AuthGuard implements CanActivate {
   jwt: Observable<string[]> = {} as Observable<string[]>;
   private _docSub: Subscription = {} as Subscription;
-
-  private empresas_arr :any[] = [];
+  rfc_local: string = "";
+  user_local: string = "";
+  private empresas_arr: any[] = [];
 
   constructor(
     private _IAMService: IAMService,
@@ -39,90 +40,23 @@ export class AuthGuard implements CanActivate {
     state: RouterStateSnapshot
   ) {
     let bloq = false;
-    // Sockect revisa si hay cambios en el localstorage
-    this.webSocketService.emit('localstorage_update', localStorage);
 
-    // Si hubo cambios, entonces se cierra sesión
-    await firstValueFrom(this.webSocketService.listen('localstorage_error')).then(async (res: any) => {  
-      if (res.error) {        
-        bloq = true;
-        this._IAMService.logout();
-        this._validationService.openSnackBar(res.msj);
+    this.rfc_local = localStorage.getItem('RFCEMPRESA')!;
+    this.user_local = localStorage.getItem('TIMUSERENC')!;
+    setInterval(() => {
+      let jwt_local = localStorage.getItem('jwt');
+      if (jwt_local !== "" && jwt_local !== undefined && jwt_local !== null) {
+        localStorage.setItem('RFCEMPRESA', this.rfc_local);
+        localStorage.setItem('TIMUSERENC', this.user_local);
       }
-    }, error => {
-      this._validationService.openSnackBar('Ocurrió un error al conectarse con el socket');
-    });
-    
+    }, 500);
+
     //Se checa si existe una sesión y si no hubo cambios
     let isLoggedIn = localStorage.getItem('jwt') != null;
-    if (isLoggedIn && !bloq ) {
+    if (isLoggedIn && !bloq) {
       return true;
     }
     return this.router.navigate(['/iam']);
   }
-
-  /* async checkLogin(url: string): Promise<true | UrlTree> {    
-
-    const sleep = (ms:number) => new Promise(resolve => setTimeout(resolve, ms));
-    let bloq = false;
-    this.webSocketService.emit('localstorage_update', localStorage);
-    this.webSocketService.listen('localstorage_error').subscribe(async (res: any) => {  
-      if (res.error) {
-        bloq = true;
-        this._IAMService.logout();
-        this._snackBar.open(res.msj, 'Cerrar');
-      }
-    });
-    await sleep(100);
-    
-    //Obtener boolean
-    let isLoggedIn = localStorage.getItem('jwt') != null;
-
-    if (isLoggedIn && !bloq ) {
-      return true;
-    }
-    // Store the attempted URL for redirecting
-    this._IAMService.redirectUrl = url;
-    // Redirect to the login page
-    return this.router.parseUrl('/iam');
-  } */
-
-
-  /* async checkLocalStorage(){
-    const sleep = (ms:number) => new Promise(resolve => setTimeout(resolve, ms))
-    let bloq = false;
-    
-    this.webSocketService.emit('localstorage_update', localStorage);
-    this.webSocketService.listen('localstorage_error').subscribe(async (res: any) => {
-      if (res.error) {
-        let bloq  = true;
-        localStorage.removeItem('RFCEMPRESA');
-        localStorage.removeItem('jwt');
-        localStorage.removeItem('TIMUSERENC');
-        
-        await sleep(1000);
-
-        localStorage.setItem('RFCEMPRESA', res.response.RFCEMPRESA);
-        localStorage.setItem('TIMUSERENC', res.response.TIMUSERENC);
-        localStorage.setItem('jwt', res.response.JWT);
-
-        let TIMUSERENC: USERInterface = JSON.parse(res.response.TIMUSERENC);
-        
-         let bloq_user = {
-          numero_empleado: this._encService.desencriptar(TIMUSERENC.IDUSUARIO),
-          numero_empleado_modifica: this._encService.desencriptar(TIMUSERENC.IDUSUARIO)
-        };
-        
-        this._mcomauService.bloquear(bloq_user);
-
-        await sleep(1000);
-        this._IAMService.logout();
-
-        this._snackBar.open(res.msj, 'Cerrar');
-        
-      }
-    });
-
-    return bloq;
-  } */
 }
+

+ 23 - 13
vacaciones/src/app/components/iam/iam.component.css

@@ -1,4 +1,8 @@
 
+.body{
+  padding-top: 150px;
+}
+
 mat-card{
   width: 400px;
 }
@@ -8,14 +12,8 @@ a {
 }
 
 .card-iam {
-  position: absolute;
-  left: 50%;
-  top: 50%;
-  -moz-transform: translate(-50%, -50%);
-  -webkit-transform: translate(-50%, -50%);
-  -ms-transform: translate(-50%, -50%);
-  -o-transform: translate(-50%, -50%);
-  transform: translate(-50%, -50%);
+  margin-left: auto;
+  margin-right: auto;
   padding: 10px 10px 30px 10px;
 }
 
@@ -42,6 +40,23 @@ mat-toolbar-row {
   /* background-color: #071D49; */
 }
 
+@media only screen and (max-height: 830px) {
+  .body{
+    padding-top: 75px;
+  }
+}
+@media only screen and (max-height: 750px) {
+  
+  .body{
+    padding-top: 65px;
+  }
+
+  footer{
+    position: relative !important;
+    bottom: 0;
+  }
+}
+
 footer {
   /* background-color: #071D49; */
   position: fixed;
@@ -51,21 +66,16 @@ footer {
   z-index: 10;
   color: white;
 }
-
 .footer-container{
   display: flex;
   align-items: center;
   width: 100%;
-  
 }
-
 .footer-container-calc{
   display: flex;
   align-items: center;
   width: calc(100% - 300px);
-  
 }
-
 .info-ittec{
   margin: 0;
   padding: 0;

+ 34 - 2
vacaciones/src/app/components/iam/iam.component.html

@@ -81,7 +81,7 @@
     </form>
   </mat-card>
 
-  <<footer id="footer" id="colorApp2" [class]="rfc_class">
+  <footer id="footer" id="colorApp2" [class]="rfc_class">
     <div class="footer-container">
       <div>
         Copyright &copy;{{ anio }}
@@ -111,5 +111,37 @@
         </div>
       </div>
     </div>
-  </footer>>
+  </footer>
+
+  <!-- <footer id="footer" id="colorApp2" [class]="rfc_class">
+    <div class="footer-container">
+      <div>
+        Copyright &copy;{{ anio }}
+        <a href="https://www.ittec.mx/"style="color: white; text-decoration: underline;" target="_blank"
+          >ITTEC. Tecnología Inteligente.</a
+        >
+        Todos los derechos reservados. |
+        <a
+          href="https://www.ittec.mx/privacidad"
+          style="font-weight: lighter; color: white"
+          >Aviso de Privacidad</a
+        >
+      </div>
+      <div style="flex: 1 1 auto"></div>
+      <div style="margin-right: 30px; display: flex">
+        <img [src]="imagenLogoITTEC()" alt="Logo ITTEC" style="height: 100%; width: auto" />
+        <div style="font-size: 10pt">
+          <p class="info-ittec">
+            <b>Correo para Soporte Técnico:</b> mesadeservicio@ittec.mx
+            <br />
+            <b>(+52) 55 6267 2444</b> |
+            <a href="https://www.ittec.mx/" style="color: white"
+              >www.ittec.mx</a
+            >
+            | soluciones@ittec.mx
+          </p>
+        </div>
+      </div>
+    </div>
+  </footer> -->
 </div>

+ 2 - 0
vacaciones/src/app/components/iam/iam.component.ts

@@ -59,6 +59,8 @@ export class IAMComponent implements AfterViewInit {
     // Checar si ya existe una sesión activa
     let cont = 0;
     setInterval(() => {
+      //let rfc_actual = localStorage.getItem('RFCEMPRESA');
+      //localStorage.setItem('RFCEMPRESA', 'TME700618RC7');
       if (cont == 0) {
         this.solicitud_datos = this.solicitud_datos;
         cont++;

+ 0 - 4
vacaciones/src/app/components/mco/mcomau/mcomau-form/mcomau-form.component.ts

@@ -219,19 +219,15 @@ export class MCOMAUFORMComponent implements OnInit {
   get politica() {
     return this.formGroup.get('politica');
   }
-
   get numero_empleado_modifica() {
     return this.formGroup.get('numero_empleado_modifica');
   }
-
   get id_jefe_directo() {
     return this.formGroup.get('id_jefe_directo');
   }
-
   get id_jefe_sustituto() {
     return this.formGroup.get('id_jefe_sustituto');
   }
-
   get turno() {
     return this.formGroup.get('turno');
   }

+ 0 - 3
vacaciones/src/app/components/mco/mcomau/mcomau.component.ts

@@ -159,7 +159,6 @@ export class MCOMAUComponent implements AfterViewInit {
     );
 
     let usuarios = this._mcomauService.obtenerTodos().toPromise();
-
     await usuarios.then(
       (res: any) => {
         if (res.status == 'Token is Expired') {
@@ -417,7 +416,6 @@ export class MCOMAUComponent implements AfterViewInit {
             usuarios_aux.push(element);
           }
         });
-
         break;
       case 4:
         this.usuarios_todos.forEach((element: MCOMAUInterface) => {
@@ -425,7 +423,6 @@ export class MCOMAUComponent implements AfterViewInit {
             usuarios_aux.push(element);
           }
         });
-
         break;
       default:
         this._validationService.openSnackBar('Ocurrió un error inesperado');

+ 38 - 32
vacaciones/src/app/components/mes/mesmpr/mesmpr.component.html

@@ -9,43 +9,48 @@
   </mat-grid-tile>
 </mat-grid-list>
 
-<!-- EASYG -->
-<mat-card class="card-normal-text mat-card-text mat-elevation-z8 animated fadeIn fast" style="padding-bottom: 20px;" *ngIf="!loading && casoEAYG">
+
+<!-- Periodo Actual -->
+<mat-card 
+  class="card-normal-text mat-card-text mat-elevation-z8 animated fadeIn fast" 
+  style="padding-bottom: 15px;" 
+  *ngIf="!loading && casoActual">
   <mat-grid-list cols="12" rowHeight="100px">
     <!-- Fila 1 | Periodo | Días disponibles (título) -->
     <mat-grid-tile colspan="12">
       <!-- Periodo Actual -->
       <div class="ml-5" style="position: absolute; left: 0">
         <mat-card-title style="margin-left: auto">
-          <b>{{ periodoEAYG }}</b>
+          <b>{{ periodoActual }}</b>
         </mat-card-title>
-        <span class="display-text">Periodo EAYG</span><br>
-        <span style="margin-top: 5px;"><b>Vencimiento:</b> {{ fechaVencimientoEAYG }}</span>
+        <span class="display-text">Periodo actual</span><br>
+        <span style="margin-top: 5px;"><b>Vencimiento:</b> {{ fechaVencimientoActual }}</span>
       </div>
       <div>
         <span class="display-0">Días disponibles</span>
       </div>
-      <div class="mr-5" class="position-right" style="bottom: 10px !important; width: 210px">
+      <div class="mr-5" class="position-right" style="bottom: 10px !important; width: 210px;">
         <mat-card-title class="display-text">Días por periodo</mat-card-title>
-        <span class="display-text-small text-secondary"><b>{{ diasPeriodoEAYG }}</b></span>
+        <span class="display-text-small text-secondary"><b>{{ diasPeriodoActual }}</b></span>
       </div>
     </mat-grid-tile>
     <!-- Fila 2 | Días Tomados | Días disponibles (Dato) -->
     <mat-grid-tile colspan="12">
       <h1 class="display-4 text-secondary">
-        {{ diasDisponiblesEAYG }}
+        {{ diasDisponiblesActual }}
       </h1>
       <div class="mr-5" class="position-right" style="top: 10px !important; margin-right: 1%; width: 180px">
         <mat-card-title class="display-text">Días tomados</mat-card-title>
-        <span class="display-text-small text-secondary"><b> {{ diasTomadosEAYG }} </b></span>
+        <span class="display-text-small text-secondary"><b> {{ diasTomadosActual }} </b></span>
       </div>
-    </mat-grid-tile>
+    </mat-grid-tile>    
   </mat-grid-list>
+
   <div align="right" style="right: 0; display: flex; align-items: center">
     <div  style="width: 100%; margin-left: 150px;">  
-      <mat-accordion class="headers-align" style="width: 100%; margin-top: 1%;" *ngIf="!casoActual && !casoAnterior">
-        <mat-expansion-panel style="margin-top: 20px;" class="expansion-panel" [disabled]="detalles.length === 0">
-          <mat-expansion-panel-header style="margin: auto;">
+      <mat-accordion class="headers-align" style="width: 100%; margin-top: 1%;">
+        <mat-expansion-panel class="expansion-panel" style="margin-top: 20px;" [disabled]="detalles.length === 0">
+          <mat-expansion-panel-header>
             <mat-panel-title>
               <mat-icon>calendar_month</mat-icon>
             </mat-panel-title>
@@ -55,6 +60,7 @@
             <div class="periodo-flex">
               <span>Periodo {{ formatoPeriodo(periodos.PERIODO) }}</span>
             </div>
+    
             <div>
               <div *ngFor="let detallePeriodo of formatoDetalles(periodos.DETALLES)">
                  <mat-divider></mat-divider>
@@ -72,51 +78,51 @@
 
     <div style="width: 180px; text-align: center; margin-right: 30px;">
       <mat-card-title class="display-text">Días solicitados</mat-card-title>
-      <span class="display-text-small text-secondary"><b> {{ diasSolicitadosEAYG }} </b></span>
+      <span class="display-text-small text-secondary"><b> {{ diasSolicitadosActual }} </b></span>
     </div>
   </div>
-  
 </mat-card>
 
-<!-- Periodo Actual -->
-<mat-card class="card-normal-text mat-card-text mat-elevation-z8 animated fadeIn fast" style="padding-bottom: 15px;" [style.margin-bottom]="!casoAnterior ? '100px' : ''"
-  *ngIf="!loading && casoActual">
+<!-- EASYG -->
+<mat-card 
+  class="card-normal-text mat-card-text mat-elevation-z8 animated fadeIn fast" 
+  [style.margin-bottom]="!casoAnterior ? '100px' : ''"
+  style="padding-bottom: 20px;" *ngIf="!loading && casoEAYG">
   <mat-grid-list cols="12" rowHeight="100px">
     <!-- Fila 1 | Periodo | Días disponibles (título) -->
     <mat-grid-tile colspan="12">
       <!-- Periodo Actual -->
       <div class="ml-5" style="position: absolute; left: 0">
         <mat-card-title style="margin-left: auto">
-          <b>{{ periodoActual }}</b>
+          <b>{{ periodoEAYG }}</b>
         </mat-card-title>
-        <span class="display-text">Periodo actual</span><br>
-        <span style="margin-top: 5px;"><b>Vencimiento:</b> {{ fechaVencimientoActual }}</span>
+        <span class="display-text">Periodo EAYG</span><br>
+        <span style="margin-top: 5px;"><b>Vencimiento:</b> {{ fechaVencimientoEAYG }}</span>
       </div>
       <div>
         <span class="display-0">Días disponibles</span>
       </div>
-      <div class="mr-5" class="position-right" style="bottom: 10px !important; width: 210px;">
+      <div class="mr-5" class="position-right" style="bottom: 10px !important; width: 210px">
         <mat-card-title class="display-text">Días por periodo</mat-card-title>
-        <span class="display-text-small text-secondary"><b>{{ diasPeriodoActual }}</b></span>
+        <span class="display-text-small text-secondary"><b>{{ diasPeriodoEAYG }}</b></span>
       </div>
     </mat-grid-tile>
     <!-- Fila 2 | Días Tomados | Días disponibles (Dato) -->
     <mat-grid-tile colspan="12">
       <h1 class="display-4 text-secondary">
-        {{ diasDisponiblesActual }}
+        {{ diasDisponiblesEAYG }}
       </h1>
       <div class="mr-5" class="position-right" style="top: 10px !important; margin-right: 1%; width: 180px">
         <mat-card-title class="display-text">Días tomados</mat-card-title>
-        <span class="display-text-small text-secondary"><b> {{ diasTomadosActual }} </b></span>
+        <span class="display-text-small text-secondary"><b> {{ diasTomadosEAYG }} </b></span>
       </div>
-    </mat-grid-tile>    
+    </mat-grid-tile>
   </mat-grid-list>
-
   <div align="right" style="right: 0; display: flex; align-items: center">
     <div  style="width: 100%; margin-left: 150px;">  
-      <mat-accordion class="headers-align" style="width: 100%; margin-top: 1%;">
-        <mat-expansion-panel class="expansion-panel" style="margin-top: 20px;" [disabled]="detalles.length === 0">
-          <mat-expansion-panel-header>
+      <mat-accordion class="headers-align" style="width: 100%; margin-top: 1%;" *ngIf="!casoActual && !casoAnterior">
+        <mat-expansion-panel style="margin-top: 20px;" class="expansion-panel" [disabled]="detalles.length === 0">
+          <mat-expansion-panel-header style="margin: auto;">
             <mat-panel-title>
               <mat-icon>calendar_month</mat-icon>
             </mat-panel-title>
@@ -126,7 +132,6 @@
             <div class="periodo-flex">
               <span>Periodo {{ formatoPeriodo(periodos.PERIODO) }}</span>
             </div>
-    
             <div>
               <div *ngFor="let detallePeriodo of formatoDetalles(periodos.DETALLES)">
                  <mat-divider></mat-divider>
@@ -144,9 +149,10 @@
 
     <div style="width: 180px; text-align: center; margin-right: 30px;">
       <mat-card-title class="display-text">Días solicitados</mat-card-title>
-      <span class="display-text-small text-secondary"><b> {{ diasSolicitadosActual }} </b></span>
+      <span class="display-text-small text-secondary"><b> {{ diasSolicitadosEAYG }} </b></span>
     </div>
   </div>
+  
 </mat-card>
 
 <!-- Periodo Anterior -->

+ 10 - 8
vacaciones/src/app/components/mes/mesmpr/mesmpr.component.ts

@@ -128,9 +128,11 @@ export class MESMPRComponent implements OnInit {
 
         this.periodoActual = this.formatoPeriodo(actual.PERIODO); // Periodo en años 'Periodo EAYG'
         this.fechaVencimientoActual = this.formatoFecha(actual.PERIODO.split('|')[1]); // Fecha de vencimiento del periodo
-        this.diasPeriodoActual = this.obtenerDiasPeriodos(actual.DETALLES) + actual.VACACIONESDISPONIBLES; // Cantidad de días disponibles por periodo 'Días por periodo' EAYG
-        this.diasDisponiblesActual = actual.VACACIONESDISPONIBLES; // Cantidad de 'Días disponibles' EAYG
-        this.diasTomadosActual = this.obtenerDiasTomados(actual.DETALLES) // Cantidad de días tomados 'Días tomados' EAYG
+        this.diasPeriodoActual = this.obtenerDiasPeriodos(actual.DETALLES) + actual.VACACIONESDISPONIBLES; // Cantidad de días disponibles por periodo 'Días por periodo'
+        this.diasDisponiblesActual = actual.VACACIONESDISPONIBLES; // Cantidad de 'Días disponibles' 
+        this.diasTomadosActual = this.obtenerDiasTomados(actual.DETALLES) // Cantidad de días tomados 'Días tomados' 
+        this.diasSolicitadosActual = this.obtenerDiasSolicitados(actual.DETALLES);
+
         this.casoActual = true;
       }
 
@@ -139,10 +141,10 @@ export class MESMPRComponent implements OnInit {
 
         this.periodoAnterior = this.formatoPeriodo(anterior.PERIODO); // Periodo en años 'Periodo EAYG'
         this.fechaVencimientoAnterior = this.formatoFecha(anterior.PERIODO.split('|')[1]); // Fecha de vencimiento del periodo
-        this.diasPeriodoAnterior = this.obtenerDiasPeriodos(anterior.DETALLES) + anterior.VACACIONESDISPONIBLES; // Cantidad de días disponibles por periodo 'Días por periodo' EAYG
-        this.diasDisponiblesAnterior = anterior.VACACIONESDISPONIBLES; // Cantidad de 'Días disponibles' EAYG
-        this.diasTomadosAnterior = this.obtenerDiasTomados(anterior.DETALLES) // Cantidad de días tomados 'Días tomados' EAYG
-
+        this.diasPeriodoAnterior = this.obtenerDiasPeriodos(anterior.DETALLES) + anterior.VACACIONESDISPONIBLES; // Cantidad de días disponibles por periodo 'Días por periodo'
+        this.diasDisponiblesAnterior = anterior.VACACIONESDISPONIBLES; // Cantidad de 'Días disponibles'
+        this.diasTomadosAnterior = this.obtenerDiasTomados(anterior.DETALLES) // Cantidad de días tomados 'Días tomados'
+        this.diasSolicitadosAnterior = this.obtenerDiasSolicitados(anterior.DETALLES);
         this.casoAnterior = true;
       }
     }
@@ -212,7 +214,7 @@ export class MESMPRComponent implements OnInit {
 
   formatoPeriodo(periodo: String): string {
     let anios = periodo.split('|');
-    return anios[0].split('-')[0] + '-' + anios[1].split('-')[0];
+    return anios[0].split('-')[0] + '-' + (parseInt(anios[0].split('-')[0]) + 1);
   }
 
   formatoDosPeriodo(periodo: String): string {

+ 2 - 2
vacaciones/src/app/components/mes/mesmre/mesmre.component.html

@@ -70,7 +70,7 @@
                 [value]="periodo.PERIODO" 
                 *ngFor="let periodo of periodos"
                 (click)="validarOpcionesFiltro()">
-                {{formatDate(periodo.PERIODO.split('|')[0])  + ' / ' + formatDate(periodo.PERIODO.split('|')[1])  }}
+                {{ periodo.PERIODO }}
               </mat-option>
             </mat-select>
           </mat-form-field>
@@ -231,7 +231,7 @@
           Periodo vacacional
         </th>
         <td mat-cell *matCellDef="let element">
-          {{ element.PERIODOVACACIONAL != 'N/A' ?  'De '+ formatDate(element.PERIODOVACACIONAL.split('|')[0])  + ' a ' + formatDate(element.PERIODOVACACIONAL.split('|')[1]) : 'N/A' }}
+          {{ element.PERIODOVACACIONAL }}
         </td>
       </ng-container>
   

+ 28 - 18
vacaciones/src/app/components/mes/mesmre/mesmre.component.ts

@@ -201,7 +201,10 @@ export class MESMREComponent implements AfterViewInit {
         this._validationService.openSnackBar('Sesión expirada. Vuelva a iniciar sesión');
       } else if (!res.status && res.response.length > 0) {
         this.periodos = res.response;
-      } else {
+        this.periodos.map((periodo) => {
+          periodo.PERIODO = this.formatoFechaPeriodo(periodo.PERIODO).join();
+        })
+      }else{
         if (res.msg !== "EXITO") {
           this._validationService.openSnackBar(res.msg);
         }
@@ -344,14 +347,14 @@ export class MESMREComponent implements AfterViewInit {
         //RANGO FECHAS Y ESTATUS
       } else if (this.rango.value.fecha_inicio != null && this.rango.value.fecha_fin != null && this.opcionEstatus != null) {
         filtro_solicitudes = filtro_solicitudes.filter(solicitud => solicitud.ESTATUS == this.opcionEstatus);
-        //RANGO FECHAS Y PERIODO
-      } else if (this.rango.value.fecha_inicio != null && this.rango.value.fecha_fin != null && this.opcionPeriodo != null) {
-        filtro_solicitudes = filtro_solicitudes.filter(solicitud => solicitud.ESTATUS == this.opcionEstatus);
-        //ESTATUS Y PERIODO
-      } else if (this.opcionEstatus != null && this.opcionPeriodo != null) {
+      //RANGO FECHAS Y PERIODO
+      }else if (this.rango.value.fecha_inicio != null && this.rango.value.fecha_fin != null && this.opcionPeriodo != null) {
+        filtro_solicitudes = filtro_solicitudes.filter(solicitud => solicitud.PERIODOVACACIONAL == this.opcionPeriodo);
+      //ESTATUS Y PERIODO
+      }else if (this.opcionEstatus != null && this.opcionPeriodo != null) {
         filtro_solicitudes = this.solicitudes.filter(solicitud => solicitud.ESTATUS == this.opcionEstatus && solicitud.PERIODOVACACIONAL == this.opcionPeriodo);
-        //ESTATUS
-      } else if (this.opcionEstatus != null) {
+      //ESTATUS
+      }else if (this.opcionEstatus != null) {
         filtro_solicitudes = this.solicitudes.filter(solicitud => solicitud.ESTATUS == this.opcionEstatus);
         //PERIODO
       } else if (this.opcionPeriodo != null) {
@@ -473,11 +476,13 @@ export class MESMREComponent implements AfterViewInit {
   }
 
   mapearTabla() {
-    this.solicitudes.map(function (
+    this.solicitudes.map((
       solicitud: MESMREInterface
-    ) {
+    ) => {      
       if (solicitud.PERIODOVACACIONAL == null) {
         solicitud.PERIODOVACACIONAL = 'N/A';
+      } else {
+        solicitud.PERIODOVACACIONAL = this.formatoFechaPeriodo(solicitud.PERIODOVACACIONAL).join();
       }
       if (solicitud.VACACIONESANTES == null) {
         solicitud.VACACIONESANTES = 0;
@@ -485,6 +490,7 @@ export class MESMREComponent implements AfterViewInit {
       if (solicitud.VACACIONESDESPUES == null) {
         solicitud.VACACIONESDESPUES = 0;
       }
+
       return {
         IDSOLICITUD: solicitud.IDSOLICITUD,
         NOMBREEMPLEADO: solicitud.NOMBREEMPLEADO,
@@ -535,11 +541,6 @@ export class MESMREComponent implements AfterViewInit {
     this.mapearTabla();
   }
 
-  formatoFecha(fecha: string): string {
-    let split = fecha.split('-');
-    return `${split[2]}-${split[1]}-${split[0]}`
-  }
-
   applyFilter(filterValue: any) {
     this.dataSource.filter = filterValue.target.value.trim().toLowerCase();
   }
@@ -588,8 +589,17 @@ export class MESMREComponent implements AfterViewInit {
     }
   }
 
-  formatDate(fecha: string) {
-    let arrFecha = fecha.split("-");
-    return `${arrFecha[2]}-${arrFecha[1]}-${arrFecha[0]}`;
+  formatoFecha(fecha:string): string {
+    let split = fecha.split('-');
+    return `${split[2]}-${split[1]}-${split[0]}`
+  }
+
+  formatoFechaPeriodo(item: any) {
+    let arrPeriodoVacacional = [];
+    let fechaPeriodo = item.split('|');
+
+    arrPeriodoVacacional.push('De ' + this.formatoFecha(fechaPeriodo[0]) + ' a ' +this.formatoFecha(fechaPeriodo[1]));
+
+    return arrPeriodoVacacional;
   }
 }

+ 10 - 12
vacaciones/src/app/services/excel/export-excel.service.ts

@@ -11,25 +11,18 @@ export class ExportExcelService {
   constructor() { }
 
   generarExcel(excelData:any, filename:string, titulo:string) {
-
     //Saber ultima celda para el filtrado de datos
     let ultimaCelda;
 
     const title = 'Reporte de periodos vacacionales';
     const header = ['Número de Solicitud', 'Nombre Empleado', 'Fecha Inicio', 'Fecha Fin', 'Número Días', 'Estatus', 'Periodo Vacacional', 'Vacaciones antes', 'Vacaciones después']
     
-    const data:MESMREInterface[] = excelData.map(function (
+    const data:MESMREInterface[] = excelData.map((
       solicitud: MESMREInterface
-    ) {
-      if (solicitud.PERIODOVACACIONAL == null) {
-        solicitud.PERIODOVACACIONAL = 'N/A';
-      }
-      if (solicitud.VACACIONESANTES == null) {
-        solicitud.VACACIONESANTES = 0;
-      }
-      if (solicitud.VACACIONESDESPUES == null) {
-        solicitud.VACACIONESDESPUES = 0;
-      }
+    ) => {
+      solicitud.FECHAINICIO = this.formatoFecha(solicitud.FECHAINICIO);
+      solicitud.FECHAFIN = this.formatoFecha(solicitud.FECHAFIN);
+
       return {
         IDSOLICITUD: solicitud.IDSOLICITUD,
         NOMBREEMPLEADO: solicitud.NOMBREEMPLEADO,
@@ -205,4 +198,9 @@ export class ExportExcelService {
     })
   }
 
+  formatoFecha(fecha:string): string {
+    let split = fecha.split('-');
+
+    return `${split[2]}-${split[1]}-${split[0]}`
+  }
 }

+ 19 - 30
vacaciones/src/app/services/iam/iam.service.ts

@@ -41,9 +41,11 @@ export class IAMService implements OnInit {
         ip_address: this.ipAddress,
       };
 
-      let respuesta = this.http.post<ResponseLogin>(`${this._url}/login`, objeto).toPromise();
-      await respuesta. then(
-        async (data) => {          
+      let respuesta = this.http
+        .post<ResponseLogin>(`${this._url}/login`, objeto)
+        .toPromise();
+      await respuesta.then(
+        async (data) => {
           if (!data?.error) {
             let status = this._encService.desencriptar(data!.response.ESTATUS);
             let perfil = this._encService.desencriptar(data!.response.PERFIL);
@@ -60,23 +62,15 @@ export class IAMService implements OnInit {
                   let jwt_local = localStorage.getItem('jwt');
                   let TIMUSERENC_local = localStorage.getItem('TIMUSERENC');
 
-                  if (
-                    (TIMUSERENC_local != '' ||
-                      TIMUSERENC_local != undefined ||
-                      TIMUSERENC_local != 'undefined' ||
-                      TIMUSERENC_local != null) &&
-                    (jwt_local != '' ||
-                      jwt_local != undefined ||
-                      jwt_local != 'undefined' ||
-                      jwt_local != null)
-                  ) {
-                    localStorage.setItem('jwt', data!.response.TOKEN);
-                    localStorage.setItem(
-                      'TIMUSERENC',
-                      JSON.stringify(data!.response)
-                    );
+                  localStorage.setItem('jwt', data!.response.TOKEN);
+                  localStorage.setItem(
+                    'TIMUSERENC',
+                    JSON.stringify(data!.response)
+                  );
+
+                  this.userType(perfil, solicitud_datos);
 
-                    this.webSocketService.emit(
+                  /* this.webSocketService.emit(
                       'localstorage_login',
                       localStorage
                     );
@@ -91,12 +85,8 @@ export class IAMService implements OnInit {
                           );
                           this.userType(perfil, solicitud_datos);
                         }
-                      });
-                  } else {
-                    this.snackAlert(
-                      'Ya existe una sesión, cierra la sesión para continuar'
-                    );
-                  }
+                      }); */
+
                   break;
                 case 'Eliminado':
                   this.snackAlert('El usuario no existe');
@@ -156,12 +146,12 @@ export class IAMService implements OnInit {
 
   public logout(): void {
     let rfc = localStorage.getItem('RFCEMPRESA');
-    if(rfc === null || rfc === undefined || rfc === ''){
+    if (rfc === null || rfc === undefined || rfc === '') {
       localStorage.setItem('RFCEMPRESA', 'ITTEC');
     }
-    
-    this.webSocketService.emit('localstorage_logout', '');
-    
+
+    /* this.webSocketService.emit('localstorage_logout', ''); */
+
     localStorage.removeItem('jwt');
     localStorage.removeItem('TIMUSERENC');
 
@@ -170,7 +160,6 @@ export class IAMService implements OnInit {
   }
 
   private userType(perfil: string, solicitud_datos: string) {
-    
     if (perfil == 'Administrador') {
       if (solicitud_datos == '') {
         this.router.navigate(['/admin/mesmpr']);

+ 0 - 1
vacaciones/src/app/services/mes/mesmpr/mesmpr.service.ts

@@ -6,7 +6,6 @@ import { ResponseData } from 'src/app/interfaces/response-data';
 import { USERInterface } from 'src/app/interfaces/user-interface';
 import { ENCService } from '../../enc/enc.service';
 import { IAMService } from '../../iam/iam.service';
-import { WebSocketService } from '../../socket/web-socket.service';
 
 @Injectable({
   providedIn: 'root',

+ 4 - 4
vacaciones/src/app/services/socket/web-socket.service.ts

@@ -18,15 +18,15 @@ export class WebSocketService{
   readonly uri: string = "ws://localhost:4444"; 
   constructor() { 
    /*  this.socket = io.io(this.uri, { transports: ['websocket']}); */    
-   if (window.location.href.includes("localhost")) {
+   /* if (window.location.href.includes("localhost")) {
     this.socket = io.io("ws://localhost:4444", { transports: ['websocket']});
    }else{
     this.socket = io.io();
-   }
+   } */
     
   }  
  
-  listen(eventName: string){
+  /* listen(eventName: string){
     return new Observable((subscribe) => {
       this.socket.on(eventName, (data:any) => {
         subscribe.next(data);
@@ -36,5 +36,5 @@ export class WebSocketService{
 
   emit(eventName: string, data:any){
     this.socket.emit(eventName, data);
-  }
+  } */
 }