Merge pull request #67 from Quantum-P3/feature/US-57
This commit is contained in:
commit
4fddf0b130
|
@ -2,11 +2,13 @@ package org.datasurvey.web.rest;
|
|||
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.datasurvey.domain.EPreguntaCerrada;
|
||||
import org.datasurvey.domain.EPreguntaCerradaOpcion;
|
||||
import org.datasurvey.repository.EPreguntaCerradaOpcionRepository;
|
||||
import org.datasurvey.service.EPreguntaCerradaOpcionQueryService;
|
||||
|
@ -58,10 +60,15 @@ public class EPreguntaCerradaOpcionResource {
|
|||
* @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new ePreguntaCerradaOpcion, or with status {@code 400 (Bad Request)} if the ePreguntaCerradaOpcion has already an ID.
|
||||
* @throws URISyntaxException if the Location URI syntax is incorrect.
|
||||
*/
|
||||
@PostMapping("/e-pregunta-cerrada-opcions")
|
||||
@PostMapping("/e-pregunta-cerrada-opcions/{id}")
|
||||
public ResponseEntity<EPreguntaCerradaOpcion> createEPreguntaCerradaOpcion(
|
||||
@Valid @RequestBody EPreguntaCerradaOpcion ePreguntaCerradaOpcion
|
||||
@Valid @RequestBody EPreguntaCerradaOpcion ePreguntaCerradaOpcion,
|
||||
@PathVariable(value = "id", required = false) final Long id
|
||||
) throws URISyntaxException {
|
||||
EPreguntaCerrada ePreguntaCerrada = new EPreguntaCerrada();
|
||||
ePreguntaCerrada.setId(id);
|
||||
ePreguntaCerradaOpcion.setEPreguntaCerrada(ePreguntaCerrada);
|
||||
|
||||
log.debug("REST request to save EPreguntaCerradaOpcion : {}", ePreguntaCerradaOpcion);
|
||||
if (ePreguntaCerradaOpcion.getId() != null) {
|
||||
throw new BadRequestAlertException("A new ePreguntaCerradaOpcion cannot already have an ID", ENTITY_NAME, "idexists");
|
||||
|
@ -76,7 +83,7 @@ public class EPreguntaCerradaOpcionResource {
|
|||
/**
|
||||
* {@code PUT /e-pregunta-cerrada-opcions/:id} : Updates an existing ePreguntaCerradaOpcion.
|
||||
*
|
||||
* @param id the id of the ePreguntaCerradaOpcion to save.
|
||||
* @param id the id of the ePreguntaCerradaOpcion to save.
|
||||
* @param ePreguntaCerradaOpcion the ePreguntaCerradaOpcion to update.
|
||||
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated ePreguntaCerradaOpcion,
|
||||
* or with status {@code 400 (Bad Request)} if the ePreguntaCerradaOpcion is not valid,
|
||||
|
@ -110,7 +117,7 @@ public class EPreguntaCerradaOpcionResource {
|
|||
/**
|
||||
* {@code PATCH /e-pregunta-cerrada-opcions/:id} : Partial updates given fields of an existing ePreguntaCerradaOpcion, field will ignore if it is null
|
||||
*
|
||||
* @param id the id of the ePreguntaCerradaOpcion to save.
|
||||
* @param id the id of the ePreguntaCerradaOpcion to save.
|
||||
* @param ePreguntaCerradaOpcion the ePreguntaCerradaOpcion to update.
|
||||
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated ePreguntaCerradaOpcion,
|
||||
* or with status {@code 400 (Bad Request)} if the ePreguntaCerradaOpcion is not valid,
|
||||
|
@ -196,4 +203,15 @@ public class EPreguntaCerradaOpcionResource {
|
|||
.headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, id.toString()))
|
||||
.build();
|
||||
}
|
||||
|
||||
@PostMapping("/e-pregunta-cerrada-opcions/deleteMany")
|
||||
public ResponseEntity<Void> deleteManyEPreguntaCerradaOpcion(@Valid @RequestBody int[] ids) {
|
||||
for (int id : ids) {
|
||||
ePreguntaCerradaOpcionService.delete((long) id);
|
||||
}
|
||||
return ResponseEntity
|
||||
.noContent()
|
||||
.headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, Arrays.toString(ids)))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,15 +2,20 @@ package org.datasurvey.web.rest;
|
|||
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.datasurvey.domain.EPreguntaAbierta;
|
||||
import org.datasurvey.domain.EPreguntaCerrada;
|
||||
import org.datasurvey.domain.EPreguntaCerradaOpcion;
|
||||
import org.datasurvey.domain.Encuesta;
|
||||
import org.datasurvey.repository.EncuestaRepository;
|
||||
import org.datasurvey.service.EncuestaQueryService;
|
||||
import org.datasurvey.service.EncuestaService;
|
||||
import org.datasurvey.service.*;
|
||||
import org.datasurvey.service.criteria.EncuestaCriteria;
|
||||
import org.datasurvey.web.rest.errors.BadRequestAlertException;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -41,14 +46,26 @@ public class EncuestaResource {
|
|||
|
||||
private final EncuestaQueryService encuestaQueryService;
|
||||
|
||||
private final EPreguntaCerradaService ePreguntaCerradaService;
|
||||
|
||||
private final EPreguntaAbiertaService ePreguntaAbiertaService;
|
||||
|
||||
private final EPreguntaCerradaOpcionService ePreguntaCerradaOpcionService;
|
||||
|
||||
public EncuestaResource(
|
||||
EncuestaService encuestaService,
|
||||
EncuestaRepository encuestaRepository,
|
||||
EncuestaQueryService encuestaQueryService
|
||||
EncuestaQueryService encuestaQueryService,
|
||||
EPreguntaCerradaService ePreguntaCerradaService,
|
||||
EPreguntaAbiertaService ePreguntaAbiertaService,
|
||||
EPreguntaCerradaOpcionService ePreguntaCerradaOpcionService
|
||||
) {
|
||||
this.encuestaService = encuestaService;
|
||||
this.encuestaRepository = encuestaRepository;
|
||||
this.encuestaQueryService = encuestaQueryService;
|
||||
this.ePreguntaCerradaService = ePreguntaCerradaService;
|
||||
this.ePreguntaAbiertaService = ePreguntaAbiertaService;
|
||||
this.ePreguntaCerradaOpcionService = ePreguntaCerradaOpcionService;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -74,7 +91,7 @@ public class EncuestaResource {
|
|||
/**
|
||||
* {@code PUT /encuestas/:id} : Updates an existing encuesta.
|
||||
*
|
||||
* @param id the id of the encuesta to save.
|
||||
* @param id the id of the encuesta to save.
|
||||
* @param encuesta the encuesta to update.
|
||||
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated encuesta,
|
||||
* or with status {@code 400 (Bad Request)} if the encuesta is not valid,
|
||||
|
@ -108,7 +125,7 @@ public class EncuestaResource {
|
|||
/**
|
||||
* {@code PATCH /encuestas/:id} : Partial updates given fields of an existing encuesta, field will ignore if it is null
|
||||
*
|
||||
* @param id the id of the encuesta to save.
|
||||
* @param id the id of the encuesta to save.
|
||||
* @param encuesta the encuesta to update.
|
||||
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated encuesta,
|
||||
* or with status {@code 400 (Bad Request)} if the encuesta is not valid,
|
||||
|
@ -154,6 +171,55 @@ public class EncuestaResource {
|
|||
return ResponseEntity.ok().body(entityList);
|
||||
}
|
||||
|
||||
@GetMapping("/encuestas/preguntas/{id}")
|
||||
public ResponseEntity<List<Object>> getPreguntasByIdEncuesta(@PathVariable Long id) {
|
||||
List<EPreguntaCerrada> preguntasCerradas = ePreguntaCerradaService.findAll();
|
||||
List<EPreguntaAbierta> preguntasAbiertas = ePreguntaAbiertaService.findAll();
|
||||
List<Object> preguntas = Stream.concat(preguntasCerradas.stream(), preguntasAbiertas.stream()).collect(Collectors.toList());
|
||||
List<Object> preguntasFiltered = new ArrayList<>();
|
||||
|
||||
for (Object obj : preguntas) {
|
||||
if (obj.getClass() == EPreguntaCerrada.class) {
|
||||
if (((EPreguntaCerrada) obj).getEncuesta() != null) {
|
||||
if (((EPreguntaCerrada) obj).getEncuesta().getId().equals(id)) {
|
||||
preguntasFiltered.add(obj);
|
||||
}
|
||||
}
|
||||
} else if (obj.getClass() == EPreguntaAbierta.class) {
|
||||
if (((EPreguntaAbierta) obj).getEncuesta() != null) {
|
||||
if (((EPreguntaAbierta) obj).getEncuesta().getId().equals(id)) {
|
||||
preguntasFiltered.add(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ResponseEntity.ok().body(preguntasFiltered);
|
||||
}
|
||||
|
||||
@GetMapping("/encuestas/preguntas-opciones/{id}")
|
||||
public ResponseEntity<List<List<EPreguntaCerradaOpcion>>> getPreguntaCerradaOpcionByIdEncuesta(@PathVariable Long id) {
|
||||
List<List<EPreguntaCerradaOpcion>> res = new ArrayList<>();
|
||||
List<EPreguntaCerrada> preguntasCerradas = ePreguntaCerradaService.findAll();
|
||||
List<EPreguntaCerrada> preguntasCerradasFiltered = preguntasCerradas
|
||||
.stream()
|
||||
.filter(p -> Objects.nonNull(p.getEncuesta()))
|
||||
.filter(p -> p.getEncuesta().getId().equals(id))
|
||||
.collect(Collectors.toList());
|
||||
List<EPreguntaCerradaOpcion> opciones = ePreguntaCerradaOpcionService.findAll();
|
||||
|
||||
for (EPreguntaCerrada ePreguntaCerrada : preguntasCerradasFiltered) {
|
||||
long preguntaCerradaId = ePreguntaCerrada.getId();
|
||||
List<EPreguntaCerradaOpcion> opcionesFiltered = opciones
|
||||
.stream()
|
||||
.filter(o -> Objects.nonNull(o.getEPreguntaCerrada()))
|
||||
.filter(o -> o.getEPreguntaCerrada().getId().equals(preguntaCerradaId))
|
||||
.collect(Collectors.toList());
|
||||
res.add(opcionesFiltered);
|
||||
}
|
||||
|
||||
return ResponseEntity.ok().body(res);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@code GET /encuestas/count} : count all the encuestas.
|
||||
*
|
||||
|
|
|
@ -16,8 +16,8 @@ export class EPreguntaCerradaOpcionService {
|
|||
|
||||
constructor(protected http: HttpClient, protected applicationConfigService: ApplicationConfigService) {}
|
||||
|
||||
create(ePreguntaCerradaOpcion: IEPreguntaCerradaOpcion): Observable<EntityResponseType> {
|
||||
return this.http.post<IEPreguntaCerradaOpcion>(this.resourceUrl, ePreguntaCerradaOpcion, { observe: 'response' });
|
||||
create(ePreguntaCerradaOpcion: IEPreguntaCerradaOpcion, preguntaId?: number): Observable<EntityResponseType> {
|
||||
return this.http.post<IEPreguntaCerradaOpcion>(`${this.resourceUrl}/${preguntaId}`, ePreguntaCerradaOpcion, { observe: 'response' });
|
||||
}
|
||||
|
||||
update(ePreguntaCerradaOpcion: IEPreguntaCerradaOpcion): Observable<EntityResponseType> {
|
||||
|
@ -49,6 +49,10 @@ export class EPreguntaCerradaOpcionService {
|
|||
return this.http.delete(`${this.resourceUrl}/${id}`, { observe: 'response' });
|
||||
}
|
||||
|
||||
deleteMany(ids: number[]): Observable<EntityResponseType> {
|
||||
return this.http.post<IEPreguntaCerradaOpcion>(`${this.resourceUrl}/deleteMany`, ids, { observe: 'response' });
|
||||
}
|
||||
|
||||
addEPreguntaCerradaOpcionToCollectionIfMissing(
|
||||
ePreguntaCerradaOpcionCollection: IEPreguntaCerradaOpcion[],
|
||||
...ePreguntaCerradaOpcionsToCheck: (IEPreguntaCerradaOpcion | null | undefined)[]
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
}
|
|
@ -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.deletequestion">
|
||||
Are you sure you want to delete this question?
|
||||
</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-question-dialog.component.html',
|
||||
})
|
||||
export class EncuestaDeleteQuestionDialogComponent {
|
||||
constructor(protected activeModal: NgbActiveModal) {}
|
||||
|
||||
cancel(): void {
|
||||
this.activeModal.dismiss();
|
||||
}
|
||||
|
||||
confirmDelete(): void {
|
||||
this.activeModal.close('confirm');
|
||||
}
|
||||
}
|
|
@ -7,6 +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-question-dialog/encuesta-delete-question-dialog.component';
|
||||
import { EncuestaDeleteOptionDialogComponent } from './encuesta-delete-option-dialog/encuesta-delete-option-dialog.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [SharedModule, EncuestaRoutingModule, FontAwesomeModule],
|
||||
|
@ -16,6 +18,8 @@ import { EncuestaPublishDialogComponent } from './encuesta-publish-dialog/encues
|
|||
EncuestaUpdateComponent,
|
||||
EncuestaDeleteDialogComponent,
|
||||
EncuestaPublishDialogComponent,
|
||||
EncuestaDeleteQuestionDialogComponent,
|
||||
EncuestaDeleteOptionDialogComponent,
|
||||
],
|
||||
entryComponents: [EncuestaDeleteDialogComponent],
|
||||
})
|
||||
|
|
|
@ -45,6 +45,18 @@ export class EncuestaService {
|
|||
.pipe(map((res: EntityResponseType) => this.convertDateFromServer(res)));
|
||||
}
|
||||
|
||||
findQuestions(id: number): Observable<EntityResponseType> {
|
||||
return this.http
|
||||
.get<any>(`${this.resourceUrl}/preguntas/${id}`, { observe: 'response' })
|
||||
.pipe(map((res: EntityResponseType) => this.convertDateFromServer(res)));
|
||||
}
|
||||
|
||||
findQuestionsOptions(id: number): Observable<EntityResponseType> {
|
||||
return this.http
|
||||
.get<any>(`${this.resourceUrl}/preguntas-opciones/${id}`, { observe: 'response' })
|
||||
.pipe(map((res: EntityResponseType) => this.convertDateFromServer(res)));
|
||||
}
|
||||
|
||||
findEncuesta(id: number): Observable<IEncuesta> {
|
||||
return this.http.get<IEncuesta>(`${this.resourceUrl}/${id}`);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,401 @@
|
|||
<div class="row justify-content-center">
|
||||
<div>
|
||||
<h2 id="page-heading" data-cy="EPreguntaCerradaHeading">
|
||||
<p class="ds-title">{{ encuesta!.nombre }}</p>
|
||||
<p class="ds-subtitle">Creada el día {{ encuesta!.fechaCreacion | formatShortDatetime | lowercase }}</p>
|
||||
|
||||
<div class="d-flex justify-content-end">
|
||||
<button type="button" class="ds-btn ds-btn--secondary" (click)="previousState()">
|
||||
<fa-icon icon="arrow-left"></fa-icon> <span jhiTranslate="entity.action.cancel">Cancel</span>
|
||||
</button>
|
||||
<button type="button" class="ds-btn ds-btn--secondary" (click)="loadAll()" [disabled]="isLoading">
|
||||
<fa-icon icon="sync" [spin]="isLoading"></fa-icon> <span>Refrescar preguntas</span>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="ds-btn ds-btn--secondary"
|
||||
(click)="createQuestion()"
|
||||
[disabled]="isLoading"
|
||||
data-toggle="modal"
|
||||
data-target="#crearPregunta"
|
||||
>
|
||||
<fa-icon icon="sync" [icon]="faPlus"></fa-icon> <span>Crear pregunta</span>
|
||||
</button>
|
||||
<ng-container *ngIf="encuesta!.estado === 'DRAFT'">
|
||||
<button type="button" class="ds-btn ds-btn--primary" (click)="publishSurvey()">Publicar encuesta</button>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="encuesta!.estado === 'ACTIVE'">
|
||||
<button type="button" class="ds-btn ds-btn--danger" (click)="finishSurvey()">Finalizar encuesta</button>
|
||||
</ng-container>
|
||||
</div>
|
||||
</h2>
|
||||
|
||||
<jhi-alert-error></jhi-alert-error>
|
||||
|
||||
<!-- <jhi-alert></jhi-alert> -->
|
||||
|
||||
<div class="alert alert-warning" id="no-result" *ngIf="ePreguntas?.length === 0">
|
||||
<span>No se encontraron preguntas</span>
|
||||
</div>
|
||||
|
||||
<div class="ds-survey" id="entities" *ngIf="ePreguntas && ePreguntas.length > 0">
|
||||
<div class="ds-survey--all-question-wrapper">
|
||||
<div class="ds-survey--question-wrapper" *ngFor="let ePregunta of ePreguntas; let i = index; trackBy: trackId">
|
||||
<div
|
||||
[attr.data-index]="ePregunta.id"
|
||||
[attr.data-tipo]="ePregunta.tipo"
|
||||
[attr.data-opcional]="ePregunta.opcional"
|
||||
class="ds-survey--question"
|
||||
>
|
||||
<div class="ds-survey--titulo">
|
||||
<span class="ds-survey--titulo--name">{{ i + 1 }}. {{ ePregunta.nombre }}</span>
|
||||
<fa-icon
|
||||
*ngIf="encuesta!.estado === 'DRAFT'"
|
||||
class="ds-survey--titulo--icon"
|
||||
[icon]="faTimes"
|
||||
(click)="deleteQuestion($event)"
|
||||
[attr.data-id]="ePregunta.id"
|
||||
[attr.data-type]="ePregunta.tipo"
|
||||
></fa-icon>
|
||||
</div>
|
||||
<div>
|
||||
<span *ngIf="ePregunta.tipo === 'SINGLE'" class="ds-subtitle"
|
||||
>Pregunta de respuesta {{ 'dataSurveyApp.PreguntaCerradaTipo.SINGLE' | translate | lowercase }}
|
||||
{{ ePregunta.opcional ? '(opcional)' : '' }}</span
|
||||
>
|
||||
<span *ngIf="ePregunta.tipo === 'MULTIPLE'" class="ds-subtitle"
|
||||
>Pregunta de respuesta {{ 'dataSurveyApp.PreguntaCerradaTipo.MULTIPLE' | translate | lowercase }}
|
||||
{{ ePregunta.opcional ? '(opcional)' : '' }}</span
|
||||
>
|
||||
<span *ngIf="!ePregunta.tipo" class="ds-subtitle"
|
||||
>Pregunta de respuesta abierta {{ ePregunta.opcional ? '(opcional)' : '' }}</span
|
||||
>
|
||||
</div>
|
||||
<ng-container *ngIf="ePregunta.tipo">
|
||||
<ng-container *ngFor="let ePreguntaOpcion of ePreguntasOpciones; let j = index; trackBy: trackId">
|
||||
<ng-container *ngFor="let ePreguntaOpcionFinal of ePreguntaOpcion">
|
||||
<ng-container *ngIf="ePregunta.id === ePreguntaOpcionFinal.epreguntaCerrada.id">
|
||||
<div
|
||||
class="ds-survey--option ds-survey--option--base ds-survey--closed-option can-delete"
|
||||
[attr.data-id]="ePreguntaOpcionFinal.id"
|
||||
>
|
||||
<!-- <input class="ds-survey--checkbox" id="{{ ePregunta.id }}-{{ ePreguntaOpcionFinal.id }}" type="checkbox" disabled /> -->
|
||||
<label for="{{ ePregunta.id }}-{{ ePreguntaOpcionFinal.id }}">{{ ePreguntaOpcionFinal.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]="ePreguntaOpcionFinal.id"
|
||||
></fa-icon>
|
||||
</div>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
<div
|
||||
class="ds-survey--option ds-survey--option--add ds-survey--closed-option"
|
||||
(click)="resetForm($event)"
|
||||
data-toggle="modal"
|
||||
data-target="#crearOpcion"
|
||||
[attr.data-id]="ePregunta.id"
|
||||
>
|
||||
<fa-icon
|
||||
class="ds-survey--add-option--icon"
|
||||
[icon]="faPlus"
|
||||
[attr.data-id]="ePregunta.id"
|
||||
[attr.data-type]="ePregunta.tipo"
|
||||
></fa-icon>
|
||||
<span class="ds-survey--add-option">Añadir opción</span>
|
||||
</div>
|
||||
</ng-container>
|
||||
<div class="ds-survey--option ds-survey--option--base ds-survey--open-option" *ngIf="!ePregunta.tipo">
|
||||
<textarea name="" id="" cols="30" rows="10" disabled></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <table class="table table-striped" aria-describedby="page-heading">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><span jhiTranslate="global.field.id">ID</span></th>
|
||||
<th scope="col"><span jhiTranslate="dataSurveyApp.ePreguntaCerrada.nombre">Nombre</span></th>
|
||||
<th scope="col"><span jhiTranslate="dataSurveyApp.ePreguntaCerrada.tipo">Tipo</span></th>
|
||||
<th scope="col"><span jhiTranslate="dataSurveyApp.ePreguntaCerrada.opcional">Opcional</span></th>
|
||||
<th scope="col"><span jhiTranslate="dataSurveyApp.ePreguntaCerrada.orden">Orden</span></th>
|
||||
<th scope="col"><span jhiTranslate="dataSurveyApp.ePreguntaCerrada.encuesta">Encuesta</span></th>
|
||||
<th scope="col"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let ePreguntaCerrada of ePreguntaCerradas; trackBy: trackId" data-cy="entityTable">
|
||||
<td>
|
||||
<a [routerLink]="['/e-pregunta-cerrada', ePreguntaCerrada.id, 'view']">{{ ePreguntaCerrada.id }}</a>
|
||||
</td>
|
||||
<td>{{ ePreguntaCerrada.nombre }}</td>
|
||||
<td *ngIf="ePreguntaCerrada.tipo != undefined" jhiTranslate="{{ 'dataSurveyApp.PreguntaCerradaTipo.' + ePreguntaCerrada.tipo }}">{{ ePreguntaCerrada.tipo }}</td>
|
||||
<td *ngIf="ePreguntaCerrada.tipo == undefined"></td>
|
||||
|
||||
<td>{{ ePreguntaCerrada.opcional }}</td>
|
||||
<td>{{ ePreguntaCerrada.orden }}</td>
|
||||
<td>
|
||||
<div *ngIf="ePreguntaCerrada.encuesta">
|
||||
<a [routerLink]="['/encuesta', ePreguntaCerrada.encuesta?.id, 'view']">{{ ePreguntaCerrada.encuesta?.id }}</a>
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<div class="btn-group">
|
||||
<button
|
||||
type="submit"
|
||||
[routerLink]="['/e-pregunta-cerrada', ePreguntaCerrada.id, 'view']"
|
||||
class="btn btn-info btn-sm"
|
||||
data-cy="entityDetailsButton"
|
||||
>
|
||||
<fa-icon icon="eye"></fa-icon>
|
||||
<span class="d-none d-md-inline" jhiTranslate="entity.action.view">View</span>
|
||||
</button>
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
[routerLink]="['/e-pregunta-cerrada', ePreguntaCerrada.id, 'edit']"
|
||||
class="btn btn-primary btn-sm"
|
||||
data-cy="entityEditButton"
|
||||
>
|
||||
<fa-icon icon="pencil-alt"></fa-icon>
|
||||
<span class="d-none d-md-inline" jhiTranslate="entity.action.edit">Edit</span>
|
||||
</button>
|
||||
|
||||
<button type="submit" (click)="delete(ePreguntaCerrada)" class="btn btn-danger btn-sm" data-cy="entityDeleteButton">
|
||||
<fa-icon icon="times"></fa-icon>
|
||||
<span class="d-none d-md-inline" jhiTranslate="entity.action.delete">Delete</span>
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Create Option Modal -->
|
||||
<div class="modal fade ds-modal" id="crearOpcion" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<form autocomplete="off" class="ds-form" name="editForm" role="form" novalidate (ngSubmit)="save()" [formGroup]="editForm">
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title" id="exampleModalLongTitle">Crear Opción</h1>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<!-- Survey Closed Question Create Option Modal -->
|
||||
<div>
|
||||
<jhi-alert-error></jhi-alert-error>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="form-control-label" jhiTranslate="dataSurveyApp.ePreguntaCerradaOpcion.nombre" for="field_nombre">Nombre</label>
|
||||
<input type="text" class="form-control" name="nombre" id="field_nombre" data-cy="nombre" formControlName="nombre" />
|
||||
<div *ngIf="editForm.get('nombre')!.invalid && (editForm.get('nombre')!.dirty || editForm.get('nombre')!.touched)">
|
||||
<small
|
||||
class="form-text text-danger"
|
||||
*ngIf="editForm.get('nombre')?.errors?.required"
|
||||
jhiTranslate="entity.validation.required"
|
||||
>
|
||||
This field is required.
|
||||
</small>
|
||||
<small
|
||||
class="form-text text-danger"
|
||||
*ngIf="editForm.get('nombre')?.errors?.minlength"
|
||||
jhiTranslate="entity.validation.minlength"
|
||||
[translateValues]="{ min: 1 }"
|
||||
>
|
||||
This field is required to be at least 1 characters.
|
||||
</small>
|
||||
<small
|
||||
class="form-text text-danger"
|
||||
*ngIf="editForm.get('nombre')?.errors?.maxlength"
|
||||
jhiTranslate="entity.validation.maxlength"
|
||||
[translateValues]="{ max: 500 }"
|
||||
>
|
||||
This field cannot be longer than 500 characters.
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<input id="createAnother" type="checkbox" (change)="createAnotherChange($event)" />
|
||||
<label for="createAnother">Crear otra</label>
|
||||
<button id="cancelBtn" type="button" class="ds-btn ds-btn--secondary" data-dismiss="modal">
|
||||
<fa-icon icon="arrow-left"></fa-icon> <span jhiTranslate="entity.action.cancel">Cancel</span>
|
||||
</button>
|
||||
<button
|
||||
type="submit"
|
||||
id="save-entity"
|
||||
data-cy="entityCreateSaveButton"
|
||||
class="ds-btn ds-btn--primary"
|
||||
[disabled]="editForm.invalid || isSaving"
|
||||
>
|
||||
<span jhiTranslate="entity.action.create">Create</span>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ------------------------------------------------------------------------------------------------- -->
|
||||
|
||||
<!-- Create Question Modal -->
|
||||
<div
|
||||
class="modal fade ds-modal"
|
||||
id="crearPregunta"
|
||||
tabindex="-1"
|
||||
role="dialog"
|
||||
aria-labelledby="exampleModalCenterTitle"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<form
|
||||
autocomplete="off"
|
||||
class="ds-form"
|
||||
name="editFormQuestion"
|
||||
role="form"
|
||||
novalidate
|
||||
(ngSubmit)="saveQuestion()"
|
||||
[formGroup]="editFormQuestion"
|
||||
>
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title" id="exampleModalLongTitle">Crear Pregunta</h1>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<!-- Survey Create Question Modal -->
|
||||
<div>
|
||||
<jhi-alert-error></jhi-alert-error>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="form-control-label" for="field_nombre">Pregunta</label>
|
||||
<input type="text" class="form-control" name="nombre" id="field_nombre" data-cy="nombre" formControlName="nombre" />
|
||||
<div
|
||||
*ngIf="
|
||||
editFormQuestion.get('nombre')!.invalid &&
|
||||
(editFormQuestion.get('nombre')!.dirty || editFormQuestion.get('nombre')!.touched)
|
||||
"
|
||||
>
|
||||
<small
|
||||
class="form-text text-danger"
|
||||
*ngIf="editFormQuestion.get('nombre')?.errors?.required"
|
||||
jhiTranslate="entity.validation.required"
|
||||
>
|
||||
This field is required.
|
||||
</small>
|
||||
<small
|
||||
class="form-text text-danger"
|
||||
*ngIf="editFormQuestion.get('nombre')?.errors?.minlength"
|
||||
jhiTranslate="entity.validation.minlength"
|
||||
[translateValues]="{ min: 1 }"
|
||||
>
|
||||
This field is required to be at least 1 characters.
|
||||
</small>
|
||||
<small
|
||||
class="form-text text-danger"
|
||||
*ngIf="editFormQuestion.get('nombre')?.errors?.maxlength"
|
||||
jhiTranslate="entity.validation.maxlength"
|
||||
[translateValues]="{ max: 500 }"
|
||||
>
|
||||
This field cannot be longer than 500 characters.
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Custom Form Group (Closed & Open Question Validation) -->
|
||||
<div class="form-group">
|
||||
<label class="form-control-label" for="field_tipo">Tipo de pregunta</label>
|
||||
<select class="form-control" name="tipopregunta" formControlName="tipopregunta" id="field_tipo" data-cy="tipopregunta">
|
||||
<option selected value="CLOSED">Opción multiple</option>
|
||||
<option value="OPEN">Respuesta abierta</option>
|
||||
</select>
|
||||
<div
|
||||
*ngIf="
|
||||
editFormQuestion.get('tipopregunta')!.invalid &&
|
||||
(editFormQuestion.get('tipopregunta')!.dirty || editFormQuestion.get('tipopregunta')!.touched)
|
||||
"
|
||||
>
|
||||
<small
|
||||
class="form-text text-danger"
|
||||
*ngIf="editFormQuestion.get('tipopregunta')?.errors?.required"
|
||||
jhiTranslate="entity.validation.required"
|
||||
>
|
||||
This field is required.
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ng-container *ngIf="editFormQuestion.get('tipopregunta')!.value === 'CLOSED'">
|
||||
<div class="form-group">
|
||||
<label class="form-control-label" jhiTranslate="dataSurveyApp.ePreguntaCerrada.tiporespuesta" for="field_tipo">Tipo</label>
|
||||
<select class="form-control" name="tipo" formControlName="tipo" id="field_tipo" data-cy="tipo">
|
||||
<option selected value="SINGLE">{{ 'dataSurveyApp.PreguntaCerradaTipo.SINGLE' | translate }}</option>
|
||||
<option value="MULTIPLE">{{ 'dataSurveyApp.PreguntaCerradaTipo.MULTIPLE' | translate }}</option>
|
||||
</select>
|
||||
<div
|
||||
*ngIf="
|
||||
editFormQuestion.get('tipo')!.invalid && (editFormQuestion.get('tipo')!.dirty || editFormQuestion.get('tipo')!.touched)
|
||||
"
|
||||
>
|
||||
<small
|
||||
class="form-text text-danger"
|
||||
*ngIf="editFormQuestion.get('tipo')?.errors?.required"
|
||||
jhiTranslate="entity.validation.required"
|
||||
>
|
||||
This field is required.
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="form-control-label" for="field_opcional">Opcional</label>
|
||||
<input type="checkbox" class="form-check" name="opcional" id="field_opcional" data-cy="opcional" formControlName="opcional" />
|
||||
<div
|
||||
*ngIf="
|
||||
editFormQuestion.get('opcional')!.invalid &&
|
||||
(editFormQuestion.get('opcional')!.dirty || editFormQuestion.get('opcional')!.touched)
|
||||
"
|
||||
>
|
||||
<small
|
||||
class="form-text text-danger"
|
||||
*ngIf="editFormQuestion.get('opcional')?.errors?.required"
|
||||
jhiTranslate="entity.validation.required"
|
||||
>
|
||||
This field is required.
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<input id="createAnotherQuestion" type="checkbox" (change)="createAnotherQuestionChange($event)" />
|
||||
<label for="createAnotherQuestion">Crear otra</label>
|
||||
<button id="cancelBtnQuestion" type="button" class="ds-btn ds-btn--secondary" data-dismiss="modal">
|
||||
<fa-icon icon="arrow-left"></fa-icon> <span jhiTranslate="entity.action.cancel">Cancel</span>
|
||||
</button>
|
||||
<button
|
||||
type="submit"
|
||||
id="save-question"
|
||||
data-cy="entityCreateSaveButton"
|
||||
class="ds-btn ds-btn--primary"
|
||||
[disabled]="editFormQuestion.invalid || isSaving"
|
||||
>
|
||||
<span jhiTranslate="entity.action.create">Create</span>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ------------------------------------------------------------------------------------------------- -->
|
||||
|
||||
<!-- <div class="row justify-content-center">
|
||||
<div class="col-8">
|
||||
<form name="editForm" role="form" novalidate (ngSubmit)="save()" [formGroup]="editForm">
|
||||
<h2 id="jhi-encuesta-heading" data-cy="EncuestaCreateUpdateHeading" jhiTranslate="dataSurveyApp.encuesta.home.createOrEditLabel">
|
||||
|
@ -259,4 +656,4 @@
|
|||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import { IEPreguntaAbierta } from './../../e-pregunta-abierta/e-pregunta-abierta.model';
|
||||
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';
|
||||
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';
|
||||
import { FormBuilder, Validators } from '@angular/forms';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
|
@ -15,82 +20,254 @@ import { CategoriaService } from 'app/entities/categoria/service/categoria.servi
|
|||
import { IUsuarioExtra } from 'app/entities/usuario-extra/usuario-extra.model';
|
||||
import { UsuarioExtraService } from 'app/entities/usuario-extra/service/usuario-extra.service';
|
||||
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { IEPreguntaCerrada } from 'app/entities/e-pregunta-cerrada/e-pregunta-cerrada.model';
|
||||
import { EPreguntaCerradaService } from 'app/entities/e-pregunta-cerrada/service/e-pregunta-cerrada.service';
|
||||
import { EPreguntaCerradaDeleteDialogComponent } from 'app/entities/e-pregunta-cerrada/delete/e-pregunta-cerrada-delete-dialog.component';
|
||||
|
||||
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',
|
||||
})
|
||||
export class EncuestaUpdateComponent implements OnInit {
|
||||
export class EncuestaUpdateComponent implements OnInit, AfterViewChecked {
|
||||
faTimes = faTimes;
|
||||
faPlus = faPlus;
|
||||
|
||||
isSaving = false;
|
||||
isSavingQuestion = false;
|
||||
|
||||
categoriasSharedCollection: ICategoria[] = [];
|
||||
usuarioExtrasSharedCollection: IUsuarioExtra[] = [];
|
||||
|
||||
// editForm = this.fb.group({
|
||||
// id: [],
|
||||
// nombre: [null, [Validators.required, Validators.minLength(1), Validators.maxLength(50)]],
|
||||
// descripcion: [],
|
||||
// fechaCreacion: [null, [Validators.required]],
|
||||
// fechaPublicacion: [],
|
||||
// fechaFinalizar: [],
|
||||
// fechaFinalizada: [],
|
||||
// calificacion: [null, [Validators.required]],
|
||||
// acceso: [null, [Validators.required]],
|
||||
// contrasenna: [],
|
||||
// estado: [null, [Validators.required]],
|
||||
// categoria: [],
|
||||
// usuarioExtra: [],
|
||||
// });
|
||||
|
||||
editForm = this.fb.group({
|
||||
id: [],
|
||||
nombre: [null, [Validators.required, Validators.minLength(1), Validators.maxLength(50)]],
|
||||
descripcion: [],
|
||||
fechaCreacion: [null, [Validators.required]],
|
||||
fechaPublicacion: [],
|
||||
fechaFinalizar: [],
|
||||
fechaFinalizada: [],
|
||||
calificacion: [null, [Validators.required]],
|
||||
acceso: [null, [Validators.required]],
|
||||
contrasenna: [],
|
||||
estado: [null, [Validators.required]],
|
||||
categoria: [],
|
||||
usuarioExtra: [],
|
||||
nombre: [null, [Validators.required, Validators.minLength(1), Validators.maxLength(500)]],
|
||||
// orden: [null, [Validators.required]],
|
||||
// cantidad: [null, [Validators.required]],
|
||||
// ePreguntaCerrada: [],
|
||||
});
|
||||
|
||||
editFormQuestion = this.fb.group({
|
||||
id: [],
|
||||
nombre: [null, [Validators.required, Validators.minLength(1), Validators.maxLength(500)]],
|
||||
tipo: [PreguntaCerradaTipo.SINGLE],
|
||||
opcional: [false],
|
||||
tipopregunta: ['CLOSED'],
|
||||
});
|
||||
|
||||
ePreguntas?: any[];
|
||||
ePreguntasOpciones?: any[];
|
||||
encuesta: Encuesta | null = null;
|
||||
|
||||
isLoading = false;
|
||||
|
||||
createAnother: Boolean = false;
|
||||
createAnotherQuestion: Boolean = false;
|
||||
selectedQuestionToCreateOption: IEPreguntaCerrada | null = null;
|
||||
|
||||
constructor(
|
||||
protected encuestaService: EncuestaService,
|
||||
protected categoriaService: CategoriaService,
|
||||
protected usuarioExtraService: UsuarioExtraService,
|
||||
protected activatedRoute: ActivatedRoute,
|
||||
protected fb: FormBuilder
|
||||
protected fb: FormBuilder,
|
||||
protected modalService: NgbModal,
|
||||
protected ePreguntaCerradaService: EPreguntaCerradaService,
|
||||
protected ePreguntaCerradaOpcionService: EPreguntaCerradaOpcionService,
|
||||
protected ePreguntaAbiertaService: EPreguntaAbiertaService
|
||||
) {}
|
||||
|
||||
loadAll(): void {
|
||||
this.isLoading = true;
|
||||
|
||||
this.encuestaService.findQuestions(this.encuesta?.id!).subscribe(
|
||||
(res: any) => {
|
||||
this.isLoading = false;
|
||||
this.ePreguntas = res.body ?? [];
|
||||
console.log(this.ePreguntas);
|
||||
},
|
||||
() => {
|
||||
this.isLoading = false;
|
||||
}
|
||||
);
|
||||
|
||||
this.encuestaService.findQuestionsOptions(this.encuesta?.id!).subscribe(
|
||||
(res: any) => {
|
||||
this.isLoading = false;
|
||||
this.ePreguntasOpciones = res.body ?? [];
|
||||
},
|
||||
() => {
|
||||
this.isLoading = false;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.activatedRoute.data.subscribe(({ encuesta }) => {
|
||||
console.log(this.activatedRoute.data);
|
||||
console.log(encuesta);
|
||||
|
||||
if (encuesta.id === undefined) {
|
||||
const today = dayjs().startOf('day');
|
||||
encuesta.fechaCreacion = today;
|
||||
encuesta.fechaPublicacion = today;
|
||||
encuesta.fechaFinalizar = today;
|
||||
encuesta.fechaFinalizada = today;
|
||||
} else {
|
||||
this.encuesta = encuesta;
|
||||
this.loadAll();
|
||||
}
|
||||
|
||||
this.updateForm(encuesta);
|
||||
// this.updateForm(encuesta);
|
||||
|
||||
this.loadRelationshipsOptions();
|
||||
// this.loadRelationshipsOptions();
|
||||
});
|
||||
}
|
||||
|
||||
ngAfterViewChecked(): void {
|
||||
this.initListeners();
|
||||
}
|
||||
|
||||
trackId(index: number, item: IEPreguntaCerrada): number {
|
||||
return item.id!;
|
||||
}
|
||||
|
||||
delete(ePreguntaCerrada: IEPreguntaCerrada): void {
|
||||
const modalRef = this.modalService.open(EPreguntaCerradaDeleteDialogComponent, { size: 'lg', backdrop: 'static' });
|
||||
modalRef.componentInstance.ePreguntaCerrada = ePreguntaCerrada;
|
||||
// unsubscribe not needed because closed completes on modal close
|
||||
modalRef.closed.subscribe(reason => {
|
||||
if (reason === 'deleted') {
|
||||
this.loadAll();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
initListeners(): void {
|
||||
const checkboxes = document.getElementsByClassName('ds-survey--checkbox');
|
||||
for (let i = 0; i < checkboxes.length; i++) {
|
||||
checkboxes[i].addEventListener('click', e => {
|
||||
if ((e.target as HTMLInputElement).checked) {
|
||||
(e.target as HTMLElement).offsetParent!.classList.add('ds-survey--closed-option--active');
|
||||
} else {
|
||||
(e.target as HTMLElement).offsetParent!.classList.remove('ds-survey--closed-option--active');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
previousState(): void {
|
||||
window.history.back();
|
||||
}
|
||||
|
||||
save(): void {
|
||||
this.isSaving = true;
|
||||
const encuesta = this.createFromForm();
|
||||
if (encuesta.id !== undefined) {
|
||||
this.subscribeToSaveResponse(this.encuestaService.update(encuesta));
|
||||
} else {
|
||||
this.subscribeToSaveResponse(this.encuestaService.create(encuesta));
|
||||
publishSurvey(): void {}
|
||||
|
||||
finishSurvey(): void {}
|
||||
|
||||
addOption(event: any): void {}
|
||||
|
||||
resetForm(event: any): void {
|
||||
this.editForm.reset();
|
||||
if (event !== null) {
|
||||
const id = event.target.dataset.id;
|
||||
this.ePreguntaCerradaService.find(id).subscribe(e => {
|
||||
this.selectedQuestionToCreateOption = e.body;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
trackCategoriaById(index: number, item: ICategoria): number {
|
||||
deleteQuestion(event: any) {
|
||||
const modalRef = this.modalService.open(EncuestaDeleteQuestionDialogComponent, { size: 'lg', backdrop: 'static' });
|
||||
modalRef.closed.subscribe(reason => {
|
||||
if (reason === 'confirm') {
|
||||
const id = event.target.dataset.id;
|
||||
if (event.target.dataset.type) {
|
||||
// Delete closed question
|
||||
const questionElement = (event.target as HTMLElement).parentElement?.parentElement;
|
||||
const optionIdsToDelete: number[] = [];
|
||||
|
||||
// Get options IDs
|
||||
questionElement?.childNodes.forEach((e, i) => {
|
||||
if (e.nodeName !== 'DIV') return;
|
||||
if (i === 0) return;
|
||||
if ((e as HTMLElement).dataset.id === undefined) return;
|
||||
if (!(e as HTMLElement).classList.contains('can-delete')) return;
|
||||
let optionId = (e as HTMLElement).dataset.id;
|
||||
optionIdsToDelete.push(+optionId!);
|
||||
});
|
||||
|
||||
if (optionIdsToDelete.length === 0) {
|
||||
this.ePreguntaCerradaService.delete(id).subscribe(e => {
|
||||
this.loadAll();
|
||||
});
|
||||
} else {
|
||||
// Delete question options
|
||||
this.ePreguntaCerradaOpcionService.deleteMany(optionIdsToDelete).subscribe(e => {
|
||||
// Delete question
|
||||
this.ePreguntaCerradaService.delete(id).subscribe(e => {
|
||||
this.loadAll();
|
||||
});
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// Delete open question
|
||||
this.ePreguntaAbiertaService.delete(id).subscribe(e => {
|
||||
this.loadAll();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
deleteOption(event: any): void {
|
||||
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();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
save(): void {
|
||||
this.isSaving = true;
|
||||
const ePreguntaCerradaOpcion = this.createFromForm();
|
||||
if (ePreguntaCerradaOpcion.id !== undefined) {
|
||||
this.subscribeToSaveResponse(this.ePreguntaCerradaOpcionService.update(ePreguntaCerradaOpcion));
|
||||
} else {
|
||||
this.subscribeToSaveResponse(
|
||||
this.ePreguntaCerradaOpcionService.create(ePreguntaCerradaOpcion, this.selectedQuestionToCreateOption?.id!)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
trackEPreguntaCerradaById(index: number, item: IEPreguntaCerrada): number {
|
||||
return item.id!;
|
||||
}
|
||||
|
||||
trackUsuarioExtraById(index: number, item: IUsuarioExtra): number {
|
||||
return item.id!;
|
||||
}
|
||||
|
||||
protected subscribeToSaveResponse(result: Observable<HttpResponse<IEncuesta>>): void {
|
||||
protected subscribeToSaveResponse(result: Observable<HttpResponse<IEPreguntaCerradaOpcion>>): void {
|
||||
result.pipe(finalize(() => this.onSaveFinalize())).subscribe(
|
||||
() => this.onSaveSuccess(),
|
||||
() => this.onSaveError()
|
||||
|
@ -98,7 +275,14 @@ export class EncuestaUpdateComponent implements OnInit {
|
|||
}
|
||||
|
||||
protected onSaveSuccess(): void {
|
||||
this.previousState();
|
||||
// this.previousState();
|
||||
this.resetForm(null);
|
||||
this.ePreguntas = [];
|
||||
this.ePreguntasOpciones = [];
|
||||
this.loadAll();
|
||||
if (!this.createAnother) {
|
||||
$('#cancelBtn').click();
|
||||
}
|
||||
}
|
||||
|
||||
protected onSaveError(): void {
|
||||
|
@ -109,79 +293,221 @@ export class EncuestaUpdateComponent implements OnInit {
|
|||
this.isSaving = false;
|
||||
}
|
||||
|
||||
protected updateForm(encuesta: IEncuesta): void {
|
||||
this.editForm.patchValue({
|
||||
id: encuesta.id,
|
||||
nombre: encuesta.nombre,
|
||||
descripcion: encuesta.descripcion,
|
||||
fechaCreacion: encuesta.fechaCreacion ? encuesta.fechaCreacion.format(DATE_TIME_FORMAT) : null,
|
||||
fechaPublicacion: encuesta.fechaPublicacion ? encuesta.fechaPublicacion.format(DATE_TIME_FORMAT) : null,
|
||||
fechaFinalizar: encuesta.fechaFinalizar ? encuesta.fechaFinalizar.format(DATE_TIME_FORMAT) : null,
|
||||
fechaFinalizada: encuesta.fechaFinalizada ? encuesta.fechaFinalizada.format(DATE_TIME_FORMAT) : null,
|
||||
calificacion: encuesta.calificacion,
|
||||
acceso: encuesta.acceso,
|
||||
contrasenna: encuesta.contrasenna,
|
||||
estado: encuesta.estado,
|
||||
categoria: encuesta.categoria,
|
||||
usuarioExtra: encuesta.usuarioExtra,
|
||||
});
|
||||
|
||||
this.categoriasSharedCollection = this.categoriaService.addCategoriaToCollectionIfMissing(
|
||||
this.categoriasSharedCollection,
|
||||
encuesta.categoria
|
||||
);
|
||||
this.usuarioExtrasSharedCollection = this.usuarioExtraService.addUsuarioExtraToCollectionIfMissing(
|
||||
this.usuarioExtrasSharedCollection,
|
||||
encuesta.usuarioExtra
|
||||
);
|
||||
}
|
||||
|
||||
protected loadRelationshipsOptions(): void {
|
||||
this.categoriaService
|
||||
.query()
|
||||
.pipe(map((res: HttpResponse<ICategoria[]>) => res.body ?? []))
|
||||
.pipe(
|
||||
map((categorias: ICategoria[]) =>
|
||||
this.categoriaService.addCategoriaToCollectionIfMissing(categorias, this.editForm.get('categoria')!.value)
|
||||
)
|
||||
)
|
||||
.subscribe((categorias: ICategoria[]) => (this.categoriasSharedCollection = categorias));
|
||||
|
||||
this.usuarioExtraService
|
||||
.query()
|
||||
.pipe(map((res: HttpResponse<IUsuarioExtra[]>) => res.body ?? []))
|
||||
.pipe(
|
||||
map((usuarioExtras: IUsuarioExtra[]) =>
|
||||
this.usuarioExtraService.addUsuarioExtraToCollectionIfMissing(usuarioExtras, this.editForm.get('usuarioExtra')!.value)
|
||||
)
|
||||
)
|
||||
.subscribe((usuarioExtras: IUsuarioExtra[]) => (this.usuarioExtrasSharedCollection = usuarioExtras));
|
||||
}
|
||||
|
||||
protected createFromForm(): IEncuesta {
|
||||
protected createFromForm(): IEPreguntaCerradaOpcion {
|
||||
return {
|
||||
...new Encuesta(),
|
||||
id: this.editForm.get(['id'])!.value,
|
||||
// ...new EPreguntaCerradaOpcion(),
|
||||
id: undefined,
|
||||
nombre: this.editForm.get(['nombre'])!.value,
|
||||
descripcion: this.editForm.get(['descripcion'])!.value,
|
||||
fechaCreacion: this.editForm.get(['fechaCreacion'])!.value
|
||||
? dayjs(this.editForm.get(['fechaCreacion'])!.value, DATE_TIME_FORMAT)
|
||||
: undefined,
|
||||
fechaPublicacion: this.editForm.get(['fechaPublicacion'])!.value
|
||||
? dayjs(this.editForm.get(['fechaPublicacion'])!.value, DATE_TIME_FORMAT)
|
||||
: undefined,
|
||||
fechaFinalizar: this.editForm.get(['fechaFinalizar'])!.value
|
||||
? dayjs(this.editForm.get(['fechaFinalizar'])!.value, DATE_TIME_FORMAT)
|
||||
: undefined,
|
||||
fechaFinalizada: this.editForm.get(['fechaFinalizada'])!.value
|
||||
? dayjs(this.editForm.get(['fechaFinalizada'])!.value, DATE_TIME_FORMAT)
|
||||
: undefined,
|
||||
calificacion: this.editForm.get(['calificacion'])!.value,
|
||||
acceso: this.editForm.get(['acceso'])!.value,
|
||||
contrasenna: this.editForm.get(['contrasenna'])!.value,
|
||||
estado: this.editForm.get(['estado'])!.value,
|
||||
categoria: this.editForm.get(['categoria'])!.value,
|
||||
usuarioExtra: this.editForm.get(['usuarioExtra'])!.value,
|
||||
orden: 10,
|
||||
cantidad: 0,
|
||||
ePreguntaCerrada: this.selectedQuestionToCreateOption,
|
||||
};
|
||||
}
|
||||
|
||||
createAnotherChange(event: any) {
|
||||
this.createAnother = event.target.checked;
|
||||
}
|
||||
|
||||
createQuestion(): void {
|
||||
const surveyId = this.encuesta?.id;
|
||||
console.log(surveyId);
|
||||
}
|
||||
|
||||
protected createFromFormClosedQuestion(): IEPreguntaCerrada {
|
||||
return {
|
||||
// ...new EPreguntaCerrada(),
|
||||
id: undefined,
|
||||
nombre: this.editFormQuestion.get(['nombre'])!.value,
|
||||
tipo: this.editFormQuestion.get(['tipo'])!.value,
|
||||
opcional: this.editFormQuestion.get(['opcional'])!.value,
|
||||
orden: 10,
|
||||
encuesta: this.encuesta,
|
||||
};
|
||||
}
|
||||
|
||||
protected createFromFormOpenQuestion(): IEPreguntaAbierta {
|
||||
return {
|
||||
// ...new EPreguntaAbierta(),
|
||||
id: undefined,
|
||||
nombre: this.editFormQuestion.get(['nombre'])!.value,
|
||||
opcional: this.editFormQuestion.get(['opcional'])!.value,
|
||||
orden: 10,
|
||||
encuesta: this.encuesta,
|
||||
};
|
||||
}
|
||||
|
||||
createAnotherQuestionChange(event: any) {
|
||||
this.createAnotherQuestion = event.target.checked;
|
||||
}
|
||||
|
||||
saveQuestion(): void {
|
||||
this.isSavingQuestion = true;
|
||||
const tipoPregunta = this.editFormQuestion.get(['tipopregunta'])!.value;
|
||||
|
||||
if (tipoPregunta === 'CLOSED') {
|
||||
const ePreguntaCerrada = this.createFromFormClosedQuestion();
|
||||
if (ePreguntaCerrada.id !== undefined) {
|
||||
this.subscribeToSaveResponseQuestionClosed(this.ePreguntaCerradaService.update(ePreguntaCerrada));
|
||||
} else {
|
||||
this.subscribeToSaveResponseQuestionClosed(this.ePreguntaCerradaService.create(ePreguntaCerrada));
|
||||
}
|
||||
} else if (tipoPregunta === 'OPEN') {
|
||||
const ePreguntaAbierta = this.createFromFormOpenQuestion();
|
||||
if (ePreguntaAbierta.id !== undefined) {
|
||||
this.subscribeToSaveResponseQuestionOpen(this.ePreguntaAbiertaService.update(ePreguntaAbierta));
|
||||
} else {
|
||||
this.subscribeToSaveResponseQuestionOpen(this.ePreguntaAbiertaService.create(ePreguntaAbierta));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected subscribeToSaveResponseQuestionClosed(result: Observable<HttpResponse<IEPreguntaCerrada>>): void {
|
||||
result.pipe(finalize(() => this.onSaveFinalizeQuestion())).subscribe(
|
||||
() => this.onSaveSuccessQuestion(),
|
||||
() => this.onSaveErrorQuestion()
|
||||
);
|
||||
}
|
||||
|
||||
protected subscribeToSaveResponseQuestionOpen(result: Observable<HttpResponse<IEPreguntaAbierta>>): void {
|
||||
result.pipe(finalize(() => this.onSaveFinalizeQuestion())).subscribe(
|
||||
() => this.onSaveSuccessQuestion(),
|
||||
() => this.onSaveErrorQuestion()
|
||||
);
|
||||
}
|
||||
|
||||
protected onSaveSuccessQuestion(): void {
|
||||
this.editFormQuestion.reset({ tipo: PreguntaCerradaTipo.SINGLE, tipopregunta: 'CLOSED', opcional: false });
|
||||
this.editForm.reset();
|
||||
this.ePreguntas = [];
|
||||
this.ePreguntasOpciones = [];
|
||||
this.loadAll();
|
||||
if (!this.createAnotherQuestion) {
|
||||
$('#cancelBtnQuestion').click();
|
||||
}
|
||||
}
|
||||
|
||||
protected onSaveErrorQuestion(): void {
|
||||
// Api for inheritance.
|
||||
}
|
||||
|
||||
protected onSaveFinalizeQuestion(): void {
|
||||
this.isSavingQuestion = false;
|
||||
}
|
||||
|
||||
// previousState(): void {
|
||||
// window.history.back();
|
||||
// }
|
||||
|
||||
// save(): void {
|
||||
// this.isSaving = true;
|
||||
// const encuesta = this.createFromForm();
|
||||
// if (encuesta.id !== undefined) {
|
||||
// this.subscribeToSaveResponse(this.encuestaService.update(encuesta));
|
||||
// } else {
|
||||
// this.subscribeToSaveResponse(this.encuestaService.create(encuesta));
|
||||
// }
|
||||
// }
|
||||
|
||||
trackCategoriaById(index: number, item: ICategoria): number {
|
||||
return item.id!;
|
||||
}
|
||||
|
||||
trackUsuarioExtraById(index: number, item: IUsuarioExtra): number {
|
||||
return item.id!;
|
||||
}
|
||||
|
||||
// protected subscribeToSaveResponse(result: Observable<HttpResponse<IEncuesta>>): void {
|
||||
// result.pipe(finalize(() => this.onSaveFinalize())).subscribe(
|
||||
// () => this.onSaveSuccess(),
|
||||
// () => this.onSaveError()
|
||||
// );
|
||||
// }
|
||||
|
||||
// protected onSaveSuccess(): void {
|
||||
// this.previousState();
|
||||
// }
|
||||
|
||||
// protected onSaveError(): void {
|
||||
// // Api for inheritance.
|
||||
// }
|
||||
|
||||
// protected onSaveFinalize(): void {
|
||||
// this.isSaving = false;
|
||||
// }
|
||||
|
||||
// protected updateForm(encuesta: IEncuesta): void {
|
||||
// this.editForm.patchValue({
|
||||
// id: encuesta.id,
|
||||
// nombre: encuesta.nombre,
|
||||
// descripcion: encuesta.descripcion,
|
||||
// fechaCreacion: encuesta.fechaCreacion ? encuesta.fechaCreacion.format(DATE_TIME_FORMAT) : null,
|
||||
// fechaPublicacion: encuesta.fechaPublicacion ? encuesta.fechaPublicacion.format(DATE_TIME_FORMAT) : null,
|
||||
// fechaFinalizar: encuesta.fechaFinalizar ? encuesta.fechaFinalizar.format(DATE_TIME_FORMAT) : null,
|
||||
// fechaFinalizada: encuesta.fechaFinalizada ? encuesta.fechaFinalizada.format(DATE_TIME_FORMAT) : null,
|
||||
// calificacion: encuesta.calificacion,
|
||||
// acceso: encuesta.acceso,
|
||||
// contrasenna: encuesta.contrasenna,
|
||||
// estado: encuesta.estado,
|
||||
// categoria: encuesta.categoria,
|
||||
// usuarioExtra: encuesta.usuarioExtra,
|
||||
// });
|
||||
|
||||
// this.categoriasSharedCollection = this.categoriaService.addCategoriaToCollectionIfMissing(
|
||||
// this.categoriasSharedCollection,
|
||||
// encuesta.categoria
|
||||
// );
|
||||
// this.usuarioExtrasSharedCollection = this.usuarioExtraService.addUsuarioExtraToCollectionIfMissing(
|
||||
// this.usuarioExtrasSharedCollection,
|
||||
// encuesta.usuarioExtra
|
||||
// );
|
||||
// }
|
||||
|
||||
// protected loadRelationshipsOptions(): void {
|
||||
// this.categoriaService
|
||||
// .query()
|
||||
// .pipe(map((res: HttpResponse<ICategoria[]>) => res.body ?? []))
|
||||
// .pipe(
|
||||
// map((categorias: ICategoria[]) =>
|
||||
// this.categoriaService.addCategoriaToCollectionIfMissing(categorias, this.editForm.get('categoria')!.value)
|
||||
// )
|
||||
// )
|
||||
// .subscribe((categorias: ICategoria[]) => (this.categoriasSharedCollection = categorias));
|
||||
|
||||
// this.usuarioExtraService
|
||||
// .query()
|
||||
// .pipe(map((res: HttpResponse<IUsuarioExtra[]>) => res.body ?? []))
|
||||
// .pipe(
|
||||
// map((usuarioExtras: IUsuarioExtra[]) =>
|
||||
// this.usuarioExtraService.addUsuarioExtraToCollectionIfMissing(usuarioExtras, this.editForm.get('usuarioExtra')!.value)
|
||||
// )
|
||||
// )
|
||||
// .subscribe((usuarioExtras: IUsuarioExtra[]) => (this.usuarioExtrasSharedCollection = usuarioExtras));
|
||||
// }
|
||||
|
||||
// protected createFromForm(): IEncuesta {
|
||||
// return {
|
||||
// ...new Encuesta(),
|
||||
// id: this.editForm.get(['id'])!.value,
|
||||
// nombre: this.editForm.get(['nombre'])!.value,
|
||||
// descripcion: this.editForm.get(['descripcion'])!.value,
|
||||
// fechaCreacion: this.editForm.get(['fechaCreacion'])!.value
|
||||
// ? dayjs(this.editForm.get(['fechaCreacion'])!.value, DATE_TIME_FORMAT)
|
||||
// : undefined,
|
||||
// fechaPublicacion: this.editForm.get(['fechaPublicacion'])!.value
|
||||
// ? dayjs(this.editForm.get(['fechaPublicacion'])!.value, DATE_TIME_FORMAT)
|
||||
// : undefined,
|
||||
// fechaFinalizar: this.editForm.get(['fechaFinalizar'])!.value
|
||||
// ? dayjs(this.editForm.get(['fechaFinalizar'])!.value, DATE_TIME_FORMAT)
|
||||
// : undefined,
|
||||
// fechaFinalizada: this.editForm.get(['fechaFinalizada'])!.value
|
||||
// ? dayjs(this.editForm.get(['fechaFinalizada'])!.value, DATE_TIME_FORMAT)
|
||||
// : undefined,
|
||||
// calificacion: this.editForm.get(['calificacion'])!.value,
|
||||
// acceso: this.editForm.get(['acceso'])!.value,
|
||||
// contrasenna: this.editForm.get(['contrasenna'])!.value,
|
||||
// estado: this.editForm.get(['estado'])!.value,
|
||||
// categoria: this.editForm.get(['categoria'])!.value,
|
||||
// usuarioExtra: this.editForm.get(['usuarioExtra'])!.value,
|
||||
// };
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<div class="logo">
|
||||
<a routerLink="/" class="simple-text">
|
||||
<div class="logo-image-small">
|
||||
<img src="../../../content/img_datasurvey/datasurvey-logo-text.svg" />
|
||||
<img src="../../../content/img_datasurvey/datasurvey-logo-text-white-PNG.png" />
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
@ -103,7 +103,7 @@
|
|||
<li class="position-absolute fixed-bottom w-100 mb-5">
|
||||
<a (click)="logout()" class="p-3 w-100 m-0 text-center">
|
||||
<!-- <i class="nc-icon nc-user-run"></i> -->
|
||||
<p style="letter-spacing: 0.3rem">Cerrar Sesion</p>
|
||||
<p style="letter-spacing: 0.3rem">Cerrar Sesión</p>
|
||||
</a>
|
||||
</li>
|
||||
<li class="position-absolute fixed-bottom w-100 mb-5" style="bottom: -4rem">
|
||||
|
|
|
@ -61,8 +61,11 @@ export class SidebarComponent {
|
|||
if (account !== null) {
|
||||
this.usuarioExtraService.find(account.id).subscribe(usuarioExtra => {
|
||||
this.usuarioExtra = usuarioExtra.body;
|
||||
this.usuarioExtra!.nombre =
|
||||
usuarioExtra.body!.nombre!.trim().split(' ')[0] + ' ' + usuarioExtra.body!.nombre!.trim().split(' ')[1];
|
||||
const fullName = this.usuarioExtra!.nombre;
|
||||
const firstName = fullName?.split(' ')[0] === undefined ? '' : fullName?.split(' ')[0];
|
||||
const lastName = fullName?.split(' ')[1] === undefined ? '' : fullName?.split(' ')[1];
|
||||
|
||||
this.usuarioExtra!.nombre = `${firstName} ${lastName}`;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 74 KiB |
|
@ -1 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 2528.24 410.62"><defs><style>.cls-1{font-size:300px;fill:#282828;font-family:Avenir-Heavy, "Avenir 85 Heavy";font-weight:800;}.cls-2{fill:#1072e8;}.cls-3{opacity:0.3;isolation:isolate;}.cls-4{fill:#2f92dd;}</style></defs><title>Asset 5</title><g id="Layer_2" data-name="Layer 2"><g id="Quantum"><text class="cls-1" transform="translate(540.01 301.05)">DATASURVEY</text><g id="Logo"><path class="cls-2" d="M210,210v99.82l-.72.15H110V210Z"/><path class="cls-2" d="M406.53,209.47c0,69.41-38.34,130.67-96.74,167.11a234.09,234.09,0,0,1-99.79,34V309.78c55.73-11.31,97-51.71,97-99.81,0-46-37.74-85-89.8-98.19A58.58,58.58,0,0,0,202.63,110H110V210H10V80H80V10H193.46c48,0,95.09,14.89,133.34,44.07C375.53,91.21,406.53,147,406.53,209.47Z"/><image class="cls-3" width="89" height="89" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFkAAABZCAYAAABVC4ivAAAACXBIWXMAAAsSAAALEgHS3X78AAAIBElEQVR4Xu3d3VLiTBcF4LV354eIyIBazOEceAfeAJfuDXg4Z96ARfnVG/GHkO5e30E6DCKIKM4IZFVRapmK8Ljd6VDlbiGJJl8bXXdAk88nWndAk9cREZn/mmvaQYP8zszBvgAO3wOwGrtBXpMFXBkOhzIej2fQnU6HV1dXBMBV2NJc+FYnAAsAuby81DzPdTKZ6GAwkLIsJY5j3t7estVq+W6366+vrz0AonKewTbIKzIHrBcXF6bb7Zo8z6Msy0xZlgoAxhjGcezLsrR5nrvBYGADtG+Q16QGvry8NHd3d6bdbkcAEgCJMSYyxhiSYq11zjlLckpyWhRF+evXL3t1deUxV81NT17IInAURUmSJGlZlq0oilre+xSAEREYY2ySJIW11kynU7TbbY5Go1nLqM/ZrJPnMg98e3sbRVGUtFqtzDl3rKpdkj1jzKlz7sw5dyoiP5xzHVXNsixL4ziO8jw3w+HwxQqkqeSQReAkSZI0TTMAbVXti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mUwmAgBFURwU7nzqG41Wq8X5DQ/DY+nukm9uFTeHDbzuuYcIvYj16sZjWTbej28B/iDzFuiybIzcZPP8H+Y/C/188ppfAAAAAElFTkSuQmCC"/><polygon class="cls-4" points="80 10.36 80 80 10.35 80 80 10.36"/></g></g></g></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 2528.24 410.62"><defs><style>.cls-1{font-size:285px;fill:#282828;font-family:"Noto Sans JP", "Helvetica Neue";font-weight:800;}.cls-2{fill:#1072e8;}.cls-3{opacity:0.3;isolation:isolate;}.cls-4{fill:#2f92dd;}</style></defs><title>Asset 5</title><g id="Layer_2" data-name="Layer 2"><g id="Quantum"><text class="cls-1" transform="translate(540.01 301.05)">DATASURVEY</text><g id="Logo"><path class="cls-2" d="M210,210v99.82l-.72.15H110V210Z"/><path class="cls-2" d="M406.53,209.47c0,69.41-38.34,130.67-96.74,167.11a234.09,234.09,0,0,1-99.79,34V309.78c55.73-11.31,97-51.71,97-99.81,0-46-37.74-85-89.8-98.19A58.58,58.58,0,0,0,202.63,110H110V210H10V80H80V10H193.46c48,0,95.09,14.89,133.34,44.07C375.53,91.21,406.53,147,406.53,209.47Z"/><image class="cls-3" width="89" height="89" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFkAAABZCAYAAABVC4ivAAAACXBIWXMAAAsSAAALEgHS3X78AAAIBElEQVR4Xu3d3VLiTBcF4LV354eIyIBazOEceAfeAJfuDXg4Z96ARfnVG/GHkO5e30E6DCKIKM4IZFVRapmK8Ljd6VDlbiGJJl8bXXdAk88nWndAk9cREZn/mmvaQYP8zszBvgAO3wOwGrtBXpMFXBkOhzIej2fQnU6HV1dXBMBV2NJc+FYnAAsAuby81DzPdTKZ6GAwkLIsJY5j3t7estVq+W6366+vrz0AonKewTbIKzIHrBcXF6bb7Zo8z6Msy0xZlgoAxhjGcezLsrR5nrvBYGADtG+Q16QGvry8NHd3d6bd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MdP7+3v3+/fvF1sSAXi991NdzZeXl1rvexTHcWSMiYqiMHEcG+eceu8lTdMZ7MLQ/L3I/HsRk8kEIkJjjLfWuiRJnLXWTqdT2+/3bQB2wDt2MZtbIchwOJTRaKR5npt+v6/OOSmKQrvdrgDAsiH5+xxjDPM8pzGGaZr6drvtR6PRm9vEAUuQgT9rZsxhj8djmUwmAgBFURwU7nzqG41Wq8X5DQ/DY+nukm9uFTeHDbzuuYcIvYj16sZjWTbej28B/iDzFuiybIzcZPP8H+Y/C/188ppfAAAAAElFTkSuQmCC"/><polygon class="cls-4" points="80 10.36 80 80 10.35 80 80 10.36"/></g></g></g></svg>
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
Binary file not shown.
After Width: | Height: | Size: 70 KiB |
|
@ -98,3 +98,4 @@
|
|||
@import 'paper-dashboard/datasurvey-list';
|
||||
@import 'paper-dashboard/datasurvey-table';
|
||||
@import 'paper-dashboard/datasurvey-contextmenu';
|
||||
@import 'paper-dashboard/datasurvey-survey-update';
|
||||
|
|
|
@ -61,12 +61,21 @@
|
|||
}
|
||||
|
||||
.ds-btn--danger {
|
||||
background-color: transparent;
|
||||
color: #e73636;
|
||||
background-color: #e73636;
|
||||
color: #fff;
|
||||
|
||||
&:hover {
|
||||
background-color: #f7f9ff;
|
||||
color: #d33232;
|
||||
background-color: #d33232;
|
||||
}
|
||||
|
||||
&--light {
|
||||
background-color: transparent;
|
||||
color: #e73636;
|
||||
|
||||
&:hover {
|
||||
background-color: #f7f9ff;
|
||||
color: #d33232;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,9 @@ $form-background: #f1f5f9;
|
|||
}
|
||||
|
||||
label {
|
||||
font-size: 0.8rem;
|
||||
color: #757d94;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
margin: 1rem;
|
||||
word-wrap: break-word;
|
||||
|
||||
*:not(div) {
|
||||
* {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
|
@ -78,6 +78,7 @@
|
|||
width: 25px;
|
||||
height: 25px;
|
||||
color: #313747;
|
||||
pointer-events: visible !important;
|
||||
}
|
||||
|
||||
.entity-share:hover {
|
||||
|
|
|
@ -13,6 +13,12 @@
|
|||
.modal-footer {
|
||||
border: none;
|
||||
padding: 2rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
label {
|
||||
margin: 0 0.2rem 0 0;
|
||||
}
|
||||
}
|
||||
|
||||
.modal-body {
|
||||
|
|
|
@ -0,0 +1,164 @@
|
|||
.ds-survey {
|
||||
display: flex;
|
||||
|
||||
&--titulo {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
&--name {
|
||||
color: #1f3779;
|
||||
}
|
||||
|
||||
&--icon {
|
||||
border-radius: 50%;
|
||||
background-color: #f1f5f9;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
transition: background-color 0.2s ease-in-out;
|
||||
font-size: 1rem;
|
||||
padding: 0.8rem;
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
color: #1f3779;
|
||||
pointer-events: visible !important;
|
||||
transition: all 0.1s ease-in-out;
|
||||
|
||||
* {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background-color: #e73636;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
&--small {
|
||||
font-size: 0.8rem;
|
||||
padding: 0.3rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&--all-question-wrapper {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border: 2px dashed #f1f1f1;
|
||||
border-radius: $border-radius-x-large;
|
||||
padding: 2rem 5rem;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
&--question-wrapper {
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
&--question {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
font-size: 1.2rem;
|
||||
color: #15131d;
|
||||
padding: 2rem;
|
||||
border-bottom: 1px solid #e9e9e9;
|
||||
}
|
||||
|
||||
&--option {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin: 0.5rem 0;
|
||||
border-radius: 5px;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.025rem;
|
||||
color: #787878;
|
||||
background-color: transparent;
|
||||
position: relative;
|
||||
top: 0;
|
||||
transition: all 0.1s ease-in-out;
|
||||
|
||||
&--base {
|
||||
border: 1px solid #e6e6e6;
|
||||
}
|
||||
|
||||
&--add {
|
||||
border: 2px dashed #9c9c9c;
|
||||
transition: all 0.1s ease-in-out;
|
||||
|
||||
&:hover {
|
||||
border: 2px dashed #727272;
|
||||
}
|
||||
|
||||
&:hover .ds-survey--add-option {
|
||||
color: #727272;
|
||||
}
|
||||
|
||||
&:hover .ds-survey--add-option--icon {
|
||||
color: #727272;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&--closed-option {
|
||||
display: flex;
|
||||
width: 25rem;
|
||||
align-items: center;
|
||||
font-size: 0.9rem;
|
||||
color: #15131d;
|
||||
padding: 1rem;
|
||||
transition: all 0.1s ease-in-out;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
|
||||
label {
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
color: #1f3779;
|
||||
}
|
||||
}
|
||||
|
||||
&--open-option {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 0.9rem;
|
||||
color: #15131d;
|
||||
transition: all 0.1s ease-in-out;
|
||||
position: relative;
|
||||
|
||||
& textarea {
|
||||
width: 25rem;
|
||||
height: 20rem;
|
||||
padding: 1rem 3rem;
|
||||
color: #787878;
|
||||
border: none;
|
||||
resize: none;
|
||||
|
||||
&:disabled {
|
||||
background-color: transparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&--add-option {
|
||||
width: 100%;
|
||||
color: #919191;
|
||||
transition: all 0.1s ease-in-out;
|
||||
pointer-events: none;
|
||||
|
||||
&--icon {
|
||||
margin: 0 1rem;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
color: #919191;
|
||||
pointer-events: visible !important;
|
||||
transition: all 0.1s ease-in-out;
|
||||
|
||||
* {
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -23,7 +23,8 @@
|
|||
"opcional": "Opcional",
|
||||
"orden": "Orden",
|
||||
"ePreguntaCerradaOpcion": "E Pregunta Cerrada Opcion",
|
||||
"encuesta": "Encuesta"
|
||||
"encuesta": "Encuesta",
|
||||
"tiporespuesta": "Tipo de respuesta"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,9 @@
|
|||
"updated": "Una encuesta ha sido actualizado con el identificador {{ param }}",
|
||||
"deleted": "Una encuesta ha sido eliminada con el identificador {{ param }}",
|
||||
"delete": {
|
||||
"question": "¿Seguro que quiere eliminar la encuesta {{ id }}?"
|
||||
"question": "¿Seguro que quiere eliminar la encuesta {{ id }}?",
|
||||
"deletequestion": "¿Seguro que quiere eliminar esta pregunta?",
|
||||
"deleteoption": "¿Seguro que quiere eliminar esta opción?"
|
||||
},
|
||||
"detail": {
|
||||
"title": "Encuesta"
|
||||
|
|
Loading…
Reference in New Issue