reportes de usuario front end
This commit is contained in:
parent
d3c80b3de5
commit
de01fbfdd5
File diff suppressed because it is too large
Load Diff
|
@ -86,6 +86,7 @@
|
||||||
"@types/gapi.auth2": "0.0.54",
|
"@types/gapi.auth2": "0.0.54",
|
||||||
"angularx-social-login": "^4.0.1",
|
"angularx-social-login": "^4.0.1",
|
||||||
"bootstrap": "4.6.0",
|
"bootstrap": "4.6.0",
|
||||||
|
"chart.js": "^3.5.0",
|
||||||
"chartist": "^0.11.4",
|
"chartist": "^0.11.4",
|
||||||
"dayjs": "1.10.5",
|
"dayjs": "1.10.5",
|
||||||
"jquery": "^3.6.0",
|
"jquery": "^3.6.0",
|
||||||
|
|
|
@ -1 +1,8 @@
|
||||||
<p>dashboard-user works!</p>
|
<div class="content">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="col-lg-3 col-sm-6">
|
||||||
|
<h1>Reportes generales</h1>
|
||||||
|
<h2>En esta sección encontrará los reportes generales de todas sus encuestas</h2>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
|
@ -1,4 +1,12 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { HttpResponse } from '@angular/common/http';
|
||||||
|
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';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'jhi-dashboard-user',
|
selector: 'jhi-dashboard-user',
|
||||||
|
@ -6,7 +14,59 @@ import { Component, OnInit } from '@angular/core';
|
||||||
styleUrls: ['./dashboard-user.component.scss'],
|
styleUrls: ['./dashboard-user.component.scss'],
|
||||||
})
|
})
|
||||||
export class DashboardUserComponent implements OnInit {
|
export class DashboardUserComponent implements OnInit {
|
||||||
constructor() {}
|
cantEncuestas: number = 0;
|
||||||
|
cantPersonas: number = 0;
|
||||||
|
cantActivas: number = 0;
|
||||||
|
cantFinalizadas: number = 0;
|
||||||
|
cantDraft: number = 0;
|
||||||
|
cantPublicas: number = 0;
|
||||||
|
cantPrivadas: number = 0;
|
||||||
|
|
||||||
ngOnInit(): void {}
|
isLoading = false;
|
||||||
|
encuestas?: IEncuesta[];
|
||||||
|
usuarioExtra: UsuarioExtra | null = null;
|
||||||
|
account: Account | null = null;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
protected encuestaService: EncuestaService,
|
||||||
|
protected accountService: AccountService,
|
||||||
|
protected usuarioExtraService: UsuarioExtraService
|
||||||
|
) {}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.loadUser();
|
||||||
|
}
|
||||||
|
|
||||||
|
loadEncuestas() {
|
||||||
|
this.encuestaService.query().subscribe(
|
||||||
|
(res: HttpResponse<IEncuesta[]>) => {
|
||||||
|
this.isLoading = false;
|
||||||
|
const tmpEncuestas = res.body ?? [];
|
||||||
|
|
||||||
|
this.encuestas = tmpEncuestas.filter(e => e.usuarioExtra?.id === this.usuarioExtra?.id);
|
||||||
|
this.cantEncuestas = this.encuestas.length;
|
||||||
|
this.cantActivas = tmpEncuestas.filter(e => e.estado === 'ACTIVE').length;
|
||||||
|
this.cantDraft = tmpEncuestas.filter(e => e.estado === 'DRAFT').length;
|
||||||
|
this.cantFinalizadas = tmpEncuestas.filter(e => e.estado === 'FINISHED').length;
|
||||||
|
this.cantPublicas = tmpEncuestas.filter(e => e.acceso === 'PUBLIC').length;
|
||||||
|
this.cantPrivadas = tmpEncuestas.filter(e => e.acceso === 'PRIVATE').length;
|
||||||
|
//cantidad de personas que han completado la encuesta
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
this.isLoading = false;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
loadUser(): void {
|
||||||
|
this.accountService.getAuthenticationState().subscribe(account => {
|
||||||
|
if (account !== null) {
|
||||||
|
this.usuarioExtraService.find(account.id).subscribe(usuarioExtra => {
|
||||||
|
this.usuarioExtra = usuarioExtra.body;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.loadEncuestas();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ export class EncuestaCompartirDialogComponent implements OnInit {
|
||||||
constructor(protected activeModal: NgbActiveModal) {}
|
constructor(protected activeModal: NgbActiveModal) {}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.baseURL = location.origin + '/' + this.encuesta?.id + '/complete';
|
this.baseURL = location.origin + '/encuesta/' + this.encuesta?.id + '/complete';
|
||||||
}
|
}
|
||||||
|
|
||||||
compartir(): void {}
|
compartir(): void {}
|
||||||
|
|
|
@ -10,10 +10,12 @@
|
||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
|
<div *ngIf="plantilla!.precio == 0">
|
||||||
<h2 class="entity-body--row m-2">La plantilla ha comprar no tiene costo alguno</h2>
|
<h2 class="entity-body--row m-2">La plantilla ha comprar no tiene costo alguno</h2>
|
||||||
<button type="button" class="ds-btn btn-outline-success fc-center" data-dismiss="modal" (click)="freePurchase()">
|
<button type="button" class="ds-btn btn-outline-success fc-center" data-dismiss="modal" (click)="freePurchase()">
|
||||||
<fa-icon [icon]="faCheck"></fa-icon> <span>Finalizar compra</span>
|
<fa-icon [icon]="faCheck"></fa-icon> <span>Finalizar compra</span>
|
||||||
</button>
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<ngx-paypal [config]="payPalConfig" *ngIf="plantilla!.precio != 0"></ngx-paypal>
|
<ngx-paypal [config]="payPalConfig" *ngIf="plantilla!.precio != 0"></ngx-paypal>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -66,7 +66,7 @@ export const USER_ROUTES: RouteInfo[] = [
|
||||||
{ path: '/pagina-principal', title: 'Inicio', type: 'link', icontype: 'nc-icon nc-world-2' },
|
{ path: '/pagina-principal', title: 'Inicio', type: 'link', icontype: 'nc-icon nc-world-2' },
|
||||||
{
|
{
|
||||||
path: '/dashboard/user',
|
path: '/dashboard/user',
|
||||||
title: 'Dashboard',
|
title: 'Reportes',
|
||||||
type: 'link',
|
type: 'link',
|
||||||
icontype: 'nc-icon nc-chart-bar-32',
|
icontype: 'nc-icon nc-chart-bar-32',
|
||||||
},
|
},
|
||||||
|
@ -74,7 +74,7 @@ export const USER_ROUTES: RouteInfo[] = [
|
||||||
path: '/encuesta',
|
path: '/encuesta',
|
||||||
title: 'Encuestas',
|
title: 'Encuestas',
|
||||||
type: 'link',
|
type: 'link',
|
||||||
icontype: 'nc-icon nc-paper',
|
icontype: 'nc-icoxn nc-paper',
|
||||||
},
|
},
|
||||||
{ path: '/tienda-plantilla', title: 'Tienda', type: 'link', icontype: 'nc-icon nc-shop' },
|
{ path: '/tienda-plantilla', title: 'Tienda', type: 'link', icontype: 'nc-icon nc-shop' },
|
||||||
// {
|
// {
|
||||||
|
|
Loading…
Reference in New Issue