Add ability to delete options from closed questions

This commit is contained in:
Pablo Bonilla 2021-07-23 01:20:43 -06:00
parent aeb5538a4a
commit 6b8cbe8b96
No known key found for this signature in database
GPG Key ID: 46877262B8DE47E2
3 changed files with 21 additions and 0 deletions

View File

@ -66,6 +66,13 @@
>
<!-- <input class="ds-survey--checkbox" id="{{ ePregunta.id }}-{{ ePreguntaOpcion2.id }}" type="checkbox" disabled /> -->
<label for="{{ ePregunta.id }}-{{ ePreguntaOpcion2.id }}">{{ ePreguntaOpcion2.nombre }}</label>
<fa-icon
*ngIf="encuesta!.estado === 'DRAFT'"
class="ds-survey--titulo--icon ds-survey--titulo--icon--small"
[icon]="faTimes"
(click)="deleteOption($event)"
[attr.data-optionid]="ePreguntaOpcion2.id"
></fa-icon>
</div>
</ng-container>
</ng-container>

View File

@ -214,6 +214,15 @@ 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();
});
}
save(): void {
this.isSaving = true;
const ePreguntaCerradaOpcion = this.createFromForm();

View File

@ -34,6 +34,11 @@
background-color: #e73636;
color: #fff;
}
&--small {
font-size: 0.8rem;
padding: 0.6rem;
}
}
}