Merge pull request #138 from Quantum-P3/qa

deploy
This commit is contained in:
Eduardo Quiros 2021-08-17 01:14:15 +00:00 committed by GitHub
commit b8f9d347ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 624 additions and 102 deletions

114
package-lock.json generated
View File

@ -1,9 +1,8 @@
{
"name": "data-survey",
"version": "0.0.1-SNAPSHOT",
"lockfileVersion": 1,
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "data-survey",
@ -30,6 +29,7 @@
"@types/gapi.auth2": "0.0.54",
"angularx-social-login": "^4.0.1",
"bootstrap": "4.6.0",
"chart.js": "^3.5.0",
"chartist": "^0.11.4",
"dayjs": "1.10.5",
"file-saver": "^2.0.5",
@ -37,6 +37,7 @@
"jspdf": "^2.3.1",
"jw-angular-social-buttons": "^1.0.0",
"ng-chartist": "^5.0.0",
"ng2-charts": "^2.4.2",
"ngx-infinite-scroll": "10.0.1",
"ngx-paypal": "^8.0.0",
"ngx-sharebuttons": "^8.0.5",
@ -4395,6 +4396,14 @@
"@types/jquery": "*"
}
},
"node_modules/@types/chart.js": {
"version": "2.9.34",
"resolved": "https://registry.npmjs.org/@types/chart.js/-/chart.js-2.9.34.tgz",
"integrity": "sha512-CtZVk+kh1IN67dv+fB0CWmCLCRrDJgqOj15qPic2B1VCMovNO6B7Vhf/TgPpNscjhAL1j+qUntDMWb9A4ZmPTg==",
"dependencies": {
"moment": "^2.10.2"
}
},
"node_modules/@types/chartist": {
"version": "0.11.1",
"resolved": "https://registry.npmjs.org/@types/chartist/-/chartist-0.11.1.tgz",
@ -6959,6 +6968,11 @@
"integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==",
"dev": true
},
"node_modules/chart.js": {
"version": "3.5.0",
"resolved": "https://registry.npmjs.org/chart.js/-/chart.js-3.5.0.tgz",
"integrity": "sha512-J1a4EAb1Gi/KbhwDRmoovHTRuqT8qdF0kZ4XgwxpGethJHUdDrkqyPYwke0a+BuvSeUxPf8Cos6AX2AB8H8GLA=="
},
"node_modules/chartist": {
"version": "0.11.4",
"resolved": "https://registry.npmjs.org/chartist/-/chartist-0.11.4.tgz",
@ -16609,6 +16623,11 @@
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
},
"node_modules/lodash-es": {
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz",
"integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw=="
},
"node_modules/lodash.clonedeep": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz",
@ -17459,6 +17478,14 @@
"node": ">=10"
}
},
"node_modules/moment": {
"version": "2.29.1",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz",
"integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==",
"engines": {
"node": "*"
}
},
"node_modules/ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
@ -17619,6 +17646,22 @@
"chartist": ">=0.11.4"
}
},
"node_modules/ng2-charts": {
"version": "2.4.3",
"resolved": "https://registry.npmjs.org/ng2-charts/-/ng2-charts-2.4.3.tgz",
"integrity": "sha512-tPrhHSS2DfVyipXQ0gykOPc8zFNnj2b7sAebUVty392vHnEGYCwsP6YbFfpr1iXu4yBSRm4Gt5lffR5w0uyYSw==",
"dependencies": {
"@types/chart.js": "^2.9.24",
"lodash-es": "^4.17.15",
"tslib": "^2.0.0"
},
"peerDependencies": {
"@angular/common": ">=7.2.0",
"@angular/core": ">=7.2.0",
"chart.js": "^2.9.3",
"rxjs": "^6.3.3"
}
},
"node_modules/ngx-infinite-scroll": {
"version": "10.0.1",
"resolved": "https://registry.npmjs.org/ngx-infinite-scroll/-/ngx-infinite-scroll-10.0.1.tgz",
@ -23821,11 +23864,6 @@
"safer-buffer": "^2.0.2",
"tweetnacl": "~0.14.0"
},
"bin": {
"sshpk-conv": "bin/sshpk-conv",
"sshpk-sign": "bin/sshpk-sign",
"sshpk-verify": "bin/sshpk-verify"
},
"engines": {
"node": ">=0.10.0"
}
@ -41283,9 +41321,9 @@
}
},
"ng2-charts": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/ng2-charts/-/ng2-charts-2.4.2.tgz",
"integrity": "sha512-mY3C2uKCaApHCQizS2YxEOqQ7sSZZLxdV6N1uM9u/VvUgVtYvlPtdcXbKpN52ak93ZE22I73DiLWVDnDNG4/AQ==",
"version": "2.4.3",
"resolved": "https://registry.npmjs.org/ng2-charts/-/ng2-charts-2.4.3.tgz",
"integrity": "sha512-tPrhHSS2DfVyipXQ0gykOPc8zFNnj2b7sAebUVty392vHnEGYCwsP6YbFfpr1iXu4yBSRm4Gt5lffR5w0uyYSw==",
"requires": {
"@types/chart.js": "^2.9.24",
"lodash-es": "^4.17.15",
@ -42251,7 +42289,8 @@
"performance-now": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns="
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=",
"devOptional": true
},
"picomatch": {
"version": "2.3.0",
@ -44547,7 +44586,6 @@
}
},
"regenerator-runtime": {
"version": "0.13.9",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz",
"integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==",
@ -46176,6 +46214,23 @@
"readable-stream": "^3.0.6"
}
},
"string_decoder": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
"dev": true,
"requires": {
"safe-buffer": "~5.2.0"
},
"dependencies": {
"safe-buffer": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
"dev": true
}
}
},
"string-argv": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.1.tgz",
@ -46202,23 +46257,6 @@
"strip-ansi": "^6.0.0"
}
},
"string_decoder": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
"dev": true,
"requires": {
"safe-buffer": "~5.2.0"
},
"dependencies": {
"safe-buffer": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
"dev": true
}
}
},
"stringify-object": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/stringify-object/-/stringify-object-3.3.0.tgz",
@ -48167,6 +48205,15 @@
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
"dev": true
},
"string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"dev": true,
"requires": {
"safe-buffer": "~5.1.0"
}
},
"string-width": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",
@ -48195,15 +48242,6 @@
}
}
},
"string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"dev": true,
"requires": {
"safe-buffer": "~5.1.0"
}
},
"strip-ansi": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",

View File

@ -43,10 +43,7 @@ public class UsuarioEncuesta implements Serializable {
private UsuarioExtra usuarioExtra;
@ManyToOne
@JsonIgnoreProperties(
value = { "usuarioEncuestas", "ePreguntaAbiertas", "ePreguntaCerradas", "categoria", "usuarioExtra" },
allowSetters = true
)
@JsonIgnoreProperties(value = { "usuarioEncuestas", "usuarioExtra" }, allowSetters = true)
private Encuesta encuesta;
// jhipster-needle-entity-add-field - JHipster will add fields here

View File

@ -432,7 +432,7 @@ public class EncuestaResource {
newEncuesta.setNombre(encuesta.get().getNombre());
newEncuesta.setDescripcion(encuesta.get().getDescripcion());
newEncuesta.setFechaCreacion(ZonedDateTime.now());
newEncuesta.setCalificacion(5d);
newEncuesta.setCalificacion(5.1d);
newEncuesta.setAcceso(encuesta.get().getAcceso());
newEncuesta.setEstado(encuesta.get().getEstado());
newEncuesta.setCategoria(encuesta.get().getCategoria());

View File

@ -33,8 +33,13 @@
</button>
</div>
<div class="alert alert-warning" id="no-result" *ngIf="categorias?.length === 0">
<span jhiTranslate="dataSurveyApp.categoria.home.notFound">No categorias found</span>
<div class="ds-survey" id="entities" *ngIf="categorias?.length === 0">
<div class="ds-survey--all-question-wrapper">
<ng-container class="">
<p class="ds-title text-center">No existen categorías</p>
<p class="ds-subtitle text-center">Inicie creando categorías para identificar las encuestas de los usuarios</p>
</ng-container>
</div>
</div>
<div class="table-responsive" id="entities" *ngIf="categorias && categorias.length > 0">

View File

@ -101,7 +101,7 @@
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table">
<table class="ds-table table">
<tbody>
<tr *ngFor="let categoria of categorias; let i = index; trackBy: trackId">
<td>{{ categoria.nombre }}</td>
@ -127,7 +127,7 @@
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table">
<table class="ds-table table">
<tbody>
<tr *ngFor="let categoria of categorias; let i = index; trackBy: trackId">
<td>{{ categoria.nombre }}</td>
@ -199,7 +199,7 @@
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table">
<table class="ds-table table">
<thead>
<tr>
<th>Usuario</th>

View File

@ -1,10 +1,10 @@
<div class="content">
<div class="py-2">
<!--<button type="button" class="ds-btn ds-btn&#45;&#45;primary" (click)="exportReportesGeneralesUserExcel()">Exportar como Excel</button>
<button type="button" class="ds-btn ds-btn&#45;&#45;primary" (click)="exportReportesGeneralesUserPDF()">Exportar como PDF</button>-->
<button type="button" class="ds-btn ds-btn--primary" (click)="exportReportesGeneralesUserExcel()">Exportar como Excel</button>
<button type="button" class="ds-btn ds-btn--primary" (click)="exportReportesGeneralesUserPDF()">Exportar como PDF</button>
<button
type="button"
[hidden]="!reportsGeneral || reportForEncuestas"
[hidden]="!reportsGeneral || (reportForEncuestas && reportColaboraciones)"
class="ds-btn ds-btn--primary"
style="float: right"
(click)="cambiarVista()"
@ -13,16 +13,34 @@
</button>
<button
type="button"
[hidden]="!reportForEncuestas || reportsGeneral"
[hidden]="!reportForEncuestas || (reportsGeneral && reportColaboraciones)"
class="ds-btn ds-btn--primary"
style="float: right"
(click)="cambiarVista()"
>
Ver reportes por encuestas
</button>
<button
type="button"
[hidden]="!reportColaboraciones || (reportsGeneral && reportForEncuestas)"
class="ds-btn ds-btn--primary"
style="float: right"
(click)="cambiarVistaColaboracion('colaboracion')"
>
Ver reportes de colaboraciones
</button>
<button type="button" [hidden]="reportPreguntas" class="ds-btn ds-btn--primary" style="float: right" (click)="cambiarVista()">
Volver
<button type="button" [hidden]="reportPreguntas" class="ds-btn ds-btn--secondary" style="float: right" (click)="cambiarVista()">
<fa-icon icon="arrow-left"></fa-icon>&nbsp; Volver
</button>
<button
type="button"
[hidden]="reportColaboracionPreguntas"
class="ds-btn ds-btn--secondary"
style="float: right"
(click)="cambiarVista()"
>
<fa-icon icon="arrow-left"></fa-icon>&nbsp; Volver
</button>
</div>
@ -41,6 +59,14 @@
<h1>Detalles de la encuesta</h1>
<h2>En esta sección encontrará los reportes con respecto al contenido de las preguntas de su encuesta</h2>
</div>
<div class="py-2" [hidden]="reportColaboraciones">
<h1>Reportes de colaboraciones</h1>
<h2>En esta sección encontrará los reportes generales de todas las colaboraciones en las que esté participando</h2>
</div>
<div class="py-2" [hidden]="reportColaboracionPreguntas">
<h1>Detalles de la encuesta en la que colabora</h1>
<h2>En esta sección encontrará los reportes con respecto al contenido de las preguntas de la encuesta a la que colabora</h2>
</div>
<hr />
<!--REPORTES GENERALES-->
@ -123,6 +149,13 @@
<!--REPORTE POR ENCUESTA-->
<div class="container-fluid" [hidden]="reportForEncuestas">
<div class="ds-survey" id="entitiesEncuestas" *ngIf="encuestas && encuestas?.length === 0">
<div class="ds-survey--all-question-wrapper">
<ng-container class="">
<p class="ds-title text-center">No posee encuestas</p>
</ng-container>
</div>
</div>
<div class="row gx-5" *ngIf="encuestas && encuestas.length > 0">
<div class="col-xl-4 col-lg-4 col-md-6 mb-5" *ngFor="let encuesta of encuestas">
<div class="card-encuesta lift h-100" [attr.data-id]="encuesta.id">
@ -136,22 +169,22 @@
</div>
<div class="text-xs text-gray-500">
<div class="entity-body">
<div class="entity-body--row m-2">
<span class="mt-2" *ngIf="duracion! > 0"
><fa-icon class="entity-icon--access" [icon]="faCalendarAlt"></fa-icon> Duración: &nbsp;&nbsp;&nbsp;&nbsp;{{
duracion
<!--<div class="entity-body&#45;&#45;row m-2" *ngFor="let d of duracionArray">
<span class="mt-2" *ngIf="d! > 0"
><fa-icon class="entity-icon&#45;&#45;access" [icon]="faCalendarAlt"></fa-icon> Duración: &nbsp;&nbsp;&nbsp;&nbsp;{{
d
}}</span
>
<span class="mt-2" *ngIf="duracion! == 0"
><fa-icon class="entity-icon--access" [icon]="faCalendarAlt"></fa-icon> Duración: &nbsp;&nbsp;&nbsp;&nbsp;Un día o
<span class="mt-2" *ngIf="d! == 0"
><fa-icon class="entity-icon&#45;&#45;access" [icon]="faCalendarAlt"></fa-icon> Duración: &nbsp;&nbsp;&nbsp;&nbsp;Un día o
menos</span
>
<span class="mt-2" *ngIf="duracion! == -1"
><fa-icon class="entity-icon--access" [icon]="faCalendarAlt"></fa-icon> Duración: &nbsp;&nbsp;&nbsp;&nbsp;No ha
<span class="mt-2" *ngIf="d! == -1"
><fa-icon class="entity-icon&#45;&#45;access" [icon]="faCalendarAlt"></fa-icon> Duración: &nbsp;&nbsp;&nbsp;&nbsp;No ha
finalizado</span
>
</div>
</div>-->
<div class="entity-body--row m-2">
<p>Calificación:</p>
@ -178,11 +211,14 @@
<!--REPORTES DE LAS PREGUNTAS-->
<div class="container-fluid" *ngIf="encuesta" [hidden]="reportPreguntas">
<div>
<div class="alert alert-warning" id="no-result" *ngIf="ePreguntas?.length === 0">
<span>No se encontraron preguntas</span>
<div class="ds-survey" id="entitiesPreguntas" *ngIf="ePreguntas && ePreguntas?.length === 0">
<div class="ds-survey--all-question-wrapper">
<ng-container class="">
<p class="ds-title text-center">No se encontraron preguntas</p>
</ng-container>
</div>
</div>
<div>
<div class="ds-survey preview-survey" id="entities" *ngIf="ePreguntas && ePreguntas.length > 0">
<div class="ds-survey--all-question-wrapper col-8">
<div class="ds-survey--question-wrapper card-encuesta" *ngFor="let ePregunta of ePreguntas; let i = index">
@ -251,7 +287,173 @@
</ul>-->
<!-- <textarea readonly class="ds-survey&#45;&#45;textarea" cols="33" rows="10" *ngIf="res.epreguntaAbierta?.id == preguntaId" > {{ res.respuesta }} </textarea>-->
<div *ngIf="res.epreguntaAbierta?.id == preguntaId">
<div *ngIf="res.epreguntaAbierta?.id == ePregunta.id">
<label> {{ '- ' + res.respuesta }}</label> <br />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!--REPORTE POR COLABORACION-->
<div class="container-fluid" [hidden]="reportColaboraciones">
<div class="ds-survey" id="entitiesColaboraciones" *ngIf="usuarioEncuestas && usuarioEncuestas?.length === 0">
<div class="ds-survey--all-question-wrapper">
<ng-container class="">
<p class="ds-title text-center">No posee colaboraciones</p>
</ng-container>
</div>
</div>
<div class="row gx-5" *ngIf="usuarioEncuestas && usuarioEncuestas.length > 0">
<div class="col-xl-4 col-lg-4 col-md-6 mb-5" *ngFor="let colaboracion of usuarioEncuestas">
<div class="card-encuesta lift h-100" *ngIf="colaboracion.encuesta" [attr.data-id]="colaboracion.encuesta.id">
<div class="card-body p-3">
<div class="card-title mb-0">{{ colaboracion.encuesta.nombre }}</div>
<div class="entity-body--row m-2">
<span class="tag mt-2">{{ colaboracion.encuesta.categoria?.nombre | lowercase }}</span>
</div>
<div class="entity-body--row m-2">
<span class="subtitle mt-2">{{ colaboracion.encuesta.descripcion | titlecase }}</span>
</div>
<div class="text-xs text-gray-500">
<div class="entity-body">
<div class="entity-body--row m-2">
<span class="mt-2" *ngIf="duracionColaboracion! > 0"
><fa-icon class="entity-icon--access" [icon]="faCalendarAlt"></fa-icon> Duración: &nbsp;&nbsp;&nbsp;&nbsp;{{
duracionColaboracion
}}</span
>
<span class="mt-2" *ngIf="duracionColaboracion! == 0"
><fa-icon class="entity-icon--access" [icon]="faCalendarAlt"></fa-icon> Duración: &nbsp;&nbsp;&nbsp;&nbsp;Un día o
menos</span
>
<span class="mt-2" *ngIf="duracionColaboracion! == -1"
><fa-icon class="entity-icon--access" [icon]="faCalendarAlt"></fa-icon> Duración: &nbsp;&nbsp;&nbsp;&nbsp;No ha
finalizado</span
>
</div>
<div class="entity-body--row m-2">
<p>Calificación:</p>
<fa-icon
*ngFor="let i of [].constructor(colaboracion.encuesta.calificacion)"
class="entity-icon--star"
[icon]="faStar"
></fa-icon>
<fa-icon
*ngFor="let i of [].constructor(5 - colaboracion.encuesta.calificacion!)"
class="entity-icon--star--off"
[icon]="faStar"
></fa-icon>
</div>
<div class="entity-body--row m-2">
<button (click)="detallesPreguntasColaboracion(colaboracion.encuesta)" class="ds-btn btn-card ds-btn--primary">
<fa-icon [icon]="faEye"></fa-icon>&nbsp;&nbsp;Detalle
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!--REPORTES DE LAS PREGUNTAS DE LA COLABORACION-->
<div class="container-fluid" *ngIf="colaboracion" [hidden]="reportColaboracionPreguntas">
<div>
<div
class="ds-survey"
id="entitiesPreguntasColaboracion"
*ngIf="ePreguntasOpcionesColaboracion && ePreguntasOpcionesColaboracion?.length === 0"
>
<div class="ds-survey--all-question-wrapper">
<ng-container class="">
<p class="ds-title text-center">No se encontraron preguntas</p>
</ng-container>
</div>
</div>
<div
class="ds-survey preview-survey"
id="entitiesColaboration"
*ngIf="ePreguntasOpcionesColaboracion && ePreguntasOpcionesColaboracion.length > 0"
>
<div class="ds-survey--all-question-wrapper col-8">
<div class="ds-survey--question-wrapper card-encuesta" *ngFor="let ePregunta of ePreguntasOpcionesColaboracion; let i = index">
<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>
</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 ePreguntasOpcionesColaboracion; let j = index">
<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"
>
<div class="radio" *ngIf="ePregunta.tipo === 'SINGLE'">
<!--<input
type="text"
readonly
style="border-radius: 3px"
name="{{ 'radio' + ePregunta.id }}"
id="'radio'"
/>-->
<label>{{
ePreguntaOpcionFinal.nombre + ' / Cantidad de veces seleccionada: ' + ePreguntaOpcionFinal.cantidad
}}</label>
</div>
<div class="checkbox" *ngIf="ePregunta.tipo === 'MULTIPLE'">
<!--<input
type="checkbox"
style="border-radius: 3px"
id="{{ 'checkbox' + ePreguntaOpcionFinal.id }}"
/>-->
<label>{{
ePreguntaOpcionFinal.nombre + ' / Cantidad de veces seleccionada: ' + ePreguntaOpcionFinal.cantidad
}}</label>
</div>
</div>
</ng-container>
</ng-container>
</ng-container>
</ng-container>
<div *ngIf="!ePregunta.tipo">
<div *ngFor="let res of respuestaAbiertaColaboracion">
<!-- <ul>
<li *ngIf="res.epreguntaAbierta?.id == preguntaId"> {{ res.respuesta }}</li>
</ul>-->
<!-- <textarea readonly class="ds-survey&#45;&#45;textarea" cols="33" rows="10" *ngIf="res.epreguntaAbierta?.id == preguntaId" > {{ res.respuesta }} </textarea>-->
<div *ngIf="res.epreguntaAbierta?.id == ePregunta.id">
<label> {{ '- ' + res.respuesta }}</label> <br />
</div>
</div>

View File

@ -1,4 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { UsuarioEncuestaService } from '../../usuario-encuesta/service/usuario-encuesta.service';
import { IUser } from '../../user/user.model';
import { HttpResponse } from '@angular/common/http';
import { IEncuesta } from '../../encuesta/encuesta.model';
import { EstadoEncuesta } from '../../enumerations/estado-encuesta.model';
@ -11,8 +13,11 @@ 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';
import { exportAsExcelFile } from '../export/export_excel';
import { jsPDF } from 'jspdf';
import { createPDFTableHeaders, generatePDFTable, generatePDFTableData, saveGeneratedPDF } from '../export/export_pdf';
@Component({
selector: 'jhi-dashboard-user',
@ -20,6 +25,7 @@ import { IEPreguntaAbiertaRespuesta } from '../../e-pregunta-abierta-respuesta/e
styleUrls: ['./dashboard-user.component.scss'],
})
export class DashboardUserComponent implements OnInit {
user: IUser | null = null;
cantEncuestas: number = 0;
cantPersonas: number = 0;
cantActivas: number = 0;
@ -35,6 +41,8 @@ export class DashboardUserComponent implements OnInit {
reportsGeneral = false;
reportForEncuestas = true;
reportPreguntas = true;
reportColaboraciones = true;
reportColaboracionPreguntas = true;
duracion?: number = 0;
ePreguntas?: any[];
ePreguntasOpciones?: any[];
@ -44,12 +52,22 @@ export class DashboardUserComponent implements OnInit {
usuarioExtra: UsuarioExtra | null = null;
account: Account | null = null;
encuesta: IEncuesta | null = null;
colaboracion: IEncuesta | null = null;
preguntaId?: number = 0;
usuarioEncuestas?: IUsuarioEncuesta[];
colaboraciones?: IEncuesta[];
duracionColaboracion?: number = 0;
ePreguntasColaboracion?: any[];
ePreguntasOpcionesColaboracion?: any[];
respuestaAbiertaColaboracion?: IEPreguntaAbiertaRespuesta[];
preguntaIdColaboracion?: number = 0;
duracionArray?: number[] | null = null;
constructor(
protected encuestaService: EncuestaService,
protected accountService: AccountService,
protected usuarioExtraService: UsuarioExtraService,
protected usuarioEncuestaService: UsuarioEncuestaService,
protected resAbierta: EPreguntaAbiertaRespuestaService
) {}
@ -62,14 +80,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;
}
}
@ -79,26 +119,42 @@ 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;
let cantidadCompletadas: number = 0;
tmpEncuestas
.filter(e => e.estado === 'ACTIVE')
.forEach(e => {
const _contadorCompletadas = e.calificacion;
cantidadCompletadas = cantidadCompletadas + (Number(_contadorCompletadas?.toString().split('.')[1]) - 1);
});
this.cantPersonas = cantidadCompletadas;
tmpEncuestas.forEach(encuesta => {
const _calificacion = encuesta.calificacion;
encuesta.calificacion = Number(_calificacion?.toString().split('.')[0]);
if (encuesta.fechaFinalizada == null) {
/* if (encuesta.fechaFinalizada == null) {
this.duracion = -1;
this.duracionArray?.push(this.duracion);
} else {
this.duracion = encuesta.fechaPublicacion?.diff(encuesta.fechaFinalizada!, 'days');
}
this.duracionArray?.push(this.duracion!);
}*/
});
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();
@ -120,6 +176,7 @@ export class DashboardUserComponent implements OnInit {
});
this.loadEncuestas();
this.loadAllColaboraciones();
}
loadFirstChart(): void {
@ -215,4 +272,192 @@ export class DashboardUserComponent implements OnInit {
}
});
}
loadAllColaboraciones(): void {
this.usuarioEncuestaService.query().subscribe((res: HttpResponse<IUsuarioEncuesta[]>) => {
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.colaboracion = 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);
});
}
});
}
exportReportesGeneralesUserExcel(): void {
/*REPORTES GENERALES:
*Cantidad de encuestas creadas
* cantidad de personas que han completado las encuestas
*Cantidad de encuestas por estado
* Cantidad de encuestas por acceso
* */
if (!this.reportsGeneral) {
const _sheets = [
'Cantidad encuestas creadas',
'Cantidad usuarios encuestas',
'Cantidad encuestas por estado',
'Cantidad encuestas por acceso',
];
const _reporteEncuestasCreadas = [{ total_encuestas: this.cantEncuestas }];
const _reporteUsuariosCompletadas = [{ total_usuarios: this.cantPersonas }];
const _reporteEncuestasEstado = [
{ total_borrador: this.cantPersonas, total_activas: this.cantActivas, total_finalizadas: this.cantFinalizadas },
];
const _reporteEncuestasAcceso = [{ total_publicas: this.cantPublicas, total_privadas: this.cantPrivadas }];
const _excelFinalData = [_reporteEncuestasCreadas, _reporteUsuariosCompletadas, _reporteEncuestasEstado, _reporteEncuestasAcceso];
const _fileName = 'reportes_generales_encuestas_DataSurvey';
exportAsExcelFile(_sheets, _excelFinalData, _fileName);
}
}
exportReportesGeneralesUserPDF(): void {
/*REPORTES GENERALES:
*Cantidad de encuestas creadas
* cantidad de personas que han completado las encuestas
*Cantidad de encuestas por estado
* Cantidad de encuestas por acceso
* */
if (!this.reportsGeneral) {
const doc = new jsPDF();
const _fileName = 'reportes_generales_encuestas_datasurvey';
let _docData, _headers, _docHeaders, _docTitle;
debugger;
const _reporteEncuestasCreadas = [{ total_encuestas_creadas: this.cantEncuestas!.toString() }];
debugger;
_docData = generatePDFTableData(_reporteEncuestasCreadas);
_headers = ['total_encuestas_creadas'];
_docHeaders = createPDFTableHeaders(_headers);
_docTitle = 'Reporte General Cantidad Encuestas Creadas';
generatePDFTable(doc, _docData, _docHeaders, _docTitle);
doc.addPage('p');
const _reporteUsuariosCompletadas = [{ total_usuarios_completados: this.cantPersonas.toString() }];
_docData = generatePDFTableData(_reporteUsuariosCompletadas);
_headers = ['total_usuarios_completados'];
_docHeaders = createPDFTableHeaders(_headers);
_docTitle = 'Reporte General Cantidad Usuarios';
generatePDFTable(doc, _docData, _docHeaders, _docTitle);
doc.addPage('p');
const _reporteEncuestasEstado = [
{
total_borrador: this.cantPersonas.toString(),
total_activas: this.cantActivas.toString(),
total_finalizadas: this.cantFinalizadas.toString(),
},
];
_docData = generatePDFTableData(_reporteEncuestasEstado);
_headers = ['total_borrador', 'total_activas', 'total_finalizadas'];
_docHeaders = createPDFTableHeaders(_headers);
_docTitle = 'Reporte General Cantidad Encuestas Por Estado';
generatePDFTable(doc, _docData, _docHeaders, _docTitle);
doc.addPage('p');
const _reporteEncuestasAcceso = [{ total_publicas: this.cantPublicas.toString(), total_privadas: this.cantPrivadas.toString() }];
_docData = generatePDFTableData(_reporteEncuestasAcceso);
_headers = ['total_publicas', 'total_privadas'];
_docHeaders = createPDFTableHeaders(_headers);
_docTitle = 'Reporte General Cantidad Encuestas Por Acceso';
generatePDFTable(doc, _docData, _docHeaders, _docTitle);
doc.addPage('p');
saveGeneratedPDF(doc, _fileName);
}
}
}

View File

@ -79,11 +79,11 @@
</div>
</form>
<div class="ds-survey" id="entities" *ngIf="encuestas?.length === 0">
<div class="ds-survey" id="entitiesEncuestas" *ngIf="encuestas?.length === 0">
<div class="ds-survey--all-question-wrapper">
<ng-container class="">
<p class="ds-title text-center">No posee encuestas</p>
<p class="ds-subtitle text-center">Incie a explorar, colaborar y adquirir datos al crear encuestas mundialmente</p>
<p class="ds-subtitle text-center">Inicie a explorar, colaborar y adquirir datos al crear encuestas mundialmente</p>
</ng-container>
</div>
</div>

View File

@ -59,8 +59,13 @@
<jhi-alert></jhi-alert> -->
<div class="alert alert-warning" id="no-result" *ngIf="plantillas?.length === 0">
<span jhiTranslate="dataSurveyApp.plantilla.home.notFound">No templates found</span>
<div class="ds-survey" id="entities" *ngIf="plantillas?.length === 0">
<div class="ds-survey--all-question-wrapper">
<ng-container class="">
<p class="ds-title text-center">No existen plantillas</p>
<p class="ds-subtitle text-center">Inicie creando plantillas de encuestas para publicarlas en la tienda</p>
</ng-container>
</div>
</div>
<div class="table-responsive" id="entities" *ngIf="plantillas && plantillas.length > 0">

View File

@ -1,21 +1,34 @@
<div class="row">
<div class="col">
<div class="page-header-ui page-header-ui-dark bg-img-cover overlay">
<div class="container px-0 text-black">
<h1 class="page-header-ui-title">¡Compre y utilice las plantillas!</h1>
<div
class="page-header-ui page-header-ui-dark bg-img-cover overlay overlay-60"
style="background-image: url('../../content/img_datasurvey/survey-shop.png')"
>
<div class="page-header-ui-content py-5 position-relative">
<div class="container px-5">
<div class="row gx-5 justify-content-start">
<div class="col-xl-8 col-lg-10 text-left" style="color: white">
<div data-aos="fade-up">
<h1 class="page-header-ui-title" style="color: white">¡Compre y utilice las plantillas!</h1>
<h2>Puede comprar sus plantillas mediante <b> PayPal </b> <fa-icon [icon]="faCreditCard"></fa-icon></h2>
<h2>
Puede comprar sus plantillas mediante <b> PayPal </b>
<fa-icon [icon]="faCreditCard"></fa-icon>
</h2>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="bg-light py-10 container-encuestas">
<div class="container px-0">
<!--filtrado-->
<div class="input-group">
<div class="ds-filter">
<div class="ds-filter ds-form">
<div class="input-group-addon"><i class="glyphicon glyphicon-search"></i></div>
<input class="form-control" type="text" name="searchString" placeholder="Buscar por nombre..." [(ngModel)]="searchString" />
<input class="ds-form-control" type="text" name="searchString" placeholder="Buscar por nombre..." [(ngModel)]="searchString" />
</div>
<!--<div class="ds-filter">
<select name="searchCategoria" class="form-control" [(ngModel)]="searchCategoria" style="width: 200px">
@ -25,27 +38,26 @@
</select>
</div>-->
<!--<div class="ds-filter">
<!-- <div class="ds-filter">
<div class="form-check pl-0 mb-3">
<input type="radio" class="form-check-input" id="under25" name="materialExampleRadios" [value]="0">
<input type="radio" class="form-check-input" id="under25" name="materialExampleRadios" [value]="0" />
<label for="under25" [(ngModel)]="searchPrecio">GRATIS</label>
</div>
<div class="form-check pl-0 mb-3">
<input type="radio" class="form-check-input" id="2550" name="materialExampleRadios" [value]="">
<label for="2550" [(ngModel)]="searchPrecio"> $5 - $10</label>
<input type="radio" class="form-check-input" id="2550" name="materialExampleRadios" [value]="5" />
<label for="2550" [(ngModel)]="searchPrecio"> $5 - $10</label>
</div>
<div class="form-check pl-0 mb-3">
<input type="radio" class="form-check-input" id="50100" name="materialExampleRadios">
<label for="50100" [(ngModel)]="searchPrecio">$10 - $20</label>
<input type="radio" class="form-check-input" id="50100" name="materialExampleRadios" />
<label for="50100" [(ngModel)]="searchPrecio">$10 - $20</label>
</div>
<div class="form-check pl-0 mb-3">
<input type="radio" class="form-check-input" id="100200" name="materialExampleRadios">
<label for="100200" [(ngModel)]="searchPrecio">$20 - $30</label>
<input type="radio" class="form-check-input" id="100200" name="materialExampleRadios" />
<label for="100200" [(ngModel)]="searchPrecio">$20 - $30</label>
</div>
<div class="form-check pl-0 mb-3">
<input type="radio" class="form-check-input" id="200above" name="materialExampleRadios">
<label [(ngModel)]="searchPrecio">Más de $30 </label>
<input type="radio" class="form-check-input" id="200above" name="materialExampleRadios" />
<label [(ngModel)]="searchPrecio">Más de $30 </label>
</div>
</div>-->
</div>

View File

@ -43,7 +43,7 @@
</div>
</div>
<div class="table-responsive" id="entities" *ngIf="usuarioEncuestas && usuarioEncuestas.length > 0">
<div class="table-responsive" id="entities2" *ngIf="usuarioEncuestas && usuarioEncuestas.length > 0">
<table class="ds-table table table-striped" aria-describedby="page-heading">
<thead>
<tr>

View File

@ -26,7 +26,7 @@ export const ADMIN_ROUTES: RouteInfo[] = [
{ path: '/pagina-principal', title: 'Inicio', type: 'link', icontype: 'nc-icon nc-world-2' },
{
path: '/dashboard/admin',
title: 'Dashboard',
title: 'Reportes',
type: 'link',
icontype: 'nc-icon nc-chart-bar-32',
},

View File

@ -1,6 +1,6 @@
<div class="row">
<div class="col">
<div class="container-fluid navbar navbar-marketing navbar-expand-lg bg-white navbar-light">
<div class="container-fluid navbar navbar-marketing navbar-expand-lg bg-white navbar-light" style="background-color: #fbfafa">
<div class="container px-5 py-4">
<h1 class="ds-title" [hidden]="notAccount">Inicio</h1>
<a class="text-dark" href=" " [hidden]="!notAccount">
@ -25,15 +25,29 @@
</div>
</div>
</div>
<div
class="page-header-ui page-header-ui-dark bg-img-cover overlay overlay-40"
style="background-image: url('../../content/img_datasurvey/banner1.webp'); background-position-y: -325px"
>
<div class="page-header-ui-content py-5 position-relative" style="height: 330px">
<div class="container px-5">
<div class="row gx-5 justify-content-center">
<div class="col-xl-8 col-lg-10 text-center">
<div data-aos="fade-up"></div>
</div>
</div>
</div>
</div>
</div>
<div class="bg-light py-10 container-encuestas">
<div class="container px-0">
<!--filtrado-->
<div class="input-group">
<div class="input-group ds-form">
<div class="ds-filter">
<div class="input-group-addon"><i class="glyphicon glyphicon-search"></i></div>
<input class="form-control" type="text" name="searchString" placeholder="Buscar por nombre..." [(ngModel)]="searchString" />
<input class="ds-form-control" type="text" name="searchString" placeholder="Buscar por nombre..." [(ngModel)]="searchString" />
</div>
<!--<div class="ds-filter">
<select name="searchCategoria" class="form-control" [(ngModel)]="searchCategoria" style="width: 200px">

View File

@ -6,6 +6,7 @@ import { Pipe, PipeTransform, Injectable } from '@angular/core';
@Injectable()
export class FilterPipe implements PipeTransform {
transform(items: any[], field: string, value: string): any[] {
debugger;
if (!items) {
return [];
}

View File

@ -15,5 +15,8 @@
},
"like": "Si te gusta JHipster, danos una estrella en",
"github": "GitHub"
},
"paginaPrincipal": {
"title": "DataSurvey"
}
}