Ver código fonte

validacion usuarios

alanittec 3 anos atrás
pai
commit
6826b9228c

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

@@ -25,7 +25,8 @@
           <mat-option (click)="obtenerMiHistorial()" value="Mi Historial" selected>Mi historial [{{
             usuario_session.NOMBRE}}]</mat-option>
           <mat-option (click)="obtenerTodosHistorial()" value="Mi Historial">Todos</mat-option>
-          <mat-option style="background-color: #071d49; color: #FFF; cursor: default;">Usuarios</mat-option>
+          <mat-option style="background-color: #071d49; color: #FFF; cursor: default;" *ngIf="showUsersAdmin == true">
+            Usuarios</mat-option>
           <mat-option *ngFor="let item of filteredOptions | async ; let i = index" [value]="item"
             (click)="obtenerHistorialSubordinado(item)">
             {{ item }}
@@ -40,7 +41,8 @@
         <mat-autocomplete #auto="matAutocomplete">
           <mat-option (click)="obtenerMiHistorial()" value="Mi Historial">Mi historial [{{ usuario_session.NOMBRE}}]
           </mat-option>
-          <mat-option style="background-color: #071d49; color: #FFF; cursor: default;">Usuarios</mat-option>
+          <mat-option style="background-color: #071d49; color: #FFF; cursor: default;" *ngIf="showUsers == true">
+            Usuarios</mat-option>
           <mat-option *ngFor="let item of filteredOptionsAux | async; let i = index" [value]="item"
             (click)="obtenerHistorialSubordinado(item)">
             {{ item }}

+ 5 - 3
vacaciones/src/app/components/mes/mesmhs/mesmhs.component.ts

@@ -44,7 +44,8 @@ export class MESMHSComponent implements AfterViewInit {
 
   filteredOptions!: Observable<any>;
   filteredOptionsAux!: Observable<any>;
-
+  showUsers = true;
+  showUsersAdmin = true;
   constructor(
     public dialog: MatDialog,
     private _mesmhsService: MESMHSService,
@@ -325,6 +326,7 @@ export class MESMHSComponent implements AfterViewInit {
     });
 
     this.subordinados = arr_user;
+    this.showUsersAdmin = arr_user.length > 0 ? true : false;
 
     this.subordinadosAux = arr_user.map((option: any) => {
       return option.USUARIO + ' (' + option.IDUSUARIO + ')';
@@ -369,8 +371,9 @@ export class MESMHSComponent implements AfterViewInit {
               res.response.length > 0 ? res.msg : 'No hay datos para mostrar'
             );
             this.dataSource.data = [];
-            this.subordinados = [];
+            this.subordinados = res;
             this.data_empty = true;
+            this.showUsers = true;
           }
         },
         (error) => {
@@ -493,7 +496,6 @@ export class MESMHSComponent implements AfterViewInit {
       }
     });
   }
-  
 
   private getDateWithString(fecha: string) {
     let fechaAux = fecha.split('-');