From 4af9d23ed1d978b046d64f3590e3e846662186af Mon Sep 17 00:00:00 2001 From: Mariela Bonilla Date: Sun, 15 Aug 2021 00:39:51 -0600 Subject: [PATCH 1/4] modificaciones en estilos de tienda, entre otros --- .../dashboard-user.component.ts | 49 ++++++++++++++++++- .../listar-tienda-plantilla.component.html | 27 +++++++--- .../pagina-principal.component.html | 20 ++++++-- src/main/webapp/i18n/es/home.json | 3 ++ 4 files changed, 87 insertions(+), 12 deletions(-) diff --git a/src/main/webapp/app/entities/dashboard/dashboard-user/dashboard-user.component.ts b/src/main/webapp/app/entities/dashboard/dashboard-user/dashboard-user.component.ts index 4a4a261..fcabc17 100644 --- a/src/main/webapp/app/entities/dashboard/dashboard-user/dashboard-user.component.ts +++ b/src/main/webapp/app/entities/dashboard/dashboard-user/dashboard-user.component.ts @@ -1,4 +1,14 @@ import { Component, OnInit } from '@angular/core'; +import { IUsuarioEncuesta } from '../../usuario-encuesta/usuario-encuesta.model'; +import { IUsuarioExtra } from '../../usuario-extra/usuario-extra.model'; +import { IUser } from '../../user/user.model'; +import { UsuarioEncuestaService } from '../../usuario-encuesta/service/usuario-encuesta.service'; +import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; +import { UsuarioExtraService } from '../../usuario-extra/service/usuario-extra.service'; +import { ActivatedRoute, Router } from '@angular/router'; +import { AccountService } from '../../../core/auth/account.service'; +import { HttpResponse } from '@angular/common/http'; +import * as dayjs from 'dayjs'; @Component({ selector: 'jhi-dashboard-user', @@ -6,7 +16,42 @@ import { Component, OnInit } from '@angular/core'; styleUrls: ['./dashboard-user.component.scss'], }) export class DashboardUserComponent implements OnInit { - constructor() {} + usuarioEncuestas?: IUsuarioEncuesta[]; + usuarioExtra: IUsuarioExtra | null = null; + user: IUser | null = null; - ngOnInit(): void {} + constructor( + protected usuarioEncuestaService: UsuarioEncuestaService, + protected modalService: NgbModal, + protected usuarioExtraService: UsuarioExtraService, + protected activatedRoute: ActivatedRoute, + protected accountService: AccountService, + protected router: Router + ) {} + + ngOnInit(): void { + this.accountService.getAuthenticationState().subscribe(account => { + if (account !== null) { + this.usuarioExtraService.find(account.id).subscribe(usuarioExtra => { + this.usuarioExtra = usuarioExtra.body; + this.loadAllColaboraciones(); + if (this.usuarioExtra !== null) { + if (this.usuarioExtra.id === undefined) { + const today = dayjs().startOf('day'); + this.usuarioExtra.fechaNacimiento = today; + } + } + }); + } + }); + } + + loadAllColaboraciones(): void { + this.usuarioEncuestaService.query().subscribe((res: HttpResponse) => { + const tempUsuarioEncuestas = res.body ?? []; + this.usuarioEncuestas = tempUsuarioEncuestas + .filter(c => c.usuarioExtra?.id === this.usuarioExtra?.id) + .filter(c => c.encuesta?.estado !== 'DELETED'); + }); + } } diff --git a/src/main/webapp/app/entities/tienda/listar-tienda-plantilla/listar-tienda-plantilla.component.html b/src/main/webapp/app/entities/tienda/listar-tienda-plantilla/listar-tienda-plantilla.component.html index ca7956a..5f490eb 100644 --- a/src/main/webapp/app/entities/tienda/listar-tienda-plantilla/listar-tienda-plantilla.component.html +++ b/src/main/webapp/app/entities/tienda/listar-tienda-plantilla/listar-tienda-plantilla.component.html @@ -1,21 +1,34 @@
-
-
-

¡Compre y utilice las plantillas!

+
+
+
+
+
+
+

¡Compre y utilice las plantillas!

-

Puede comprar sus plantillas mediante PayPal

+

+ Puede comprar sus plantillas mediante PayPal + +

+
+
+
+
-
-
+
- +
-
+
- +
+ - +
@@ -41,6 +59,14 @@

Detalles de la encuesta

En esta sección encontrará los reportes con respecto al contenido de las preguntas de su encuesta

+
+

Reportes de colaboraciones

+

En esta sección encontrará los reportes generales de todas las colaboraciones en las que esté participando

+
+
+

Detalles de la encuesta en la que colabora

+

En esta sección encontrará los reportes con respecto al contenido de las preguntas de la encuesta a la que colabora

+

@@ -123,6 +149,13 @@
+
+
+ +

No posee encuestas

+
+
+
@@ -178,11 +211,14 @@
-
-
- No se encontraron preguntas +
+
+ +

No se encontraron preguntas

+
- +
+
@@ -262,5 +298,171 @@
+ + + +
+
+
+ +

No posee colaboraciones

+
+
+
+
+
+
+
+
{{ colaboracion.encuesta.nombre }}
+
+ {{ colaboracion.encuesta.categoria?.nombre | lowercase }} +
+
+ {{ colaboracion.encuesta.descripcion | titlecase }} +
+
+
+
+ Duración:     {{ + duracionColaboracion + }} + Duración:     Un día o + menos + + Duración:     No ha + finalizado +
+ +
+

Calificación:

+ + +
+
+ +
+
+
+
+
+
+
+
+ + + +
+
+
+
+ +

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)' : '' }} +
+ + + + +
+
+ + +
+
+ + +
+
+
+
+
+
+
+
+ + + +
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/webapp/app/entities/dashboard/dashboard-user/dashboard-user.component.ts b/src/main/webapp/app/entities/dashboard/dashboard-user/dashboard-user.component.ts index d2a35d8..e0d8fcd 100644 --- a/src/main/webapp/app/entities/dashboard/dashboard-user/dashboard-user.component.ts +++ b/src/main/webapp/app/entities/dashboard/dashboard-user/dashboard-user.component.ts @@ -13,8 +13,8 @@ import { faListAlt, faUser, faEye, faStar, faCalendarAlt } from '@fortawesome/fr import * as Chartist from 'chartist'; import { finalize } from 'rxjs/operators'; import { EPreguntaAbiertaRespuestaService } from '../../e-pregunta-abierta-respuesta/service/e-pregunta-abierta-respuesta.service'; -import { each } from 'chart.js/helpers'; import { IEPreguntaAbiertaRespuesta } from '../../e-pregunta-abierta-respuesta/e-pregunta-abierta-respuesta.model'; +import { IUsuarioEncuesta } from '../../usuario-encuesta/usuario-encuesta.model'; @Component({ selector: 'jhi-dashboard-user', @@ -22,7 +22,6 @@ import { IEPreguntaAbiertaRespuesta } from '../../e-pregunta-abierta-respuesta/e styleUrls: ['./dashboard-user.component.scss'], }) export class DashboardUserComponent implements OnInit { - usuarioEncuestas?: IUsuarioEncuesta[]; user: IUser | null = null; cantEncuestas: number = 0; cantPersonas: number = 0; @@ -39,6 +38,8 @@ export class DashboardUserComponent implements OnInit { reportsGeneral = false; reportForEncuestas = true; reportPreguntas = true; + reportColaboraciones = true; + reportColaboracionPreguntas = true; duracion?: number = 0; ePreguntas?: any[]; ePreguntasOpciones?: any[]; @@ -49,6 +50,13 @@ export class DashboardUserComponent implements OnInit { account: Account | null = null; encuesta: IEncuesta | null = null; preguntaId?: number = 0; + usuarioEncuestas?: IUsuarioEncuesta[]; + colaboraciones?: IEncuesta[]; + duracionColaboracion?: number = 0; + ePreguntasColaboracion?: any[]; + ePreguntasOpcionesColaboracion?: any[]; + respuestaAbiertaColaboracion?: IEPreguntaAbiertaRespuesta[]; + preguntaIdColaboracion?: number = 0; constructor( protected encuestaService: EncuestaService, @@ -67,14 +75,36 @@ export class DashboardUserComponent implements OnInit { this.reportsGeneral = false; this.reportForEncuestas = true; this.reportPreguntas = true; + this.reportColaboraciones = true; + this.reportColaboracionPreguntas = true; } else if (this.reportForEncuestas) { this.reportsGeneral = true; this.reportForEncuestas = false; this.reportPreguntas = true; + this.reportColaboraciones = true; + this.reportColaboracionPreguntas = true; } else if (this.reportPreguntas) { this.reportForEncuestas = false; this.reportPreguntas = true; this.reportsGeneral = true; + this.reportColaboraciones = true; + this.reportColaboracionPreguntas = true; + } + } + + cambiarVistaColaboracion(cambio: string) { + if (cambio === 'colaboracion') { + this.reportForEncuestas = true; + this.reportPreguntas = true; + this.reportsGeneral = true; + this.reportColaboraciones = false; + this.reportColaboracionPreguntas = true; + } else if (cambio === 'preguntasColaboracion') { + this.reportForEncuestas = true; + this.reportPreguntas = true; + this.reportsGeneral = true; + this.reportColaboraciones = true; + this.reportColaboracionPreguntas = false; } } @@ -84,13 +114,17 @@ export class DashboardUserComponent implements OnInit { this.isLoading = false; const tmpEncuestas = res.body ?? []; - this.encuestas = tmpEncuestas.filter(e => e.usuarioExtra?.id === this.usuarioExtra?.id); + this.encuestas = tmpEncuestas.filter(e => e.usuarioExtra?.id === this.usuarioExtra?.id && e.estado !== 'DELETED'); this.cantEncuestas = this.encuestas.length; this.cantActivas = tmpEncuestas.filter(e => e.estado === 'ACTIVE' && e.usuarioExtra?.id === this.usuarioExtra?.id).length; this.cantDraft = tmpEncuestas.filter(e => e.estado === 'DRAFT' && e.usuarioExtra?.id === this.usuarioExtra?.id).length; this.cantFinalizadas = tmpEncuestas.filter(e => e.estado === 'FINISHED' && e.usuarioExtra?.id === this.usuarioExtra?.id).length; - this.cantPublicas = tmpEncuestas.filter(e => e.acceso === 'PUBLIC' && e.usuarioExtra?.id === this.usuarioExtra?.id).length; - this.cantPrivadas = tmpEncuestas.filter(e => e.acceso === 'PRIVATE' && e.usuarioExtra?.id === this.usuarioExtra?.id).length; + this.cantPublicas = tmpEncuestas.filter( + e => e.acceso === 'PUBLIC' && e.usuarioExtra?.id === this.usuarioExtra?.id && e.estado !== 'DELETED' + ).length; + this.cantPrivadas = tmpEncuestas.filter( + e => e.acceso === 'PRIVATE' && e.usuarioExtra?.id === this.usuarioExtra?.id && e.estado !== 'DELETED' + ).length; tmpEncuestas.forEach(encuesta => { const _calificacion = encuesta.calificacion; @@ -103,7 +137,9 @@ export class DashboardUserComponent implements OnInit { } }); - this.cantPersonas = tmpEncuestas.filter(e => e.calificacion && e.usuarioExtra?.id === this.usuarioExtra?.id).length; + this.cantPersonas = tmpEncuestas.filter( + e => e.calificacion && e.usuarioExtra?.id === this.usuarioExtra?.id && e.estado !== 'DELETED' + ).length; //cantidad de personas que han completado la encuesta this.loadFirstChart(); @@ -125,6 +161,7 @@ export class DashboardUserComponent implements OnInit { }); this.loadEncuestas(); + this.loadAllColaboraciones(); } loadFirstChart(): void { @@ -220,12 +257,98 @@ export class DashboardUserComponent implements OnInit { } }); } + loadAllColaboraciones(): void { this.usuarioEncuestaService.query().subscribe((res: HttpResponse) => { const tempUsuarioEncuestas = res.body ?? []; this.usuarioEncuestas = tempUsuarioEncuestas .filter(c => c.usuarioExtra?.id === this.usuarioExtra?.id) .filter(c => c.encuesta?.estado !== 'DELETED'); + + // Fix calificacion + tempUsuarioEncuestas.forEach(colaboracion => { + if (colaboracion.encuesta) { + const _calificacion = colaboracion.encuesta.calificacion; + colaboracion.encuesta.calificacion = Number(_calificacion?.toString().split('.')[0]); + + if (colaboracion.encuesta.fechaFinalizada == null) { + this.duracionColaboracion = -1; + } else { + this.duracionColaboracion = colaboracion.encuesta.fechaPublicacion?.diff(colaboracion.encuesta.fechaFinalizada!, 'days'); + } + } + }); + }); + } + + detallesPreguntasColaboracion(encuesta: IEncuesta): void { + if (!this.reportColaboraciones) { + this.reportPreguntas = true; + this.reportForEncuestas = true; + this.reportsGeneral = true; + this.reportColaboraciones = true; + this.reportColaboracionPreguntas = false; + } + + this.encuesta = encuesta; + debugger; + this.isLoading = true; + this.encuestaService + .findQuestions(encuesta?.id!) + .pipe( + finalize(() => + this.encuestaService.findQuestionsOptions(encuesta?.id!).subscribe( + (res: any) => { + this.isLoading = false; + this.ePreguntasOpcionesColaboracion = res.body ?? []; + + //debugger; + + this.getOpenQuestionAnswersColaboracion(); + }, + () => { + this.isLoading = false; + } + ) + ) + ) + .subscribe( + (res: any) => { + this.isLoading = false; + this.ePreguntasColaboracion = res.body ?? []; + }, + () => { + this.isLoading = false; + } + ); + } + + getOpenQuestionAnswersColaboracion() { + this.ePreguntasColaboracion!.forEach(pregunta => { + debugger; + if (!pregunta.tipo) { + this.resAbierta.query().subscribe(res => { + debugger; + + this.preguntaIdColaboracion = pregunta.id; + + this.respuestaAbiertaColaboracion = res.body ?? []; + /* const respuesta = res.body ?? []; + + respuesta.forEach( e => { + debugger + + + if (e.epreguntaAbierta?.id == pregunta.id){ + this.respuestaAbierta?.push(e); + } + /!*debugger + this.eRespuestaAbierta?.push(respuesta.filter(e.ePreguntaAbierta?.id == pregunta.id));*!/ + }) +*/ + console.log(this.respuestaAbiertaColaboracion); + }); + } }); } } 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 4c1d9c9..7b14d3f 100644 --- a/src/main/webapp/app/entities/encuesta/list/encuesta.component.html +++ b/src/main/webapp/app/entities/encuesta/list/encuesta.component.html @@ -79,11 +79,11 @@
-
+

No posee encuestas

-

Incie a explorar, colaborar y adquirir datos al crear encuestas mundialmente

+

Inicie a explorar, colaborar y adquirir datos al crear encuestas mundialmente

diff --git a/src/main/webapp/app/entities/usuario-encuesta/list/usuario-encuesta.component.html b/src/main/webapp/app/entities/usuario-encuesta/list/usuario-encuesta.component.html index 167dae8..2da950d 100644 --- a/src/main/webapp/app/entities/usuario-encuesta/list/usuario-encuesta.component.html +++ b/src/main/webapp/app/entities/usuario-encuesta/list/usuario-encuesta.component.html @@ -43,7 +43,7 @@
-
+
From d4d77e92dd0c98db80e50791b6d86e962b29d581 Mon Sep 17 00:00:00 2001 From: Mariela Bonilla Date: Sun, 15 Aug 2021 16:15:22 -0600 Subject: [PATCH 3/4] cambio de pregunta id de colaborador --- .../dashboard/dashboard-user/dashboard-user.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/webapp/app/entities/dashboard/dashboard-user/dashboard-user.component.html b/src/main/webapp/app/entities/dashboard/dashboard-user/dashboard-user.component.html index 4127371..44db8b0 100644 --- a/src/main/webapp/app/entities/dashboard/dashboard-user/dashboard-user.component.html +++ b/src/main/webapp/app/entities/dashboard/dashboard-user/dashboard-user.component.html @@ -453,7 +453,7 @@ --> -
+

From 18c0e40fc8b532c15492899a629b22f2e323fb62 Mon Sep 17 00:00:00 2001 From: Mariela Bonilla Date: Sun, 15 Aug 2021 16:17:39 -0600 Subject: [PATCH 4/4] cambio de nombre de variable --- .../dashboard/dashboard-user/dashboard-user.component.html | 2 +- .../dashboard/dashboard-user/dashboard-user.component.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/webapp/app/entities/dashboard/dashboard-user/dashboard-user.component.html b/src/main/webapp/app/entities/dashboard/dashboard-user/dashboard-user.component.html index 44db8b0..440ce18 100644 --- a/src/main/webapp/app/entities/dashboard/dashboard-user/dashboard-user.component.html +++ b/src/main/webapp/app/entities/dashboard/dashboard-user/dashboard-user.component.html @@ -367,7 +367,7 @@ -
+