Jelajahi Sumber

Merge branch 'master' of http://209.50.56.224/git/ITTEC/SistemaIntegralRecursosHumanos

Alan Garcia 3 tahun lalu
induk
melakukan
42941dbb74

+ 4 - 5
vacaciones/src/app/components/mes/mesmcc/mesmcc.component.ts

@@ -26,7 +26,8 @@ export class MESMCCComponent implements OnInit {
   constructor(
     private _mesmccService: MESMCCService,
     public dialog: MatDialog,
-    private _encService: ENCService
+    private _encService: ENCService,
+    private _iamService: IAMService
   ) {
     this.formGroup = this.createFormGroup();
   }
@@ -68,8 +69,8 @@ export class MESMCCComponent implements OnInit {
       password += chars.substring(randomNumber, randomNumber + 1);
     }
 
-    this.new_password?.setValue("Tmk#"+password+"0");
-    this.new_password_confirmation?.setValue("Tmk#"+password+"0");
+    this.new_password?.setValue('Tmk#' + password + '0');
+    this.new_password_confirmation?.setValue('Tmk#' + password + '0');
   }
 
   openDialogForm(item: any = {}) {
@@ -100,6 +101,4 @@ export class MESMCCComponent implements OnInit {
   get new_password_confirmation() {
     return this.formGroup.get('new_password_confirmation');
   }
-
-  
 }

+ 6 - 5
vacaciones/src/app/components/resources/dialogos/alerta/alerta.component.html

@@ -3,12 +3,13 @@
     <div mat-dialog-content>
         <h3>{{ data.descripcion }}</h3>
         <div class="centre">
-            <button mat-raised-button [mat-dialog-close]="false" color="warn" class="mr-2">
-        Cancelar
-      </button>
+            <button mat-raised-button [mat-dialog-close]="false" color="warn" class="mr-2"
+                *ngIf="data.titulo !='Cambio de contraseña'">
+                Cancelar
+            </button>
             <button mat-raised-button class="secondary" [mat-dialog-close]="true">
-        Confirmar
-      </button>
+                Confirmar
+            </button>
         </div>
     </div>
 </div>

+ 29 - 3
vacaciones/src/app/services/mes/mesmcc/mesmcc.service.ts

@@ -5,6 +5,8 @@ import { catchError, map } from 'rxjs';
 import { ResponseData } from 'src/app/interfaces/response-data';
 import { MESMCCInterface } from '../../../interfaces/mes/mesmcc/mesmcc-interface';
 import { IAMService } from '../../iam/iam.service';
+import { AlertaComponent } from 'src/app/components/resources/dialogos/alerta/alerta.component';
+import { MatDialog } from '@angular/material/dialog';
 
 @Injectable({
   providedIn: 'root',
@@ -17,7 +19,8 @@ export class MESMCCService {
   constructor(
     private _http: HttpClient,
     private _snackBar: MatSnackBar,
-    private _iamService: IAMService
+    private _iamService: IAMService,
+    public dialog: MatDialog
   ) {}
 
   actualizarContrasena(data: MESMCCInterface) {
@@ -28,8 +31,10 @@ export class MESMCCService {
       .subscribe(
         (res) => {
           if (!res.error) {
-            this._iamService.logout();
-            this.snackAlert('¡Contraseña Cambiada! Ingrese sus credenciales de acceso de nuevo');
+            this.snackAlert(
+              '¡Contraseña Cambiada! Ingrese sus credenciales de acceso de nuevo'
+            );
+            this.openDialog(null, '');
           } else {
             this.snackAlert(res.msg);
           }
@@ -53,4 +58,25 @@ export class MESMCCService {
       duration: 4000,
     });
   }
+
+  openDialog(item: any, action: String) {
+    let dataAction = {};
+
+    dataAction = {
+      titulo: 'Cambio de contraseña',
+      descripcion: `La contraseña fue cambiada, se realizar el cierre de sesión para volver a confirmar los datos.`,
+    };
+
+    const dialogRef = this.dialog.open(AlertaComponent, {
+      data: dataAction,
+      disableClose: true,
+    });
+
+    dialogRef.afterClosed().subscribe((result) => {
+      if (result) {
+        //this.eliminar(item);
+        this._iamService.logout();
+      }
+    });
+  }
 }