From 0eec5f765dbd450802014e0bb5fa637e35ab30a5 Mon Sep 17 00:00:00 2001 From: Eduardo Quiros Date: Sun, 18 Jul 2021 12:44:37 -0600 Subject: [PATCH 01/17] corregir typo en password reset --- .../password-reset/init/password-reset-init.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/webapp/app/account/password-reset/init/password-reset-init.component.html b/src/main/webapp/app/account/password-reset/init/password-reset-init.component.html index d996676..59e46d4 100644 --- a/src/main/webapp/app/account/password-reset/init/password-reset-init.component.html +++ b/src/main/webapp/app/account/password-reset/init/password-reset-init.component.html @@ -15,7 +15,7 @@ style="color: #727070; font-weight: 700; font-size: 1.3rem" jhiTranslate="reset.request.title" > - RESET YOUR PASSWORDD + RESET YOUR PASSWORD

Enter the email address you used to register. From da8c8e5039fbeb680e8e171c5f9170d8236e673b Mon Sep 17 00:00:00 2001 From: Eduardo Quiros Date: Sun, 18 Jul 2021 12:45:02 -0600 Subject: [PATCH 02/17] quitar iconos de modificacion --- .../entities/categoria/update/categoria-update.component.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/webapp/app/entities/categoria/update/categoria-update.component.html b/src/main/webapp/app/entities/categoria/update/categoria-update.component.html index 289ccb3..7bd40a1 100644 --- a/src/main/webapp/app/entities/categoria/update/categoria-update.component.html +++ b/src/main/webapp/app/entities/categoria/update/categoria-update.component.html @@ -49,7 +49,7 @@ class="btn btn-secondary ds-btn ds-btn-secondary" (click)="previousState()" > -  Cancel +  Cancel From 08a88c750ae856c2ba3797e88d321762ca95243c Mon Sep 17 00:00:00 2001 From: Eduardo Quiros Date: Sun, 18 Jul 2021 12:46:07 -0600 Subject: [PATCH 03/17] mostrar nombre de categoria en dialogo de confirmacion para eliminar --- .../categoria/delete/categoria-delete-dialog.component.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.html b/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.html index 0289904..051d8fe 100644 --- a/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.html +++ b/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.html @@ -8,7 +8,11 @@

From e2f59ac3bcdc8062ffce6c76fbb09a0cd4067c30 Mon Sep 17 00:00:00 2001 From: Eduardo Quiros Date: Sun, 18 Jul 2021 17:42:31 -0600 Subject: [PATCH 04/17] =?UTF-8?q?centrar=20texto=20de=20di=C3=A1logo=20de?= =?UTF-8?q?=20confirmaci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../categoria/delete/categoria-delete-dialog.component.html | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.html b/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.html index 051d8fe..f08fadc 100644 --- a/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.html +++ b/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.html @@ -12,6 +12,7 @@ id="jhi-delete-categoria-heading" jhiTranslate="dataSurveyApp.categoria.delete.question" [translateValues]="{ nombre: categoria.nombre }" + style="text-align: center" > Are you sure you want to delete this category?

From 50dba9d79ba29af01394aea59f9cea44d4855bd5 Mon Sep 17 00:00:00 2001 From: Eduardo Quiros Date: Sun, 18 Jul 2021 17:48:49 -0600 Subject: [PATCH 05/17] =?UTF-8?q?mostrar=20nombre=20de=20categor=C3=ADas?= =?UTF-8?q?=20en=20mensajes=20de=20confirmaci=C3=B3n=20en=20lugar=20de=20I?= =?UTF-8?q?D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/webapp/i18n/es/categoria.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/webapp/i18n/es/categoria.json b/src/main/webapp/i18n/es/categoria.json index 1a7b898..6809772 100644 --- a/src/main/webapp/i18n/es/categoria.json +++ b/src/main/webapp/i18n/es/categoria.json @@ -9,10 +9,10 @@ "notFound": "Ninguna Categoría encontrada" }, "created": "Una nueva Categoría ha sido creada con el identificador {{ param }}", - "updated": "Una Categoría ha sido actualizado con el identificador {{ param }}", + "updated": "Los datos de la categoría {{ nombre }} han sido actualizados", "deleted": "Una Categoría ha sido eliminado con el identificador {{ param }}", "delete": { - "question": "¿Seguro que quiere eliminar Categoría {{ id }}?" + "question": "¿Seguro que quiere eliminar \"{{ nombre }}\"?" }, "detail": { "title": "Categoría" From a700cd8c46dee0ffb18f72e8417c35b562e03059 Mon Sep 17 00:00:00 2001 From: Eduardo Quiros Date: Sun, 18 Jul 2021 17:49:24 -0600 Subject: [PATCH 06/17] eliminar punto sobrante --- src/main/webapp/i18n/es/categoria.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/webapp/i18n/es/categoria.json b/src/main/webapp/i18n/es/categoria.json index 6809772..04bc510 100644 --- a/src/main/webapp/i18n/es/categoria.json +++ b/src/main/webapp/i18n/es/categoria.json @@ -23,7 +23,7 @@ "encuesta": "Encuesta", "plantilla": "Plantilla", "errors": { - "duplicateName": "Ya existe una categoría con ese nombre." + "duplicateName": "Ya existe una categoría con ese nombre" } } } From 389f24b578a1143de8730a94623eb4f194c6c045 Mon Sep 17 00:00:00 2001 From: Eduardo Quiros Date: Sun, 18 Jul 2021 18:09:29 -0600 Subject: [PATCH 07/17] Revert "Eliminar modulo de vista de categorias" This reverts commit e3e9bb1fc51d2ec26d00c29a99f68ee1b84b8677. --- .../entities/categoria/categoria.module.ts | 3 +- .../detail/categoria-detail.component.html | 36 ++++++++++++++++++ .../detail/categoria-detail.component.spec.ts | 38 +++++++++++++++++++ .../detail/categoria-detail.component.ts | 24 ++++++++++++ .../route/categoria-routing.module.ts | 9 +++++ 5 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 src/main/webapp/app/entities/categoria/detail/categoria-detail.component.html create mode 100644 src/main/webapp/app/entities/categoria/detail/categoria-detail.component.spec.ts create mode 100644 src/main/webapp/app/entities/categoria/detail/categoria-detail.component.ts diff --git a/src/main/webapp/app/entities/categoria/categoria.module.ts b/src/main/webapp/app/entities/categoria/categoria.module.ts index 59f2dd3..96383a6 100644 --- a/src/main/webapp/app/entities/categoria/categoria.module.ts +++ b/src/main/webapp/app/entities/categoria/categoria.module.ts @@ -1,13 +1,14 @@ import { NgModule } from '@angular/core'; import { SharedModule } from 'app/shared/shared.module'; import { CategoriaComponent } from './list/categoria.component'; +import { CategoriaDetailComponent } from './detail/categoria-detail.component'; import { CategoriaUpdateComponent } from './update/categoria-update.component'; import { CategoriaDeleteDialogComponent } from './delete/categoria-delete-dialog.component'; import { CategoriaRoutingModule } from './route/categoria-routing.module'; @NgModule({ imports: [SharedModule, CategoriaRoutingModule], - declarations: [CategoriaComponent, CategoriaUpdateComponent, CategoriaDeleteDialogComponent], + declarations: [CategoriaComponent, CategoriaDetailComponent, CategoriaUpdateComponent, CategoriaDeleteDialogComponent], entryComponents: [CategoriaDeleteDialogComponent], }) export class CategoriaModule {} diff --git a/src/main/webapp/app/entities/categoria/detail/categoria-detail.component.html b/src/main/webapp/app/entities/categoria/detail/categoria-detail.component.html new file mode 100644 index 0000000..9531c6c --- /dev/null +++ b/src/main/webapp/app/entities/categoria/detail/categoria-detail.component.html @@ -0,0 +1,36 @@ +
+
+
+

Categoria

+ +
+ + + + + +
+
ID
+
+ {{ categoria.id }} +
+
Nombre
+
+ {{ categoria.nombre }} +
+
Estado
+
+ {{ categoria.estado }} +
+
+ + + + +
+
+
diff --git a/src/main/webapp/app/entities/categoria/detail/categoria-detail.component.spec.ts b/src/main/webapp/app/entities/categoria/detail/categoria-detail.component.spec.ts new file mode 100644 index 0000000..506ac72 --- /dev/null +++ b/src/main/webapp/app/entities/categoria/detail/categoria-detail.component.spec.ts @@ -0,0 +1,38 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { ActivatedRoute } from '@angular/router'; +import { of } from 'rxjs'; + +import { CategoriaDetailComponent } from './categoria-detail.component'; + +describe('Component Tests', () => { + describe('Categoria Management Detail Component', () => { + let comp: CategoriaDetailComponent; + let fixture: ComponentFixture; + + beforeEach(() => { + TestBed.configureTestingModule({ + declarations: [CategoriaDetailComponent], + providers: [ + { + provide: ActivatedRoute, + useValue: { data: of({ categoria: { id: 123 } }) }, + }, + ], + }) + .overrideTemplate(CategoriaDetailComponent, '') + .compileComponents(); + fixture = TestBed.createComponent(CategoriaDetailComponent); + comp = fixture.componentInstance; + }); + + describe('OnInit', () => { + it('Should load categoria on init', () => { + // WHEN + comp.ngOnInit(); + + // THEN + expect(comp.categoria).toEqual(expect.objectContaining({ id: 123 })); + }); + }); + }); +}); diff --git a/src/main/webapp/app/entities/categoria/detail/categoria-detail.component.ts b/src/main/webapp/app/entities/categoria/detail/categoria-detail.component.ts new file mode 100644 index 0000000..36ecdcf --- /dev/null +++ b/src/main/webapp/app/entities/categoria/detail/categoria-detail.component.ts @@ -0,0 +1,24 @@ +import { Component, OnInit } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; + +import { ICategoria } from '../categoria.model'; + +@Component({ + selector: 'jhi-categoria-detail', + templateUrl: './categoria-detail.component.html', +}) +export class CategoriaDetailComponent implements OnInit { + categoria: ICategoria | null = null; + + constructor(protected activatedRoute: ActivatedRoute) {} + + ngOnInit(): void { + this.activatedRoute.data.subscribe(({ categoria }) => { + this.categoria = categoria; + }); + } + + previousState(): void { + window.history.back(); + } +} diff --git a/src/main/webapp/app/entities/categoria/route/categoria-routing.module.ts b/src/main/webapp/app/entities/categoria/route/categoria-routing.module.ts index 95acd27..d48d560 100644 --- a/src/main/webapp/app/entities/categoria/route/categoria-routing.module.ts +++ b/src/main/webapp/app/entities/categoria/route/categoria-routing.module.ts @@ -3,6 +3,7 @@ import { RouterModule, Routes } from '@angular/router'; import { UserRouteAccessService } from 'app/core/auth/user-route-access.service'; import { CategoriaComponent } from '../list/categoria.component'; +import { CategoriaDetailComponent } from '../detail/categoria-detail.component'; import { CategoriaUpdateComponent } from '../update/categoria-update.component'; import { CategoriaRoutingResolveService } from './categoria-routing-resolve.service'; @@ -12,6 +13,14 @@ const categoriaRoute: Routes = [ component: CategoriaComponent, canActivate: [UserRouteAccessService], }, + { + path: ':id/view', + component: CategoriaDetailComponent, + resolve: { + categoria: CategoriaRoutingResolveService, + }, + canActivate: [UserRouteAccessService], + }, { path: 'new', component: CategoriaUpdateComponent, From 42f1b2eeff5b179d1c2b5aeb859ec599713ff222 Mon Sep 17 00:00:00 2001 From: Eduardo Quiros Date: Sun, 18 Jul 2021 20:54:27 -0600 Subject: [PATCH 08/17] =?UTF-8?q?dejar=20de=20forzar=20la=20adici=C3=B3n?= =?UTF-8?q?=20de=20"Otra"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../delete/categoria-delete-dialog.component.ts | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.ts b/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.ts index 14225df..bf4e321 100644 --- a/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.ts +++ b/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.ts @@ -26,7 +26,6 @@ export class CategoriaDeleteDialogComponent { } confirmDelete(categoria: ICategoria): void { - this.ensureNulaExists(); const categoriaNula = new Categoria(0, 'Otra', EstadoCategoria.ACTIVE); this.getEncuestas(categoria); if (this.encuestas) { @@ -40,15 +39,6 @@ export class CategoriaDeleteDialogComponent { this.activeModal.close('deleted'); }); } - ensureNulaExists(): void { - const categoriaNula = new Categoria(0, 'Otra', EstadoCategoria.ACTIVE); - const categoria = this.categoriaService.find(0); - if (categoria) { - this.categoriaService.update(categoriaNula); - } else { - this.categoriaService.create(categoriaNula); - } - } protected getEncuestas(categoria: ICategoria): void { this.encuestaService.query().subscribe(res => { From 1d75fb6960e1a6804e5302ed6f27ec803e4b021e Mon Sep 17 00:00:00 2001 From: Eduardo Quiros Date: Sun, 18 Jul 2021 20:56:53 -0600 Subject: [PATCH 09/17] =?UTF-8?q?deshabilitar=20funciones=20de=20modificac?= =?UTF-8?q?i=C3=B3n=20para=20la=20categor=C3=ADa=20nula?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../categoria/detail/categoria-detail.component.html | 11 ++++++++--- .../entities/categoria/list/categoria.component.html | 12 +++++------- .../categoria/update/categoria-update.component.html | 1 + .../categoria/update/categoria-update.component.ts | 2 ++ 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/main/webapp/app/entities/categoria/detail/categoria-detail.component.html b/src/main/webapp/app/entities/categoria/detail/categoria-detail.component.html index 9531c6c..51877e5 100644 --- a/src/main/webapp/app/entities/categoria/detail/categoria-detail.component.html +++ b/src/main/webapp/app/entities/categoria/detail/categoria-detail.component.html @@ -25,11 +25,16 @@ - diff --git a/src/main/webapp/app/entities/categoria/list/categoria.component.html b/src/main/webapp/app/entities/categoria/list/categoria.component.html index 7933f24..5042460 100644 --- a/src/main/webapp/app/entities/categoria/list/categoria.component.html +++ b/src/main/webapp/app/entities/categoria/list/categoria.component.html @@ -40,9 +40,9 @@ - {{ categoria.nombre }} - {{ categoria.estado }} - + {{ categoria.nombre }} + {{ categoria.estado }} +
-
diff --git a/src/main/webapp/app/entities/categoria/update/categoria-update.component.html b/src/main/webapp/app/entities/categoria/update/categoria-update.component.html index 7bd40a1..827ff29 100644 --- a/src/main/webapp/app/entities/categoria/update/categoria-update.component.html +++ b/src/main/webapp/app/entities/categoria/update/categoria-update.component.html @@ -53,6 +53,7 @@ diff --git a/src/main/webapp/i18n/es/categoria.json b/src/main/webapp/i18n/es/categoria.json index 04bc510..31f6767 100644 --- a/src/main/webapp/i18n/es/categoria.json +++ b/src/main/webapp/i18n/es/categoria.json @@ -4,15 +4,15 @@ "home": { "title": "Categorías", "refreshListLabel": "Refrescar lista", - "createLabel": "Crear nueva Categoría", - "createOrEditLabel": "Datos de Categoría", - "notFound": "Ninguna Categoría encontrada" + "createLabel": "Crear nueva categoría", + "createOrEditLabel": "Datos de categoría", + "notFound": "Ninguna categoría encontrada" }, - "created": "Una nueva Categoría ha sido creada con el identificador {{ param }}", + "created": "Una nueva categoría ha sido creada con el identificador {{ param }}", "updated": "Los datos de la categoría {{ nombre }} han sido actualizados", - "deleted": "Una Categoría ha sido eliminado con el identificador {{ param }}", + "deleted": "La categoría {{ nombre }} ha sido deshabilitada", "delete": { - "question": "¿Seguro que quiere eliminar \"{{ nombre }}\"?" + "question": "¿Seguro que quiere cambiar el estado de \"{{ nombre }}\"?" }, "detail": { "title": "Categoría" From aa2f31208ef34b630330add6e0081868aec4f4c3 Mon Sep 17 00:00:00 2001 From: Eduardo Quiros Date: Sun, 18 Jul 2021 21:40:55 -0600 Subject: [PATCH 12/17] cargar encuestas desde el inicio --- .../categoria/delete/categoria-delete-dialog.component.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.ts b/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.ts index a4a63ba..9e35456 100644 --- a/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.ts +++ b/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.ts @@ -19,7 +19,9 @@ export class CategoriaDeleteDialogComponent { protected categoriaService: CategoriaService, protected activeModal: NgbActiveModal, protected encuestaService: EncuestaService - ) {} + ) { + this.getEncuestas(); + } cancel(): void { this.activeModal.dismiss(); From e0728e27cdf838e1b0a669479fa10a3a757a3391 Mon Sep 17 00:00:00 2001 From: Eduardo Quiros Date: Sun, 18 Jul 2021 21:41:26 -0600 Subject: [PATCH 13/17] solamente cargar encuestas --- .../delete/categoria-delete-dialog.component.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.ts b/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.ts index 9e35456..bf63638 100644 --- a/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.ts +++ b/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.ts @@ -29,13 +29,8 @@ export class CategoriaDeleteDialogComponent { confirmDelete(categoria: ICategoria): void { const categoriaNula = new Categoria(0, 'Otra', EstadoCategoria.ACTIVE); - this.getEncuestas(categoria); - if (this.encuestas) { - this.encuestas!.forEach(encuesta => { - encuesta.categoria = categoriaNula; - this.encuestaService.update(encuesta); - }); - } + this.getEncuestas(); + debugger; if (categoria.estado == EstadoCategoria.INACTIVE) { categoria.estado = EstadoCategoria.ACTIVE; } else { @@ -46,7 +41,7 @@ export class CategoriaDeleteDialogComponent { }); } - protected getEncuestas(categoria: ICategoria): void { + getEncuestas(): void { this.encuestaService.query().subscribe(res => { this.encuestas = res.body ?? []; }); From 5dfce2c2a970293fba86b48154b2cc37741de9fd Mon Sep 17 00:00:00 2001 From: Eduardo Quiros Date: Sun, 18 Jul 2021 21:41:51 -0600 Subject: [PATCH 14/17] modificar solamente encuestas que coincidan --- .../delete/categoria-delete-dialog.component.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.ts b/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.ts index bf63638..910cd35 100644 --- a/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.ts +++ b/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.ts @@ -34,6 +34,13 @@ export class CategoriaDeleteDialogComponent { if (categoria.estado == EstadoCategoria.INACTIVE) { categoria.estado = EstadoCategoria.ACTIVE; } else { + this.encuestas!.forEach(encuesta => { + debugger; + if (encuesta.categoria != null && encuesta.categoria!.id === categoria.id) { + encuesta.categoria = categoriaNula; + this.encuestaService.update(encuesta); + } + }); categoria.estado = EstadoCategoria.INACTIVE; } this.categoriaService.update(categoria).subscribe(() => { @@ -45,10 +52,5 @@ export class CategoriaDeleteDialogComponent { this.encuestaService.query().subscribe(res => { this.encuestas = res.body ?? []; }); - if (this.encuestas) { - this.encuestasFiltradas = this.encuestas.filter(encuesta => { - encuesta.categoria!.id === categoria.id; - }); - } } } From 2e25dd8c2b60cae243857123cce5030cca32502c Mon Sep 17 00:00:00 2001 From: Eduardo Quiros Date: Sun, 18 Jul 2021 21:51:06 -0600 Subject: [PATCH 15/17] eliminar debugger --- .../categoria/delete/categoria-delete-dialog.component.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.ts b/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.ts index 910cd35..3bde63b 100644 --- a/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.ts +++ b/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.ts @@ -35,7 +35,6 @@ export class CategoriaDeleteDialogComponent { categoria.estado = EstadoCategoria.ACTIVE; } else { this.encuestas!.forEach(encuesta => { - debugger; if (encuesta.categoria != null && encuesta.categoria!.id === categoria.id) { encuesta.categoria = categoriaNula; this.encuestaService.update(encuesta); From 6ea08bacd4fc0d0e763799c079f0ab9230118d82 Mon Sep 17 00:00:00 2001 From: Eduardo Quiros Date: Sun, 18 Jul 2021 21:56:20 -0600 Subject: [PATCH 16/17] =?UTF-8?q?arreglar=20actualizaci=C3=B3n=20de=20encu?= =?UTF-8?q?estas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../categoria-delete-dialog.component.ts | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.ts b/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.ts index 3bde63b..dbfee06 100644 --- a/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.ts +++ b/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.ts @@ -1,8 +1,11 @@ +import { HttpResponse } from '@angular/common/http'; import { Component } from '@angular/core'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { IEncuesta } from 'app/entities/encuesta/encuesta.model'; import { EncuestaService } from 'app/entities/encuesta/service/encuesta.service'; import { EstadoCategoria } from 'app/entities/enumerations/estado-categoria.model'; +import { Observable } from 'rxjs'; +import { finalize, map } from 'rxjs/operators'; import { Categoria, ICategoria } from '../categoria.model'; import { CategoriaService } from '../service/categoria.service'; @@ -37,7 +40,7 @@ export class CategoriaDeleteDialogComponent { this.encuestas!.forEach(encuesta => { if (encuesta.categoria != null && encuesta.categoria!.id === categoria.id) { encuesta.categoria = categoriaNula; - this.encuestaService.update(encuesta); + this.subscribeToSaveResponse(this.encuestaService.update(encuesta)); } }); categoria.estado = EstadoCategoria.INACTIVE; @@ -52,4 +55,23 @@ export class CategoriaDeleteDialogComponent { this.encuestas = res.body ?? []; }); } + + protected subscribeToSaveResponse(result: Observable>): void { + result.pipe(finalize(() => this.onSaveFinalize())).subscribe( + () => this.onSaveSuccess(), + () => this.onSaveError() + ); + } + + protected onSaveFinalize(): void { + // this.isSaving = false; + } + + protected onSaveSuccess(): void { + // this.previousState(); + } + + protected onSaveError(): void { + // Api for inheritance. + } } From 017d6bd69b847fa1785b0587509c0ade6adae284 Mon Sep 17 00:00:00 2001 From: Eduardo Quiros Date: Sun, 18 Jul 2021 21:57:44 -0600 Subject: [PATCH 17/17] eliminar debugger faltante --- .../categoria/delete/categoria-delete-dialog.component.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.ts b/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.ts index dbfee06..df89d70 100644 --- a/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.ts +++ b/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.ts @@ -33,7 +33,6 @@ export class CategoriaDeleteDialogComponent { confirmDelete(categoria: ICategoria): void { const categoriaNula = new Categoria(0, 'Otra', EstadoCategoria.ACTIVE); this.getEncuestas(); - debugger; if (categoria.estado == EstadoCategoria.INACTIVE) { categoria.estado = EstadoCategoria.ACTIVE; } else {