|
|
@@ -24,7 +24,7 @@ export class PreventiveMaintenanceComponent implements OnInit {
|
|
|
private _encService: EncService,
|
|
|
private _modulesService: ModulesService,
|
|
|
private _dialog: MatDialog,
|
|
|
- private router: Router,
|
|
|
+ private _router: Router,
|
|
|
private _snackBar: MatSnackBar,
|
|
|
) {
|
|
|
this.isLoading = true;
|
|
|
@@ -58,65 +58,39 @@ export class PreventiveMaintenanceComponent implements OnInit {
|
|
|
this.submodules = submodules.response;
|
|
|
}
|
|
|
}catch(error: any){
|
|
|
- this.isLoading = false;
|
|
|
- this.hasError = true;
|
|
|
-
|
|
|
- let msg = "";
|
|
|
if(error.error == undefined){
|
|
|
- msg = "Ocurrió un error inesperado.";
|
|
|
+ this.errorStr = "Ocurrió un error inesperado.";
|
|
|
+ }else if(error.error.msg == undefined){
|
|
|
+ this.errorStr = "Ocurrió un error inesperado.";
|
|
|
}else{
|
|
|
- msg = error.error.msg;
|
|
|
+ this.errorStr = error.error.msg;
|
|
|
}
|
|
|
|
|
|
- this.errorStr = msg;
|
|
|
+ this.hasError = true;
|
|
|
+ this.isLoading = false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- async openMenu(submodule: Submodules){
|
|
|
- try{
|
|
|
- let idUser = localStorage.getItem('idusuario');
|
|
|
- let shortEnc = await lastValueFrom(this._encService.shortEncrypt(idUser!));
|
|
|
-
|
|
|
- let modEnc = await this._encService.encrypt('S002V01M10GMPR');
|
|
|
- let modShort = await lastValueFrom(this._encService.shortEncrypt(modEnc));
|
|
|
-
|
|
|
- let subEnc = await this._encService.encrypt(submodule.IDSUBMODULO);
|
|
|
- let subShort = await lastValueFrom(this._encService.shortEncrypt(subEnc));
|
|
|
-
|
|
|
- let submoduleFunctions: SubmoduleFunctionsResponse = await lastValueFrom(this._modulesService.getSubmoduleFunctions(
|
|
|
- modShort.response.encrypted,
|
|
|
- subShort.response.encrypted,
|
|
|
- shortEnc.response.encrypted,
|
|
|
- 1
|
|
|
- ));
|
|
|
-
|
|
|
- let dialogRef = this._dialog.open(SubmoduleFunctionsComponent, {
|
|
|
- width: '560px',
|
|
|
- data: {
|
|
|
- FUNCIONES: submoduleFunctions.response,
|
|
|
- },
|
|
|
- });
|
|
|
-
|
|
|
- dialogRef.afterClosed().subscribe(res => {
|
|
|
- if(res != null && res != undefined && res != ""){
|
|
|
- let idFunc = res.IDFUNCION.replace("S002V01F", "");
|
|
|
- idFunc = idFunc.substring(2);
|
|
|
-
|
|
|
- let idSub = submodule.IDSUBMODULO.replace("S002V01S", "");
|
|
|
- idSub = idSub.substring(2);
|
|
|
+ openMenu(submodule: Submodules){
|
|
|
+ let dialogRef = this._dialog.open(SubmoduleFunctionsComponent, {
|
|
|
+ width: '560px',
|
|
|
+ data: {
|
|
|
+ module: 'S002V01M10GMPR',
|
|
|
+ submodule: submodule.IDSUBMODULO,
|
|
|
+ },
|
|
|
+ });
|
|
|
+
|
|
|
+ dialogRef.afterClosed().subscribe(res => {
|
|
|
+ if(res != null && res != undefined && res != ""){
|
|
|
+ let idFunc = res.IDFUNCION.replace("S002V01F", "");
|
|
|
+ idFunc = idFunc.substring(2);
|
|
|
+
|
|
|
+ let idSub = submodule.IDSUBMODULO.replace("S002V01S", "");
|
|
|
+ idSub = idSub.substring(2);
|
|
|
|
|
|
- this.router.navigate([`sam/GMPR/${idSub}/${idFunc}`]);
|
|
|
- }
|
|
|
- });
|
|
|
- }catch(error: any){
|
|
|
- if(error.error == undefined){
|
|
|
- this.openSnackBar('Ocurrió un error inesperado.');
|
|
|
- }else if(error.error.msg == undefined){
|
|
|
- this.openSnackBar('Ocurrió un error inesperado.');
|
|
|
- }else{
|
|
|
- this.openSnackBar(error.error.msg);
|
|
|
+ this._router.navigate([`sam/GMPR/${idSub}/${idFunc}`]);
|
|
|
}
|
|
|
- }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
openSnackBar(msg: string){
|