diff --git a/src/main/java/org/datasurvey/web/rest/EPreguntaCerradaOpcionResource.java b/src/main/java/org/datasurvey/web/rest/EPreguntaCerradaOpcionResource.java index 61604a7..07e194d 100644 --- a/src/main/java/org/datasurvey/web/rest/EPreguntaCerradaOpcionResource.java +++ b/src/main/java/org/datasurvey/web/rest/EPreguntaCerradaOpcionResource.java @@ -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 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 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(); + } } diff --git a/src/main/java/org/datasurvey/web/rest/EncuestaResource.java b/src/main/java/org/datasurvey/web/rest/EncuestaResource.java index 7245119..e3e4b11 100644 --- a/src/main/java/org/datasurvey/web/rest/EncuestaResource.java +++ b/src/main/java/org/datasurvey/web/rest/EncuestaResource.java @@ -2,14 +2,21 @@ 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.domain.enumeration.AccesoEncuesta; import org.datasurvey.repository.EncuestaRepository; +import org.datasurvey.service.*; import org.datasurvey.service.EncuestaQueryService; import org.datasurvey.service.EncuestaService; import org.datasurvey.service.MailService; @@ -45,16 +52,28 @@ public class EncuestaResource { private final MailService mailService; + private final EPreguntaCerradaService ePreguntaCerradaService; + + private final EPreguntaAbiertaService ePreguntaAbiertaService; + + private final EPreguntaCerradaOpcionService ePreguntaCerradaOpcionService; + public EncuestaResource( EncuestaService encuestaService, EncuestaRepository encuestaRepository, EncuestaQueryService encuestaQueryService, - MailService mailService + MailService mailService, + EPreguntaCerradaService ePreguntaCerradaService, + EPreguntaAbiertaService ePreguntaAbiertaService, + EPreguntaCerradaOpcionService ePreguntaCerradaOpcionService ) { this.encuestaService = encuestaService; this.encuestaRepository = encuestaRepository; this.encuestaQueryService = encuestaQueryService; this.mailService = mailService; + this.ePreguntaCerradaService = ePreguntaCerradaService; + this.ePreguntaAbiertaService = ePreguntaAbiertaService; + this.ePreguntaCerradaOpcionService = ePreguntaCerradaOpcionService; } /** @@ -80,7 +99,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, @@ -120,7 +139,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, @@ -166,6 +185,55 @@ public class EncuestaResource { return ResponseEntity.ok().body(entityList); } + @GetMapping("/encuestas/preguntas/{id}") + public ResponseEntity> getPreguntasByIdEncuesta(@PathVariable Long id) { + List preguntasCerradas = ePreguntaCerradaService.findAll(); + List preguntasAbiertas = ePreguntaAbiertaService.findAll(); + List preguntas = Stream.concat(preguntasCerradas.stream(), preguntasAbiertas.stream()).collect(Collectors.toList()); + List 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>> getPreguntaCerradaOpcionByIdEncuesta(@PathVariable Long id) { + List> res = new ArrayList<>(); + List preguntasCerradas = ePreguntaCerradaService.findAll(); + List preguntasCerradasFiltered = preguntasCerradas + .stream() + .filter(p -> Objects.nonNull(p.getEncuesta())) + .filter(p -> p.getEncuesta().getId().equals(id)) + .collect(Collectors.toList()); + List opciones = ePreguntaCerradaOpcionService.findAll(); + + for (EPreguntaCerrada ePreguntaCerrada : preguntasCerradasFiltered) { + long preguntaCerradaId = ePreguntaCerrada.getId(); + List 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. * diff --git a/src/main/webapp/app/entities/e-pregunta-cerrada-opcion/service/e-pregunta-cerrada-opcion.service.ts b/src/main/webapp/app/entities/e-pregunta-cerrada-opcion/service/e-pregunta-cerrada-opcion.service.ts index a3daca3..0f02ff1 100644 --- a/src/main/webapp/app/entities/e-pregunta-cerrada-opcion/service/e-pregunta-cerrada-opcion.service.ts +++ b/src/main/webapp/app/entities/e-pregunta-cerrada-opcion/service/e-pregunta-cerrada-opcion.service.ts @@ -16,8 +16,8 @@ export class EPreguntaCerradaOpcionService { constructor(protected http: HttpClient, protected applicationConfigService: ApplicationConfigService) {} - create(ePreguntaCerradaOpcion: IEPreguntaCerradaOpcion): Observable { - return this.http.post(this.resourceUrl, ePreguntaCerradaOpcion, { observe: 'response' }); + create(ePreguntaCerradaOpcion: IEPreguntaCerradaOpcion, preguntaId?: number): Observable { + return this.http.post(`${this.resourceUrl}/${preguntaId}`, ePreguntaCerradaOpcion, { observe: 'response' }); } update(ePreguntaCerradaOpcion: IEPreguntaCerradaOpcion): Observable { @@ -49,6 +49,10 @@ export class EPreguntaCerradaOpcionService { return this.http.delete(`${this.resourceUrl}/${id}`, { observe: 'response' }); } + deleteMany(ids: number[]): Observable { + return this.http.post(`${this.resourceUrl}/deleteMany`, ids, { observe: 'response' }); + } + addEPreguntaCerradaOpcionToCollectionIfMissing( ePreguntaCerradaOpcionCollection: IEPreguntaCerradaOpcion[], ...ePreguntaCerradaOpcionsToCheck: (IEPreguntaCerradaOpcion | null | undefined)[] diff --git a/src/main/webapp/app/entities/encuesta/delete/encuesta-delete-dialog.component.html b/src/main/webapp/app/entities/encuesta/delete/encuesta-delete-dialog.component.html index 5ac2f58..89c4a44 100644 --- a/src/main/webapp/app/entities/encuesta/delete/encuesta-delete-dialog.component.html +++ b/src/main/webapp/app/entities/encuesta/delete/encuesta-delete-dialog.component.html @@ -1,6 +1,6 @@ -
+ @@ -14,11 +14,11 @@ diff --git a/src/main/webapp/app/entities/encuesta/delete/encuesta-delete-dialog.component.ts b/src/main/webapp/app/entities/encuesta/delete/encuesta-delete-dialog.component.ts index 9c56c0e..713e0bb 100644 --- a/src/main/webapp/app/entities/encuesta/delete/encuesta-delete-dialog.component.ts +++ b/src/main/webapp/app/entities/encuesta/delete/encuesta-delete-dialog.component.ts @@ -1,9 +1,8 @@ import { Component } from '@angular/core'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; -import { EstadoEncuesta } from 'app/entities/enumerations/estado-encuesta.model'; - import { IEncuesta } from '../encuesta.model'; import { EncuestaService } from '../service/encuesta.service'; +import { EstadoEncuesta } from 'app/entities/enumerations/estado-encuesta.model'; @Component({ templateUrl: './encuesta-delete-dialog.component.html', @@ -17,9 +16,9 @@ export class EncuestaDeleteDialogComponent { this.activeModal.dismiss(); } - confirmDelete(encuesta: IEncuesta): void { - encuesta.estado = EstadoEncuesta.DELETED; - this.encuestaService.update(encuesta).subscribe(() => { + confirmDelete(encuest: IEncuesta): void { + encuest.estado = EstadoEncuesta.DELETED; + this.encuestaService.deleteEncuesta(encuest).subscribe(() => { this.activeModal.close('deleted'); }); } diff --git a/src/main/webapp/app/entities/encuesta/encuesta-delete-option-dialog/encuesta-delete-option-dialog.component.html b/src/main/webapp/app/entities/encuesta/encuesta-delete-option-dialog/encuesta-delete-option-dialog.component.html new file mode 100644 index 0000000..40356a0 --- /dev/null +++ b/src/main/webapp/app/entities/encuesta/encuesta-delete-option-dialog/encuesta-delete-option-dialog.component.html @@ -0,0 +1,25 @@ + + + + + + +
diff --git a/src/main/webapp/app/entities/encuesta/encuesta-delete-option-dialog/encuesta-delete-option-dialog.component.ts b/src/main/webapp/app/entities/encuesta/encuesta-delete-option-dialog/encuesta-delete-option-dialog.component.ts new file mode 100644 index 0000000..82d1896 --- /dev/null +++ b/src/main/webapp/app/entities/encuesta/encuesta-delete-option-dialog/encuesta-delete-option-dialog.component.ts @@ -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'); + } +} diff --git a/src/main/webapp/app/entities/encuesta/encuesta-delete-question-dialog/encuesta-delete-question-dialog.component.html b/src/main/webapp/app/entities/encuesta/encuesta-delete-question-dialog/encuesta-delete-question-dialog.component.html new file mode 100644 index 0000000..fd2c58c --- /dev/null +++ b/src/main/webapp/app/entities/encuesta/encuesta-delete-question-dialog/encuesta-delete-question-dialog.component.html @@ -0,0 +1,25 @@ +
+ + + + + +
diff --git a/src/main/webapp/app/entities/encuesta/encuesta-delete-question-dialog/encuesta-delete-question-dialog.component.ts b/src/main/webapp/app/entities/encuesta/encuesta-delete-question-dialog/encuesta-delete-question-dialog.component.ts new file mode 100644 index 0000000..56c7347 --- /dev/null +++ b/src/main/webapp/app/entities/encuesta/encuesta-delete-question-dialog/encuesta-delete-question-dialog.component.ts @@ -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'); + } +} diff --git a/src/main/webapp/app/entities/encuesta/encuesta.module.ts b/src/main/webapp/app/entities/encuesta/encuesta.module.ts index 7b1d91e..86a1c11 100644 --- a/src/main/webapp/app/entities/encuesta/encuesta.module.ts +++ b/src/main/webapp/app/entities/encuesta/encuesta.module.ts @@ -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], }) diff --git a/src/main/webapp/app/entities/encuesta/list/encuesta.component.html b/src/main/webapp/app/entities/encuesta/list/encuesta.component.html index 6a4288a..ef79ed4 100644 --- a/src/main/webapp/app/entities/encuesta/list/encuesta.component.html +++ b/src/main/webapp/app/entities/encuesta/list/encuesta.component.html @@ -40,6 +40,45 @@ No surveys found +
+
+
+
+ +
+
+
+ +
+
+
+ +
+ +
+
+
@@ -85,17 +124,22 @@
  • - +
  • -
    @@ -165,21 +209,55 @@
    + +
    + No se encontraron preguntas +
    + +
    +
    +
    +
    +
    + {{ i + 1 }}. {{ ePregunta.nombre }} + +
    +
    + Pregunta de respuesta {{ 'dataSurveyApp.PreguntaCerradaTipo.SINGLE' | translate | lowercase }} + {{ ePregunta.opcional ? '(opcional)' : '' }} + Pregunta de respuesta {{ 'dataSurveyApp.PreguntaCerradaTipo.MULTIPLE' | translate | lowercase }} + {{ ePregunta.opcional ? '(opcional)' : '' }} + Pregunta de respuesta abierta {{ ePregunta.opcional ? '(opcional)' : '' }} +
    + + + + +
    + + + +
    +
    +
    +
    +
    + + Añadir opción +
    +
    +
    + +
    +
    +
    +
    + + +
    +
    + + + + + + + + + + + + diff --git a/src/main/webapp/app/entities/encuesta/update/encuesta-update.component.spec.ts b/src/main/webapp/app/entities/encuesta/update/encuesta-update.component.tmpSpec.ts similarity index 100% rename from src/main/webapp/app/entities/encuesta/update/encuesta-update.component.spec.ts rename to src/main/webapp/app/entities/encuesta/update/encuesta-update.component.tmpSpec.ts 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 5ac48c3..f7787b4 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,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>): void { + protected subscribeToSaveResponse(result: Observable>): 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) => 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) => 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>): void { + result.pipe(finalize(() => this.onSaveFinalizeQuestion())).subscribe( + () => this.onSaveSuccessQuestion(), + () => this.onSaveErrorQuestion() + ); + } + + protected subscribeToSaveResponseQuestionOpen(result: Observable>): 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>): 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) => 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) => 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, + // }; + // } } diff --git a/src/main/webapp/app/entities/usuario-extra/list/usuario-extra.component.html b/src/main/webapp/app/entities/usuario-extra/list/usuario-extra.component.html index 9ccef39..abbc9e8 100644 --- a/src/main/webapp/app/entities/usuario-extra/list/usuario-extra.component.html +++ b/src/main/webapp/app/entities/usuario-extra/list/usuario-extra.component.html @@ -22,7 +22,23 @@
    No usuarioExtras found
    - +
    +
    +
    +
    + +
    +
    +
    + +
    +
    +
    @@ -37,7 +53,13 @@ - +
    • diff --git a/src/main/webapp/app/entities/usuario-extra/list/usuario-extra.component.ts b/src/main/webapp/app/entities/usuario-extra/list/usuario-extra.component.ts index 49199d8..dd5e8f0 100644 --- a/src/main/webapp/app/entities/usuario-extra/list/usuario-extra.component.ts +++ b/src/main/webapp/app/entities/usuario-extra/list/usuario-extra.component.ts @@ -18,8 +18,13 @@ export class UsuarioExtraComponent implements OnInit { publicUsers?: IUser[]; isLoading = false; successChange = false; + public searchNombreUsuario: string; + public searchEstadoUsuario: string; - constructor(protected usuarioExtraService: UsuarioExtraService, protected modalService: NgbModal) {} + constructor(protected usuarioExtraService: UsuarioExtraService, protected modalService: NgbModal) { + this.searchNombreUsuario = ''; + this.searchEstadoUsuario = ''; + } loadPublicUser(): void { this.usuarioExtraService @@ -61,6 +66,8 @@ export class UsuarioExtraComponent implements OnInit { } ngOnInit(): void { + this.searchNombreUsuario = ''; + this.searchEstadoUsuario = ''; this.loadAll(); } diff --git a/src/main/webapp/app/home/home.component.html b/src/main/webapp/app/home/home.component.html index 80b9fdf..26f9cde 100644 --- a/src/main/webapp/app/home/home.component.html +++ b/src/main/webapp/app/home/home.component.html @@ -1,78 +1,272 @@
      -
      - -
      +
      + + diff --git a/src/main/webapp/app/layouts/sidebar/sidebar.component.html b/src/main/webapp/app/layouts/sidebar/sidebar.component.html index 0c862fa..04fe706 100644 --- a/src/main/webapp/app/layouts/sidebar/sidebar.component.html +++ b/src/main/webapp/app/layouts/sidebar/sidebar.component.html @@ -1,7 +1,7 @@ @@ -103,7 +103,7 @@
    • -

      Cerrar Sesion

      +

      Cerrar Sesión

    • diff --git a/src/main/webapp/app/layouts/sidebar/sidebar.component.ts b/src/main/webapp/app/layouts/sidebar/sidebar.component.ts index 93e4ddb..7632d25 100644 --- a/src/main/webapp/app/layouts/sidebar/sidebar.component.ts +++ b/src/main/webapp/app/layouts/sidebar/sidebar.component.ts @@ -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}`; }); } }); diff --git a/src/main/webapp/content/css/loading-2.css b/src/main/webapp/content/css/loading-2.css new file mode 100644 index 0000000..01f9598 --- /dev/null +++ b/src/main/webapp/content/css/loading-2.css @@ -0,0 +1,57 @@ +.app-loading .container { + margin: auto auto; + height: 100vh; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} +.app-loading .tittle { + margin-bottom: 40px; + color: #44b9ff; + letter-spacing: 4px; + text-transform: uppercase; +} +.app-loading .square-container { + list-style-type: none; + display: flex; + position: relative; +} +.app-loading .square { + margin: 4px; + width: 30px; + height: 30px; + border-radius: 7px; + animation: rotating 2s ease infinite; +} +.app-loading .square1 { + background: #192e4d; + animation-delay: 0.2s; +} +.app-loading .square2 { + background: #018adf; + animation-delay: 0.4s; +} +.app-loading .square3 { + background: #20a9fe; + animation-delay: 0.6s; +} +.app-loading .square4 { + background: #00e0ac; + animation-delay: 0.8s; +} +.app-loading .square5 { + background: #70ffde; + animation-delay: 1s; +} +@keyframes rotating { + 0% { + transform: rotate(0) scale(1); + } + 50% { + transform: rotate(90deg) scale(0.6); + } + 100% { + transform: rotate(90deg) scale(1); + } +} diff --git a/src/main/webapp/content/css/loading-boxes.css b/src/main/webapp/content/css/loading-boxes.css new file mode 100644 index 0000000..4c4bd36 --- /dev/null +++ b/src/main/webapp/content/css/loading-boxes.css @@ -0,0 +1,199 @@ +.loader { + height: 100%; + width: 100%; +} +.loader .l_main { + position: absolute; + top: 20%; + left: 50%; + width: 172px; + height: 128px; + margin: 0; + -webkit-transform: translate(-50%, -50%); + transform: translate(-50%, -50%); +} +@media (max-width: 550px) { + .loader { + -webkit-transform: scale(0.75); + transform: scale(0.75); + } +} +@media (max-width: 440px) { + .loader { + -webkit-transform: scale(0.5); + transform: scale(0.5); + } +} +.l_square { + position: relative; +} +.l_square:nth-child(1) { + margin-left: 0px; +} +.l_square:nth-child(2) { + margin-left: 44px; +} +.l_square:nth-child(3) { + margin-left: 88px; +} +.l_square:nth-child(4) { + margin-left: 132px; +} +.l_square span { + position: absolute; + top: 0px; + left: 20px; + height: 36px; + width: 36px; + border-radius: 2px; + background-color: #1c44b2; +} +.l_square span:nth-child(1) { + top: 0px; +} +.l_square span:nth-child(2) { + top: 44px; +} +.l_square span:nth-child(3) { + top: 88px; +} +.l_square:nth-child(1) span { + -webkit-animation: animsquare1 2s infinite ease-in; + animation: animsquare1 2s infinite ease-in; +} +.l_square:nth-child(2) span { + -webkit-animation: animsquare2 2s infinite ease-in; + animation: animsquare2 2s infinite ease-in; +} +.l_square:nth-child(3) span { + -webkit-animation: animsquare3 2s infinite ease-in; + animation: animsquare3 2s infinite ease-in; +} +.l_square:nth-child(4) span { + -webkit-animation: animsquare4 2s infinite ease-in; + animation: animsquare4 2s infinite ease-in; +} +.l_square span:nth-child(1) { + -webkit-animation-delay: 0s; + animation-delay: 0s; +} +.l_square span:nth-child(2) { + -webkit-animation-delay: 0.15s; + animation-delay: 0.15s; +} +.l_square span:nth-child(3) { + -webkit-animation-delay: 0.3s; + animation-delay: 0.3s; +} +@-webkit-keyframes animsquare1 { + 0%, + 5%, + 95%, + 100% { + -webkit-transform: translate(0px, 0px) rotate(0deg); + transform: translate(0px, 0px) rotate(0deg); + } + 30%, + 70% { + -webkit-transform: translate(-40px, 0px) rotate(-90deg); + transform: translate(-40px, 0px) rotate(-90deg); + } +} +@keyframes animsquare1 { + 0%, + 5%, + 95%, + 100% { + -webkit-transform: translate(0px, 0px) rotate(0deg); + transform: translate(0px, 0px) rotate(0deg); + } + 30%, + 70% { + -webkit-transform: translate(-40px, 0px) rotate(-90deg); + transform: translate(-40px, 0px) rotate(-90deg); + } +} +@-webkit-keyframes animsquare2 { + 0%, + 10%, + 90%, + 100% { + -webkit-transform: translate(0px, 0px) rotate(0deg); + transform: translate(0px, 0px) rotate(0deg); + } + 35%, + 65% { + -webkit-transform: translate(-40px, 0px) rotate(-90deg); + transform: translate(-40px, 0px) rotate(-90deg); + } +} +@keyframes animsquare2 { + 0%, + 10%, + 90%, + 100% { + -webkit-transform: translate(0px, 0px) rotate(0deg); + transform: translate(0px, 0px) rotate(0deg); + } + 35%, + 65% { + -webkit-transform: translate(-40px, 0px) rotate(-90deg); + transform: translate(-40px, 0px) rotate(-90deg); + } +} +@-webkit-keyframes animsquare3 { + 0%, + 15%, + 85%, + 100% { + -webkit-transform: translate(0px, 0px) rotate(0deg); + transform: translate(0px, 0px) rotate(0deg); + } + 40%, + 60% { + -webkit-transform: translate(-40px, 0px) rotate(-90deg); + transform: translate(-40px, 0px) rotate(-90deg); + } +} +@keyframes animsquare3 { + 0%, + 15%, + 85%, + 100% { + -webkit-transform: translate(0px, 0px) rotate(0deg); + transform: translate(0px, 0px) rotate(0deg); + } + 40%, + 60% { + -webkit-transform: translate(-40px, 0px) rotate(-90deg); + transform: translate(-40px, 0px) rotate(-90deg); + } +} +@-webkit-keyframes animsquare4 { + 0%, + 20%, + 80%, + 100% { + -webkit-transform: translate(0px, 0px) rotate(0deg); + transform: translate(0px, 0px) rotate(0deg); + } + 45%, + 55% { + -webkit-transform: translate(-40px, 0px) rotate(-90deg); + transform: translate(-40px, 0px) rotate(-90deg); + } +} +@keyframes animsquare4 { + 0%, + 20%, + 80%, + 100% { + -webkit-transform: translate(0px, 0px) rotate(0deg); + transform: translate(0px, 0px) rotate(0deg); + } + 45%, + 55% { + -webkit-transform: translate(-40px, 0px) rotate(-90deg); + transform: translate(-40px, 0px) rotate(-90deg); + } +} diff --git a/src/main/webapp/content/css/loading.css b/src/main/webapp/content/css/loading.css index b2c6626..b2f5d31 100644 --- a/src/main/webapp/content/css/loading.css +++ b/src/main/webapp/content/css/loading.css @@ -102,7 +102,7 @@ font-weight: normal; } -.app-loading .lds-pacman { +/*.app-loading .lds-pacman { position: relative; margin: auto; width: 200px !important; @@ -149,4 +149,4 @@ .app-loading .lds-pacman > div:nth-child(1) div:nth-child(3) { -webkit-animation-delay: 0s; animation-delay: 0s; -} +}*/ diff --git a/src/main/webapp/content/img_datasurvey/background encuestas landing.png b/src/main/webapp/content/img_datasurvey/background encuestas landing.png new file mode 100644 index 0000000..e4e1f3d Binary files /dev/null and b/src/main/webapp/content/img_datasurvey/background encuestas landing.png differ diff --git a/src/main/webapp/content/img_datasurvey/banner1.webp b/src/main/webapp/content/img_datasurvey/banner1.webp new file mode 100644 index 0000000..bc6de52 Binary files /dev/null and b/src/main/webapp/content/img_datasurvey/banner1.webp differ diff --git a/src/main/webapp/content/img_datasurvey/banner2.png b/src/main/webapp/content/img_datasurvey/banner2.png new file mode 100644 index 0000000..1e64ef1 Binary files /dev/null and b/src/main/webapp/content/img_datasurvey/banner2.png differ diff --git a/src/main/webapp/content/img_datasurvey/banner2.webp b/src/main/webapp/content/img_datasurvey/banner2.webp new file mode 100644 index 0000000..e4be6b4 Binary files /dev/null and b/src/main/webapp/content/img_datasurvey/banner2.webp differ diff --git a/src/main/webapp/content/img_datasurvey/datasurvey-logo-text-black-PNG.png b/src/main/webapp/content/img_datasurvey/datasurvey-logo-text-black-PNG.png new file mode 100644 index 0000000..0452249 Binary files /dev/null and b/src/main/webapp/content/img_datasurvey/datasurvey-logo-text-black-PNG.png differ diff --git a/src/main/webapp/content/img_datasurvey/datasurvey-logo-text-black.svg b/src/main/webapp/content/img_datasurvey/datasurvey-logo-text-black.svg index 4ae0c82..293be43 100644 --- a/src/main/webapp/content/img_datasurvey/datasurvey-logo-text-black.svg +++ b/src/main/webapp/content/img_datasurvey/datasurvey-logo-text-black.svg @@ -1 +1 @@ -Asset 5DATASURVEY \ No newline at end of file +Asset 5DATASURVEY \ No newline at end of file diff --git a/src/main/webapp/content/img_datasurvey/datasurvey-logo-text-white-PNG.png b/src/main/webapp/content/img_datasurvey/datasurvey-logo-text-white-PNG.png new file mode 100644 index 0000000..333b2f7 Binary files /dev/null and b/src/main/webapp/content/img_datasurvey/datasurvey-logo-text-white-PNG.png differ diff --git a/src/main/webapp/content/scss/paper-dashboard.scss b/src/main/webapp/content/scss/paper-dashboard.scss index 3eab78d..28c06f8 100644 --- a/src/main/webapp/content/scss/paper-dashboard.scss +++ b/src/main/webapp/content/scss/paper-dashboard.scss @@ -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'; diff --git a/src/main/webapp/content/scss/paper-dashboard/_datasurvey-buttons.scss b/src/main/webapp/content/scss/paper-dashboard/_datasurvey-buttons.scss index ccb1547..d0c0c24 100644 --- a/src/main/webapp/content/scss/paper-dashboard/_datasurvey-buttons.scss +++ b/src/main/webapp/content/scss/paper-dashboard/_datasurvey-buttons.scss @@ -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; + } } } diff --git a/src/main/webapp/content/scss/paper-dashboard/_datasurvey-form.scss b/src/main/webapp/content/scss/paper-dashboard/_datasurvey-form.scss index 5ffb44f..7f23355 100644 --- a/src/main/webapp/content/scss/paper-dashboard/_datasurvey-form.scss +++ b/src/main/webapp/content/scss/paper-dashboard/_datasurvey-form.scss @@ -75,7 +75,9 @@ $form-background: #f1f5f9; } label { + font-size: 0.8rem; color: #757d94; + margin-bottom: 0.5rem; } } diff --git a/src/main/webapp/content/scss/paper-dashboard/_datasurvey-list.scss b/src/main/webapp/content/scss/paper-dashboard/_datasurvey-list.scss index 7bd5f80..33c9632 100644 --- a/src/main/webapp/content/scss/paper-dashboard/_datasurvey-list.scss +++ b/src/main/webapp/content/scss/paper-dashboard/_datasurvey-list.scss @@ -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 { @@ -131,3 +132,116 @@ background-color: #e8f0fe !important; } } + +/** + Cards +**/ +.lift { + box-shadow: 0 0.15rem 1.75rem 0 rgba(33, 40, 50, 0.15); + transition: transform 0.15s ease-in-out, box-shadow 0.15s ease-in-out; +} +.lift:hover { + transform: translateY(-0.3333333333rem); + box-shadow: 0 0.5rem 2rem 0 rgba(33, 40, 50, 0.25); +} +.lift:active { + transform: none; + box-shadow: 0 0.15rem 1.75rem 0 rgba(33, 40, 50, 0.15); +} + +.lift-sm { + box-shadow: 0 0.125rem 0.25rem 0 rgba(33, 40, 50, 0.2); +} +.lift-sm:hover { + transform: translateY(-0.1666666667rem); + box-shadow: 0 0.25rem 1rem 0 rgba(33, 40, 50, 0.25); +} +.lift-sm:active { + transform: none; + box-shadow: 0 0.125rem 0.25rem 0 rgba(33, 40, 50, 0.2); +} + +.card-encuesta { + border-radius: 12px; + background-color: #ffffff; + margin-bottom: 20px; + position: relative; + border: 0 none; +} + +.card-encuesta.lift { + text-decoration: none; + color: inherit; +} + +.card-flag { + position: absolute; + font-size: 0.7rem; + padding: 0.3rem 0.5rem; + line-height: 1; +} + +.card-flag-dark { + background-color: rgba(33, 40, 50, 0.7); + color: #fff; +} + +.card-flag-light { + background-color: rgba(255, 255, 255, 0.7); + color: #69707a; +} + +.card-flag-lg { + font-size: 0.9rem; + padding: 0.5rem 0.65rem; +} + +.card-flag-top-right { + border-top-left-radius: 0.25rem; + border-bottom-left-radius: 0.25rem; + top: 0.5rem; + right: 0; +} + +.card-flag-top-left { + border-top-right-radius: 0.25rem; + border-bottom-right-radius: 0.25rem; + top: 0.5rem; + left: 0; +} + +.card-encuesta .entity-icon--star { + color: #ffcc47; + margin-right: 0.2rem; +} + +.card-encuesta .card-title { + font-size: 2em; +} + +.card-encuesta .tag { + font-size: 0.8rem; + color: #f8f8f8; + margin-top: 0.5rem; + padding: 0.2rem 1.5rem; + background-color: #2962ff94; + border-radius: 15px; +} + +.card-encuesta .subtitle { + color: rgba(0, 0, 0, 0.54); + font-size: 0.9rem; +} + +.card-encuesta .btn-card { + padding: 11px 10px !important; +} + +.border-cyan { + border-color: #00cfd5 !important; +} + +.py-10 { + padding-top: 6rem !important; + padding-bottom: 6rem !important; +} diff --git a/src/main/webapp/content/scss/paper-dashboard/_datasurvey-modal.scss b/src/main/webapp/content/scss/paper-dashboard/_datasurvey-modal.scss index f821633..4330bcd 100644 --- a/src/main/webapp/content/scss/paper-dashboard/_datasurvey-modal.scss +++ b/src/main/webapp/content/scss/paper-dashboard/_datasurvey-modal.scss @@ -13,6 +13,12 @@ .modal-footer { border: none; padding: 2rem; + display: flex; + align-items: center; + + label { + margin: 0 0.2rem 0 0; + } } .modal-body { diff --git a/src/main/webapp/content/scss/paper-dashboard/_datasurvey-survey-update.scss b/src/main/webapp/content/scss/paper-dashboard/_datasurvey-survey-update.scss new file mode 100644 index 0000000..2c9bfa6 --- /dev/null +++ b/src/main/webapp/content/scss/paper-dashboard/_datasurvey-survey-update.scss @@ -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; + } + } + } +} diff --git a/src/main/webapp/i18n/es/ePreguntaCerrada.json b/src/main/webapp/i18n/es/ePreguntaCerrada.json index 943a041..7aa5b9a 100644 --- a/src/main/webapp/i18n/es/ePreguntaCerrada.json +++ b/src/main/webapp/i18n/es/ePreguntaCerrada.json @@ -23,7 +23,8 @@ "opcional": "Opcional", "orden": "Orden", "ePreguntaCerradaOpcion": "E Pregunta Cerrada Opcion", - "encuesta": "Encuesta" + "encuesta": "Encuesta", + "tiporespuesta": "Tipo de respuesta" } } } diff --git a/src/main/webapp/i18n/es/encuesta.json b/src/main/webapp/i18n/es/encuesta.json index 15c119d..ab8c85b 100644 --- a/src/main/webapp/i18n/es/encuesta.json +++ b/src/main/webapp/i18n/es/encuesta.json @@ -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" diff --git a/src/main/webapp/i18n/es/global.json b/src/main/webapp/i18n/es/global.json index adf0939..42d43b3 100644 --- a/src/main/webapp/i18n/es/global.json +++ b/src/main/webapp/i18n/es/global.json @@ -137,7 +137,7 @@ "value": "Valor" }, "delete": { - "title": "Confirmar operación de borrado", + "title": "Confirmar de operación", "status": "Confirmar cambio de estado" }, "validation": { diff --git a/src/main/webapp/index.html b/src/main/webapp/index.html index 1d945f6..3ba47db 100644 --- a/src/main/webapp/index.html +++ b/src/main/webapp/index.html @@ -12,6 +12,8 @@ + + @@ -23,16 +25,23 @@
      -
      -
      -
      -
      -
      +
      +
      +
      +
      +
      +
      -
      -
      -
      -
      +
      + +
      +

      Cargando

      +
      +
       
      +
       
      +
       
      +
       
      +