Add delete option confirmation dialog
This commit is contained in:
		
							parent
							
								
									0932e0c7b6
								
							
						
					
					
						commit
						28b291d031
					
				| 
						 | 
				
			
			@ -0,0 +1,25 @@
 | 
			
		|||
<form name="deleteForm" (ngSubmit)="confirmDelete()">
 | 
			
		||||
  <div class="modal-header">
 | 
			
		||||
    <h4 class="modal-title" data-cy="encuestaDeleteDialogHeading" jhiTranslate="entity.delete.title">Confirm delete operation</h4>
 | 
			
		||||
 | 
			
		||||
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true" (click)="cancel()">×</button>
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
  <div class="modal-body">
 | 
			
		||||
    <jhi-alert-error></jhi-alert-error>
 | 
			
		||||
 | 
			
		||||
    <p id="jhi-delete-encuesta-heading" jhiTranslate="dataSurveyApp.encuesta.delete.deleteoption">
 | 
			
		||||
      Are you sure you want to delete this option?
 | 
			
		||||
    </p>
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
  <div class="modal-footer">
 | 
			
		||||
    <button type="button" class="btn btn-secondary" data-dismiss="modal" (click)="cancel()">
 | 
			
		||||
      <fa-icon icon="ban"></fa-icon> <span jhiTranslate="entity.action.cancel">Cancel</span>
 | 
			
		||||
    </button>
 | 
			
		||||
 | 
			
		||||
    <button id="jhi-confirm-delete-encuesta" data-cy="entityConfirmDeleteButton" type="submit" class="btn btn-danger">
 | 
			
		||||
      <fa-icon icon="times"></fa-icon> <span jhiTranslate="entity.action.delete">Delete</span>
 | 
			
		||||
    </button>
 | 
			
		||||
  </div>
 | 
			
		||||
</form>
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
import { Component } from '@angular/core';
 | 
			
		||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
 | 
			
		||||
 | 
			
		||||
@Component({
 | 
			
		||||
  templateUrl: './encuesta-delete-option-dialog.component.html',
 | 
			
		||||
})
 | 
			
		||||
export class EncuestaDeleteOptionDialogComponent {
 | 
			
		||||
  constructor(protected activeModal: NgbActiveModal) {}
 | 
			
		||||
 | 
			
		||||
  cancel(): void {
 | 
			
		||||
    this.activeModal.dismiss();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  confirmDelete(): void {
 | 
			
		||||
    this.activeModal.close('confirm');
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -7,7 +7,8 @@ import { EncuestaDeleteDialogComponent } from './delete/encuesta-delete-dialog.c
 | 
			
		|||
import { EncuestaRoutingModule } from './route/encuesta-routing.module';
 | 
			
		||||
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
 | 
			
		||||
import { EncuestaPublishDialogComponent } from './encuesta-publish-dialog/encuesta-publish-dialog.component';
 | 
			
		||||
import { EncuestaDeleteQuestionDialogComponent } from './encuesta-delete-dialog/encuesta-delete-question-dialog.component';
 | 
			
		||||
import { EncuestaDeleteQuestionDialogComponent } from './encuesta-delete-question-dialog/encuesta-delete-question-dialog.component';
 | 
			
		||||
import { EncuestaDeleteOptionDialogComponent } from './encuesta-delete-option-dialog/encuesta-delete-option-dialog.component';
 | 
			
		||||
 | 
			
		||||
@NgModule({
 | 
			
		||||
  imports: [SharedModule, EncuestaRoutingModule, FontAwesomeModule],
 | 
			
		||||
| 
						 | 
				
			
			@ -18,6 +19,7 @@ import { EncuestaDeleteQuestionDialogComponent } from './encuesta-delete-dialog/
 | 
			
		|||
    EncuestaDeleteDialogComponent,
 | 
			
		||||
    EncuestaPublishDialogComponent,
 | 
			
		||||
    EncuestaDeleteQuestionDialogComponent,
 | 
			
		||||
    EncuestaDeleteOptionDialogComponent,
 | 
			
		||||
  ],
 | 
			
		||||
  entryComponents: [EncuestaDeleteDialogComponent],
 | 
			
		||||
})
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,3 @@
 | 
			
		|||
import { EncuestaDeleteQuestionDialogComponent } from './../encuesta-delete-dialog/encuesta-delete-question-dialog.component';
 | 
			
		||||
import { EPreguntaCerrada } from './../../e-pregunta-cerrada/e-pregunta-cerrada.model';
 | 
			
		||||
import { EPreguntaCerradaOpcion, IEPreguntaCerradaOpcion } from './../../e-pregunta-cerrada-opcion/e-pregunta-cerrada-opcion.model';
 | 
			
		||||
import { EPreguntaAbiertaService } from './../../e-pregunta-abierta/service/e-pregunta-abierta.service';
 | 
			
		||||
| 
						 | 
				
			
			@ -27,6 +26,9 @@ import { EPreguntaCerradaDeleteDialogComponent } from 'app/entities/e-pregunta-c
 | 
			
		|||
 | 
			
		||||
import { faTimes, faPlus } from '@fortawesome/free-solid-svg-icons';
 | 
			
		||||
import { PreguntaCerradaTipo } from 'app/entities/enumerations/pregunta-cerrada-tipo.model';
 | 
			
		||||
import { EncuestaDeleteQuestionDialogComponent } from '../encuesta-delete-question-dialog/encuesta-delete-question-dialog.component';
 | 
			
		||||
import { EncuestaDeleteOptionDialogComponent } from '../encuesta-delete-option-dialog/encuesta-delete-option-dialog.component';
 | 
			
		||||
 | 
			
		||||
@Component({
 | 
			
		||||
  selector: 'jhi-encuesta-update',
 | 
			
		||||
  templateUrl: './encuesta-update.component.html',
 | 
			
		||||
| 
						 | 
				
			
			@ -232,11 +234,16 @@ export class EncuestaUpdateComponent implements OnInit, AfterViewChecked {
 | 
			
		|||
  }
 | 
			
		||||
 | 
			
		||||
  deleteOption(event: any): void {
 | 
			
		||||
    const id = event.target.dataset.optionid;
 | 
			
		||||
    this.ePreguntaCerradaOpcionService.delete(id).subscribe(e => {
 | 
			
		||||
      this.ePreguntas = [];
 | 
			
		||||
      this.ePreguntasOpciones = [];
 | 
			
		||||
      this.loadAll();
 | 
			
		||||
    const modalRef = this.modalService.open(EncuestaDeleteOptionDialogComponent, { size: 'lg', backdrop: 'static' });
 | 
			
		||||
    modalRef.closed.subscribe(reason => {
 | 
			
		||||
      if (reason === 'confirm') {
 | 
			
		||||
        const id = event.target.dataset.optionid;
 | 
			
		||||
        this.ePreguntaCerradaOpcionService.delete(id).subscribe(e => {
 | 
			
		||||
          this.ePreguntas = [];
 | 
			
		||||
          this.ePreguntasOpciones = [];
 | 
			
		||||
          this.loadAll();
 | 
			
		||||
        });
 | 
			
		||||
      }
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,7 +13,8 @@
 | 
			
		|||
      "deleted": "Una encuesta ha sido eliminada con el identificador {{ param }}",
 | 
			
		||||
      "delete": {
 | 
			
		||||
        "question": "¿Seguro que quiere eliminar la encuesta {{ id }}?",
 | 
			
		||||
        "deletequestion": "¿Seguro que quiere eliminar esta pregunta?"
 | 
			
		||||
        "deletequestion": "¿Seguro que quiere eliminar esta pregunta?",
 | 
			
		||||
        "deleteoption": "¿Seguro que quiere eliminar esta opción?"
 | 
			
		||||
      },
 | 
			
		||||
      "detail": {
 | 
			
		||||
        "title": "Encuesta"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue