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.
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/delete/categoria-delete-dialog.component.html b/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.html
index 0289904..9c1ee95 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,18 +8,23 @@
-
- Are you sure you want to delete this category?
+
+ Are you sure you want to toggle this category's status?
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..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
@@ -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';
@@ -19,45 +22,55 @@ export class CategoriaDeleteDialogComponent {
protected categoriaService: CategoriaService,
protected activeModal: NgbActiveModal,
protected encuestaService: EncuestaService
- ) {}
+ ) {
+ this.getEncuestas();
+ }
cancel(): void {
this.activeModal.dismiss();
}
confirmDelete(categoria: ICategoria): void {
- this.ensureNulaExists();
const categoriaNula = new Categoria(0, 'Otra', EstadoCategoria.ACTIVE);
- this.getEncuestas(categoria);
- if (this.encuestas) {
+ this.getEncuestas();
+ if (categoria.estado == EstadoCategoria.INACTIVE) {
+ categoria.estado = EstadoCategoria.ACTIVE;
+ } else {
this.encuestas!.forEach(encuesta => {
- encuesta.categoria = categoriaNula;
- this.encuestaService.update(encuesta);
+ if (encuesta.categoria != null && encuesta.categoria!.id === categoria.id) {
+ encuesta.categoria = categoriaNula;
+ this.subscribeToSaveResponse(this.encuestaService.update(encuesta));
+ }
});
+ categoria.estado = EstadoCategoria.INACTIVE;
}
- categoria.estado = EstadoCategoria.INACTIVE;
this.categoriaService.update(categoria).subscribe(() => {
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 {
+ getEncuestas(): void {
this.encuestaService.query().subscribe(res => {
this.encuestas = res.body ?? [];
});
- if (this.encuestas) {
- this.encuestasFiltradas = this.encuestas.filter(encuesta => {
- encuesta.categoria!.id === categoria.id;
- });
- }
+ }
+
+ protected subscribeToSaveResponse(result: Observable