|
|
@@ -109,17 +109,14 @@ export class MESMREComponent implements AfterViewInit {
|
|
|
this.nombre_usuario = usuario.NOMBRE;
|
|
|
|
|
|
if (
|
|
|
- this._encService.desencriptar(
|
|
|
- JSON.parse(localStorage.getItem('TIMUSERENC')!).PERFIL
|
|
|
- ) === "1"
|
|
|
+ this._encService.desencriptar(JSON.parse(localStorage.getItem('TIMUSERENC')!).PERFIL) === '1'
|
|
|
) {
|
|
|
this.role = 'Administrador';
|
|
|
} else if (
|
|
|
this._encService.desencriptar(
|
|
|
JSON.parse(localStorage.getItem('TIMUSERENC')!).PERFIL
|
|
|
- ) !== "1"
|
|
|
+ ) !== '1'
|
|
|
) {
|
|
|
-
|
|
|
this.opcionesSolicitudes = this.opcionesSolicitudes.slice(0, 1);
|
|
|
this.isUser = true;
|
|
|
this.role = 'Usuario';
|
|
|
@@ -174,7 +171,7 @@ export class MESMREComponent implements AfterViewInit {
|
|
|
if (
|
|
|
this._encService.desencriptar(
|
|
|
JSON.parse(localStorage.getItem('TIMUSERENC')!).PERFIL
|
|
|
- ) == "1"
|
|
|
+ ) === '1'
|
|
|
) {
|
|
|
await lastValueFrom(this.__mesmreService.consultarTodos()).then(
|
|
|
(res: any) => {
|
|
|
@@ -201,10 +198,7 @@ export class MESMREComponent implements AfterViewInit {
|
|
|
|
|
|
this.empleados = [
|
|
|
...new Map(
|
|
|
- this.empleados.map((empleado) => [
|
|
|
- empleado.NOMBREEMPLEADO,
|
|
|
- empleado,
|
|
|
- ])
|
|
|
+ this.empleados.map((empleado) => [empleado.NOMBREEMPLEADO, empleado])
|
|
|
).values(),
|
|
|
];
|
|
|
|
|
|
@@ -219,7 +213,7 @@ export class MESMREComponent implements AfterViewInit {
|
|
|
} else if (
|
|
|
this._encService.desencriptar(
|
|
|
JSON.parse(localStorage.getItem('TIMUSERENC')!).PERFIL
|
|
|
- ) == 'Usuario'
|
|
|
+ ) !== '1'
|
|
|
) {
|
|
|
await lastValueFrom(this.__mesmreService.consultarEmpleados()).then(
|
|
|
(res: any) => {
|
|
|
@@ -246,10 +240,7 @@ export class MESMREComponent implements AfterViewInit {
|
|
|
|
|
|
this.empleados = [
|
|
|
...new Map(
|
|
|
- this.empleados.map((empleado) => [
|
|
|
- empleado.NOMBREEMPLEADO,
|
|
|
- empleado,
|
|
|
- ])
|
|
|
+ this.empleados.map((empleado) => [empleado.NOMBREEMPLEADO, empleado])
|
|
|
).values(),
|
|
|
];
|
|
|
}
|
|
|
@@ -307,7 +298,7 @@ export class MESMREComponent implements AfterViewInit {
|
|
|
'Ocurrió un error inesperado, favor de intentarlo más tarde'
|
|
|
);
|
|
|
} else {
|
|
|
- aux_response = res.response
|
|
|
+ aux_response = res.response;
|
|
|
}
|
|
|
},
|
|
|
(error) => {
|
|
|
@@ -325,10 +316,14 @@ export class MESMREComponent implements AfterViewInit {
|
|
|
}
|
|
|
);
|
|
|
|
|
|
- this.obtenerPeriodos(this._encService.desencriptar( this.__mesmreService.usuario_session.IDUSUARIO));
|
|
|
+ this.obtenerPeriodos(
|
|
|
+ this._encService.desencriptar(
|
|
|
+ this.__mesmreService.usuario_session.IDUSUARIO
|
|
|
+ )
|
|
|
+ );
|
|
|
this.cargarTabla(aux_response);
|
|
|
this.filtroEstatus();
|
|
|
-
|
|
|
+
|
|
|
break;
|
|
|
case 'Todos':
|
|
|
await lastValueFrom(this.__mesmreService.consultarTodos()).then(
|
|
|
@@ -340,7 +335,8 @@ export class MESMREComponent implements AfterViewInit {
|
|
|
} else {
|
|
|
aux_response = res.response;
|
|
|
}
|
|
|
- }, (error) => {
|
|
|
+ },
|
|
|
+ (error) => {
|
|
|
if (!error.ok) {
|
|
|
this._validationService.openSnackBar(
|
|
|
'Ocurrió un error inesperado'
|
|
|
@@ -354,7 +350,7 @@ export class MESMREComponent implements AfterViewInit {
|
|
|
}
|
|
|
}
|
|
|
);
|
|
|
-
|
|
|
+
|
|
|
this.cargarTabla(aux_response);
|
|
|
this.filtroEstatus();
|
|
|
|
|
|
@@ -373,7 +369,10 @@ export class MESMREComponent implements AfterViewInit {
|
|
|
|
|
|
async filtroEmpleados(empleado: MESMREInterface) {
|
|
|
//Se hace un split al primer parentesis, se obtiene la segunda posicion y se elimna el segundo parentesis
|
|
|
- if (empleado.NOMBREEMPLEADO.includes('(') && empleado.NOMBREEMPLEADO.includes(')')) {
|
|
|
+ if (
|
|
|
+ empleado.NOMBREEMPLEADO.includes('(') &&
|
|
|
+ empleado.NOMBREEMPLEADO.includes(')')
|
|
|
+ ) {
|
|
|
let usuario = empleado.NOMBREEMPLEADO.split('(')[1].replace(')', '');
|
|
|
let aux_response: any;
|
|
|
|
|
|
@@ -387,7 +386,7 @@ export class MESMREComponent implements AfterViewInit {
|
|
|
);
|
|
|
} else {
|
|
|
this.tipoSolicitud = usuario;
|
|
|
- aux_response = res.response
|
|
|
+ aux_response = res.response;
|
|
|
}
|
|
|
},
|
|
|
(error) => {
|
|
|
@@ -402,11 +401,10 @@ export class MESMREComponent implements AfterViewInit {
|
|
|
}
|
|
|
}
|
|
|
);
|
|
|
-
|
|
|
+
|
|
|
this.obtenerPeriodos(usuario);
|
|
|
this.cargarTabla(aux_response);
|
|
|
this.filtroEstatus();
|
|
|
-
|
|
|
} else {
|
|
|
//No cargo los datos del id
|
|
|
this._validationService.openSnackBar(
|
|
|
@@ -690,7 +688,6 @@ export class MESMREComponent implements AfterViewInit {
|
|
|
this.dataSource = new MatTableDataSource<MESMREInterface>(this.solicitudes);
|
|
|
this.selection = new SelectionModel<MESMREInterface>(true, solicitudes);
|
|
|
|
|
|
-
|
|
|
this.dataSource.filterPredicate = function (
|
|
|
data: MESMREInterface,
|
|
|
filter: string
|
|
|
@@ -738,7 +735,7 @@ export class MESMREComponent implements AfterViewInit {
|
|
|
solicitud.FECHAFIN = this.formatoFecha(solicitud.FECHAFIN);
|
|
|
|
|
|
solicitud.NUMERODIAS =
|
|
|
- solicitud.VACACIONESANTES - solicitud.VACACIONESDESPUES;
|
|
|
+ solicitud.VACACIONESANTES - solicitud.VACACIONESDESPUES;
|
|
|
|
|
|
return {
|
|
|
IDSOLICITUD: solicitud.IDSOLICITUD,
|
|
|
@@ -754,7 +751,6 @@ export class MESMREComponent implements AfterViewInit {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-
|
|
|
applyFilter(filterValue: any) {
|
|
|
this.dataSource.filter = filterValue.target.value.trim().toLowerCase();
|
|
|
}
|