2021-08-10 01:07:19 +00:00
|
|
|
import { Component, OnInit } from '@angular/core';
|
2021-08-15 06:39:51 +00:00
|
|
|
import { UsuarioEncuestaService } from '../../usuario-encuesta/service/usuario-encuesta.service';
|
2021-08-15 06:44:17 +00:00
|
|
|
import { IUser } from '../../user/user.model';
|
2021-08-15 06:39:51 +00:00
|
|
|
import { HttpResponse } from '@angular/common/http';
|
2021-08-13 00:03:48 +00:00
|
|
|
import { IEncuesta } from '../../encuesta/encuesta.model';
|
|
|
|
import { EstadoEncuesta } from '../../enumerations/estado-encuesta.model';
|
|
|
|
import { EncuestaService } from '../../encuesta/service/encuesta.service';
|
|
|
|
import { UsuarioExtra } from '../../usuario-extra/usuario-extra.model';
|
|
|
|
import { Account } from '../../../core/auth/account.model';
|
|
|
|
import { AccountService } from '../../../core/auth/account.service';
|
|
|
|
import { UsuarioExtraService } from '../../usuario-extra/service/usuario-extra.service';
|
2021-08-14 04:04:50 +00:00
|
|
|
import { faListAlt, faUser, faEye, faStar, faCalendarAlt } from '@fortawesome/free-solid-svg-icons';
|
|
|
|
import * as Chartist from 'chartist';
|
2021-08-14 06:02:40 +00:00
|
|
|
import { finalize } from 'rxjs/operators';
|
2021-08-15 00:36:11 +00:00
|
|
|
import { EPreguntaAbiertaRespuestaService } from '../../e-pregunta-abierta-respuesta/service/e-pregunta-abierta-respuesta.service';
|
2021-08-15 04:20:52 +00:00
|
|
|
import { IEPreguntaAbiertaRespuesta } from '../../e-pregunta-abierta-respuesta/e-pregunta-abierta-respuesta.model';
|
2021-08-15 22:09:24 +00:00
|
|
|
import { IUsuarioEncuesta } from '../../usuario-encuesta/usuario-encuesta.model';
|
2021-08-16 21:50:39 +00:00
|
|
|
import { exportAsExcelFile } from '../export/export_excel';
|
|
|
|
import { jsPDF } from 'jspdf';
|
|
|
|
import { createPDFTableHeaders, generatePDFTable, generatePDFTableData, saveGeneratedPDF } from '../export/export_pdf';
|
2021-08-10 01:07:19 +00:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'jhi-dashboard-user',
|
|
|
|
templateUrl: './dashboard-user.component.html',
|
|
|
|
styleUrls: ['./dashboard-user.component.scss'],
|
|
|
|
})
|
|
|
|
export class DashboardUserComponent implements OnInit {
|
2021-08-15 06:39:51 +00:00
|
|
|
user: IUser | null = null;
|
2021-08-13 00:03:48 +00:00
|
|
|
cantEncuestas: number = 0;
|
|
|
|
cantPersonas: number = 0;
|
|
|
|
cantActivas: number = 0;
|
|
|
|
cantFinalizadas: number = 0;
|
|
|
|
cantDraft: number = 0;
|
|
|
|
cantPublicas: number = 0;
|
|
|
|
cantPrivadas: number = 0;
|
2021-08-14 04:04:50 +00:00
|
|
|
faListAlt = faListAlt;
|
|
|
|
faUser = faUser;
|
|
|
|
faEye = faEye;
|
|
|
|
faStar = faStar;
|
|
|
|
faCalendarAlt = faCalendarAlt;
|
|
|
|
reportsGeneral = false;
|
|
|
|
reportForEncuestas = true;
|
2021-08-14 06:02:40 +00:00
|
|
|
reportPreguntas = true;
|
2021-08-15 22:09:24 +00:00
|
|
|
reportColaboraciones = true;
|
|
|
|
reportColaboracionPreguntas = true;
|
2021-08-14 04:04:50 +00:00
|
|
|
duracion?: number = 0;
|
2021-08-14 06:02:40 +00:00
|
|
|
ePreguntas?: any[];
|
|
|
|
ePreguntasOpciones?: any[];
|
2021-08-15 04:20:52 +00:00
|
|
|
respuestaAbierta?: IEPreguntaAbiertaRespuesta[];
|
2021-08-13 00:03:48 +00:00
|
|
|
isLoading = false;
|
|
|
|
encuestas?: IEncuesta[];
|
|
|
|
usuarioExtra: UsuarioExtra | null = null;
|
|
|
|
account: Account | null = null;
|
2021-08-14 06:02:40 +00:00
|
|
|
encuesta: IEncuesta | null = null;
|
2021-08-15 22:17:39 +00:00
|
|
|
colaboracion: IEncuesta | null = null;
|
2021-08-15 04:20:52 +00:00
|
|
|
preguntaId?: number = 0;
|
2021-08-15 22:09:24 +00:00
|
|
|
usuarioEncuestas?: IUsuarioEncuesta[];
|
|
|
|
colaboraciones?: IEncuesta[];
|
|
|
|
duracionColaboracion?: number = 0;
|
|
|
|
ePreguntasColaboracion?: any[];
|
|
|
|
ePreguntasOpcionesColaboracion?: any[];
|
|
|
|
respuestaAbiertaColaboracion?: IEPreguntaAbiertaRespuesta[];
|
|
|
|
preguntaIdColaboracion?: number = 0;
|
2021-08-16 06:51:59 +00:00
|
|
|
duracionArray?: number[] | null = null;
|
2021-08-10 01:07:19 +00:00
|
|
|
|
2021-08-15 06:39:51 +00:00
|
|
|
constructor(
|
2021-08-13 00:03:48 +00:00
|
|
|
protected encuestaService: EncuestaService,
|
2021-08-15 06:39:51 +00:00
|
|
|
protected accountService: AccountService,
|
2021-08-15 00:36:11 +00:00
|
|
|
protected usuarioExtraService: UsuarioExtraService,
|
2021-08-15 06:44:17 +00:00
|
|
|
protected usuarioEncuestaService: UsuarioEncuestaService,
|
2021-08-15 00:36:11 +00:00
|
|
|
protected resAbierta: EPreguntaAbiertaRespuestaService
|
2021-08-15 06:39:51 +00:00
|
|
|
) {}
|
|
|
|
|
|
|
|
ngOnInit(): void {
|
2021-08-13 00:03:48 +00:00
|
|
|
this.loadUser();
|
|
|
|
}
|
|
|
|
|
2021-08-14 04:04:50 +00:00
|
|
|
cambiarVista() {
|
|
|
|
if (this.reportsGeneral) {
|
|
|
|
this.reportsGeneral = false;
|
|
|
|
this.reportForEncuestas = true;
|
2021-08-14 06:02:40 +00:00
|
|
|
this.reportPreguntas = true;
|
2021-08-15 22:09:24 +00:00
|
|
|
this.reportColaboraciones = true;
|
|
|
|
this.reportColaboracionPreguntas = true;
|
2021-08-14 04:04:50 +00:00
|
|
|
} else if (this.reportForEncuestas) {
|
|
|
|
this.reportsGeneral = true;
|
|
|
|
this.reportForEncuestas = false;
|
2021-08-14 06:02:40 +00:00
|
|
|
this.reportPreguntas = true;
|
2021-08-15 22:09:24 +00:00
|
|
|
this.reportColaboraciones = true;
|
|
|
|
this.reportColaboracionPreguntas = true;
|
2021-08-14 06:02:40 +00:00
|
|
|
} else if (this.reportPreguntas) {
|
|
|
|
this.reportForEncuestas = false;
|
|
|
|
this.reportPreguntas = true;
|
|
|
|
this.reportsGeneral = true;
|
2021-08-15 22:09:24 +00:00
|
|
|
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;
|
2021-08-14 04:04:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-13 00:03:48 +00:00
|
|
|
loadEncuestas() {
|
|
|
|
this.encuestaService.query().subscribe(
|
|
|
|
(res: HttpResponse<IEncuesta[]>) => {
|
|
|
|
this.isLoading = false;
|
|
|
|
const tmpEncuestas = res.body ?? [];
|
|
|
|
|
2021-08-15 22:09:24 +00:00
|
|
|
this.encuestas = tmpEncuestas.filter(e => e.usuarioExtra?.id === this.usuarioExtra?.id && e.estado !== 'DELETED');
|
2021-08-13 00:03:48 +00:00
|
|
|
this.cantEncuestas = this.encuestas.length;
|
2021-08-14 04:04:50 +00:00
|
|
|
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;
|
2021-08-15 22:09:24 +00:00
|
|
|
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;
|
2021-08-16 06:51:59 +00:00
|
|
|
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;
|
2021-08-14 04:04:50 +00:00
|
|
|
|
|
|
|
tmpEncuestas.forEach(encuesta => {
|
|
|
|
const _calificacion = encuesta.calificacion;
|
|
|
|
encuesta.calificacion = Number(_calificacion?.toString().split('.')[0]);
|
|
|
|
|
2021-08-16 06:51:59 +00:00
|
|
|
/* if (encuesta.fechaFinalizada == null) {
|
2021-08-14 04:04:50 +00:00
|
|
|
this.duracion = -1;
|
2021-08-16 06:51:59 +00:00
|
|
|
this.duracionArray?.push(this.duracion);
|
2021-08-14 04:04:50 +00:00
|
|
|
} else {
|
|
|
|
this.duracion = encuesta.fechaPublicacion?.diff(encuesta.fechaFinalizada!, 'days');
|
2021-08-16 06:51:59 +00:00
|
|
|
this.duracionArray?.push(this.duracion!);
|
|
|
|
}*/
|
2021-08-14 04:04:50 +00:00
|
|
|
});
|
|
|
|
|
2021-08-16 06:51:59 +00:00
|
|
|
/*this.cantPersonas = tmpEncuestas.filter(
|
2021-08-15 22:09:24 +00:00
|
|
|
e => e.calificacion && e.usuarioExtra?.id === this.usuarioExtra?.id && e.estado !== 'DELETED'
|
2021-08-16 06:51:59 +00:00
|
|
|
).length;*/
|
2021-08-13 00:03:48 +00:00
|
|
|
//cantidad de personas que han completado la encuesta
|
2021-08-14 04:04:50 +00:00
|
|
|
|
|
|
|
this.loadFirstChart();
|
|
|
|
this.loadSecondChart();
|
2021-08-13 00:03:48 +00:00
|
|
|
},
|
|
|
|
() => {
|
|
|
|
this.isLoading = false;
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
loadUser(): void {
|
2021-08-15 06:39:51 +00:00
|
|
|
this.accountService.getAuthenticationState().subscribe(account => {
|
|
|
|
if (account !== null) {
|
|
|
|
this.usuarioExtraService.find(account.id).subscribe(usuarioExtra => {
|
|
|
|
this.usuarioExtra = usuarioExtra.body;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
2021-08-13 00:03:48 +00:00
|
|
|
|
|
|
|
this.loadEncuestas();
|
2021-08-15 22:09:24 +00:00
|
|
|
this.loadAllColaboraciones();
|
2021-08-13 00:03:48 +00:00
|
|
|
}
|
2021-08-14 04:04:50 +00:00
|
|
|
|
|
|
|
loadFirstChart(): void {
|
|
|
|
var dataEstado = {
|
|
|
|
labels: ['ACTIVOS', 'BORRADOR', 'FINALIZADOS'],
|
|
|
|
series: [this.cantActivas, this.cantDraft, this.cantFinalizadas],
|
|
|
|
};
|
|
|
|
|
|
|
|
new Chartist.Pie('#chartEstado', dataEstado);
|
|
|
|
}
|
|
|
|
|
|
|
|
loadSecondChart(): void {
|
|
|
|
var dataAcceso = {
|
|
|
|
labels: ['PÚBLICA', 'PRIVADA'],
|
|
|
|
series: [this.cantPublicas, this.cantPrivadas],
|
|
|
|
};
|
|
|
|
|
|
|
|
new Chartist.Pie('#chartAcceso', dataAcceso);
|
|
|
|
}
|
|
|
|
|
2021-08-14 06:02:40 +00:00
|
|
|
detallesPreguntas(encuesta: IEncuesta): void {
|
|
|
|
if (!this.reportForEncuestas) {
|
|
|
|
this.reportPreguntas = false;
|
|
|
|
this.reportForEncuestas = true;
|
|
|
|
this.reportsGeneral = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.encuesta = encuesta;
|
2021-08-15 00:36:11 +00:00
|
|
|
debugger;
|
2021-08-14 06:02:40 +00:00
|
|
|
this.isLoading = true;
|
|
|
|
this.encuestaService
|
|
|
|
.findQuestions(encuesta?.id!)
|
|
|
|
.pipe(
|
|
|
|
finalize(() =>
|
|
|
|
this.encuestaService.findQuestionsOptions(encuesta?.id!).subscribe(
|
|
|
|
(res: any) => {
|
|
|
|
this.isLoading = false;
|
|
|
|
this.ePreguntasOpciones = res.body ?? [];
|
2021-08-15 00:36:11 +00:00
|
|
|
|
|
|
|
debugger;
|
|
|
|
|
2021-08-15 04:20:52 +00:00
|
|
|
this.getOpenQuestionAnswers();
|
2021-08-14 06:02:40 +00:00
|
|
|
},
|
|
|
|
() => {
|
|
|
|
this.isLoading = false;
|
|
|
|
}
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.subscribe(
|
|
|
|
(res: any) => {
|
|
|
|
this.isLoading = false;
|
|
|
|
this.ePreguntas = res.body ?? [];
|
|
|
|
},
|
|
|
|
() => {
|
|
|
|
this.isLoading = false;
|
|
|
|
}
|
|
|
|
);
|
|
|
|
if (this.ePreguntas!.length == 0) {
|
|
|
|
this.previousState();
|
|
|
|
}
|
2021-08-15 06:39:51 +00:00
|
|
|
}
|
|
|
|
|
2021-08-14 06:02:40 +00:00
|
|
|
previousState(): void {
|
|
|
|
window.history.back();
|
|
|
|
}
|
2021-08-15 00:36:11 +00:00
|
|
|
|
|
|
|
getOpenQuestionAnswers() {
|
|
|
|
this.ePreguntas!.forEach(pregunta => {
|
|
|
|
debugger;
|
|
|
|
if (!pregunta.tipo) {
|
2021-08-15 04:20:52 +00:00
|
|
|
this.resAbierta.query().subscribe(res => {
|
|
|
|
debugger;
|
|
|
|
|
|
|
|
this.preguntaId = pregunta.id;
|
|
|
|
|
|
|
|
this.respuestaAbierta = res.body ?? [];
|
|
|
|
/* const respuesta = res.body ?? [];
|
2021-08-15 00:36:11 +00:00
|
|
|
|
2021-08-15 04:20:52 +00:00
|
|
|
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.respuestaAbierta);
|
2021-08-15 00:36:11 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2021-08-15 22:09:24 +00:00
|
|
|
|
2021-08-15 06:39:51 +00:00
|
|
|
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');
|
2021-08-15 22:09:24 +00:00
|
|
|
|
|
|
|
// 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;
|
|
|
|
}
|
|
|
|
|
2021-08-15 22:17:39 +00:00
|
|
|
this.colaboracion = encuesta;
|
2021-08-15 22:09:24 +00:00
|
|
|
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);
|
|
|
|
});
|
|
|
|
}
|
2021-08-15 06:39:51 +00:00
|
|
|
});
|
|
|
|
}
|
2021-08-16 19:49:19 +00:00
|
|
|
|
2021-08-16 21:50:39 +00:00
|
|
|
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
|
|
|
|
* */
|
2021-08-16 19:49:19 +00:00
|
|
|
|
2021-08-16 21:50:39 +00:00
|
|
|
if (!this.reportsGeneral) {
|
|
|
|
const _sheets = [
|
2021-08-16 23:06:33 +00:00
|
|
|
'Cantidad encuestas creadas',
|
|
|
|
'Cantidad usuarios encuestas',
|
|
|
|
'Cantidad encuestas por estado',
|
|
|
|
'Cantidad encuestas por acceso',
|
2021-08-16 21:50:39 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
2021-08-16 23:06:33 +00:00
|
|
|
debugger;
|
|
|
|
const _reporteEncuestasCreadas = [{ total_encuestas_creadas: this.cantEncuestas!.toString() }];
|
|
|
|
debugger;
|
2021-08-16 21:50:39 +00:00
|
|
|
|
|
|
|
_docData = generatePDFTableData(_reporteEncuestasCreadas);
|
|
|
|
_headers = ['total_encuestas_creadas'];
|
|
|
|
_docHeaders = createPDFTableHeaders(_headers);
|
|
|
|
_docTitle = 'Reporte General Cantidad Encuestas Creadas';
|
|
|
|
|
|
|
|
generatePDFTable(doc, _docData, _docHeaders, _docTitle);
|
|
|
|
doc.addPage('p');
|
|
|
|
|
2021-08-16 23:06:33 +00:00
|
|
|
const _reporteUsuariosCompletadas = [{ total_usuarios_completados: this.cantPersonas.toString() }];
|
2021-08-16 21:50:39 +00:00
|
|
|
_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 = [
|
2021-08-16 23:06:33 +00:00
|
|
|
{
|
|
|
|
total_borrador: this.cantPersonas.toString(),
|
|
|
|
total_activas: this.cantActivas.toString(),
|
|
|
|
total_finalizadas: this.cantFinalizadas.toString(),
|
|
|
|
},
|
2021-08-16 21:50:39 +00:00
|
|
|
];
|
|
|
|
_docData = generatePDFTableData(_reporteEncuestasEstado);
|
2021-08-16 23:06:33 +00:00
|
|
|
_headers = ['total_borrador', 'total_activas', 'total_finalizadas'];
|
2021-08-16 21:50:39 +00:00
|
|
|
_docHeaders = createPDFTableHeaders(_headers);
|
|
|
|
_docTitle = 'Reporte General Cantidad Encuestas Por Estado';
|
|
|
|
|
|
|
|
generatePDFTable(doc, _docData, _docHeaders, _docTitle);
|
|
|
|
doc.addPage('p');
|
|
|
|
|
2021-08-16 23:06:33 +00:00
|
|
|
const _reporteEncuestasAcceso = [{ total_publicas: this.cantPublicas.toString(), total_privadas: this.cantPrivadas.toString() }];
|
2021-08-16 21:50:39 +00:00
|
|
|
_docData = generatePDFTableData(_reporteEncuestasAcceso);
|
2021-08-16 23:06:33 +00:00
|
|
|
_headers = ['total_publicas', 'total_privadas'];
|
2021-08-16 21:50:39 +00:00
|
|
|
_docHeaders = createPDFTableHeaders(_headers);
|
|
|
|
_docTitle = 'Reporte General Cantidad Encuestas Por Acceso';
|
|
|
|
|
|
|
|
generatePDFTable(doc, _docData, _docHeaders, _docTitle);
|
|
|
|
doc.addPage('p');
|
|
|
|
|
|
|
|
saveGeneratedPDF(doc, _fileName);
|
|
|
|
}
|
|
|
|
}
|
2021-08-10 01:07:19 +00:00
|
|
|
}
|