From d2fd23675a26b5bdd56185190d94935944518f2f Mon Sep 17 00:00:00 2001 From: Pablo Bonilla Date: Thu, 22 Jul 2021 21:47:11 -0600 Subject: [PATCH] Add delete open question from edit survey --- .../encuesta/update/encuesta-update.component.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/webapp/app/entities/encuesta/update/encuesta-update.component.ts b/src/main/webapp/app/entities/encuesta/update/encuesta-update.component.ts index 7a6c92d..3799c3e 100644 --- a/src/main/webapp/app/entities/encuesta/update/encuesta-update.component.ts +++ b/src/main/webapp/app/entities/encuesta/update/encuesta-update.component.ts @@ -1,3 +1,4 @@ +import { EPreguntaAbiertaService } from './../../e-pregunta-abierta/service/e-pregunta-abierta.service'; import { EPreguntaCerradaOpcionService } from './../../e-pregunta-cerrada-opcion/service/e-pregunta-cerrada-opcion.service'; import { AfterViewChecked, Component, OnInit } from '@angular/core'; import { HttpResponse } from '@angular/common/http'; @@ -65,7 +66,8 @@ export class EncuestaUpdateComponent implements OnInit, AfterViewChecked { protected fb: FormBuilder, protected modalService: NgbModal, protected ePreguntaCerradaService: EPreguntaCerradaService, - protected ePreguntaCerradaOpcionService: EPreguntaCerradaOpcionService + protected ePreguntaCerradaOpcionService: EPreguntaCerradaOpcionService, + protected ePreguntaAbiertaService: EPreguntaAbiertaService ) {} loadAll(): void { @@ -156,7 +158,6 @@ export class EncuestaUpdateComponent implements OnInit, AfterViewChecked { const id = event.target.dataset.id; if (event.target.dataset.type) { // Delete closed question - console.log('closed', id); const questionElement = (event.target as HTMLElement).parentElement?.parentElement; const optionIdsToDelete: number[] = []; @@ -173,13 +174,16 @@ export class EncuestaUpdateComponent implements OnInit, AfterViewChecked { this.ePreguntaCerradaOpcionService.deleteMany(optionIdsToDelete).subscribe(e => { // Delete question this.ePreguntaCerradaService.delete(id).subscribe(e => { - console.log('DELETED QUESTION: ' + id); + console.log('DELETED CLOSED QUESTION: ' + id); this.loadAll(); }); }); } else { // Delete open question - console.log('open', id); + this.ePreguntaAbiertaService.delete(id).subscribe(e => { + console.log('DELETED OPEN QUESTION: ' + id); + this.loadAll(); + }); } }