Merge pull request #89 from Quantum-P3/dev

QA
This commit is contained in:
Eduardo Quiros 2021-07-29 06:23:02 +00:00 committed by GitHub
commit e822e671c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 313 additions and 17 deletions

View File

@ -32,8 +32,8 @@
<div class="alert alert-danger text-center my-2" jhiTranslate="activate.messages.error"></div>
<div class="d-flex justify-content-center">
<button class="ds-btn ds-btn--primary" routerLink="/account/register" jhiTranslate="global.registerLink">
create account</button
>.
create account
</button>
</div>
</div>
</div>

View File

@ -18,7 +18,7 @@ import { AppRoutingModule } from './app-routing.module';
import { HomeModule } from './home/home.module';
import { EntityRoutingModule } from './entities/entity-routing.module';
import { ReactiveFormsModule } from '@angular/forms';
import { PaginaPrincipalModule } from './pagina-principal/pagina-principal.module';
import { SocialLoginModule, SocialAuthServiceConfig } from 'angularx-social-login';
import { GoogleLoginProvider } from 'angularx-social-login';
// jhipster-needle-angular-add-module-import JHipster will add new module here
@ -32,6 +32,7 @@ import { FooterComponent } from './layouts/footer/footer.component';
import { PageRibbonComponent } from './layouts/profiles/page-ribbon.component';
import { ErrorComponent } from './layouts/error/error.component';
import { SidebarComponent } from './layouts/sidebar/sidebar.component';
import { PaginaPrincipalComponent } from './pagina-principal/pagina-principal.component';
@NgModule({
imports: [
@ -39,6 +40,7 @@ import { SidebarComponent } from './layouts/sidebar/sidebar.component';
BrowserModule,
SharedModule,
HomeModule,
PaginaPrincipalModule,
// jhipster-needle-angular-add-module JHipster will add new module here
EntityRoutingModule,
AppRoutingModule,

View File

@ -36,7 +36,7 @@
</h5>
<div class="row" [hidden]="!notAccount">
<div class="col">
<a routerLink="/login">
<a routerLink="pagina-principal">
<button class="ds-btn ds-btn--primary fw-500 ms-lg-4">Comenzar</button>
</a>
</div>
@ -98,12 +98,10 @@
<h1 class="text-center mb-4">Encuestas</h1>
<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 encuestasMostradas; trackBy: trackId">
<div
class="card-encuesta lift h-100"
(dblclick)="openSurvey($event)"
(click)="selectSurvey($event)"
[attr.data-id]="encuesta.id"
>
<div class="card-encuesta lift h-100" [attr.data-id]="encuesta.id">
<!--(dblclick)="openSurvey($event)"
(click)="selectSurvey($event)"-->
<div class="card-body p-3">
<div class="card-title mb-0">{{ encuesta.nombre }}</div>
<div class="entity-body--row m-2">
@ -116,14 +114,14 @@
<div class="entity-body">
<div class="entity-body--row m-2">
<span class="mt-2"
>Fecha Publicada&nbsp;&nbsp;<fa-icon class="entity-icon--access" [icon]="faCalendarAlt"></fa-icon>&nbsp;&nbsp;{{
>Fecha de inicio&nbsp;&nbsp;<fa-icon class="entity-icon--access" [icon]="faCalendarAlt"></fa-icon>&nbsp;&nbsp;{{
encuesta.fechaPublicacion | formatShortDatetime | titlecase
}}</span
>
</div>
<div class="entity-body--row m-2">
<span class="mt-2"
>Fecha de Finalización &nbsp;&nbsp;<fa-icon class="entity-icon--access" [icon]="faCalendarAlt"></fa-icon
>Fecha de finalización &nbsp;&nbsp;<fa-icon class="entity-icon--access" [icon]="faCalendarAlt"></fa-icon
>&nbsp;&nbsp;{{ encuesta.fechaFinalizar | formatShortDatetime | titlecase }}</span
>
</div>

View File

@ -1,4 +1,4 @@
<div #footer class="footer">
<div #footer class="footer" [hidden]="!notAccount">
<div>
<p>
Copyright © Derechos reservados - Desarrollado por

View File

@ -1,8 +1,32 @@
import { Component } from '@angular/core';
import { Account } from '../../core/auth/account.model';
import { takeUntil } from 'rxjs/operators';
import { AccountService } from '../../core/auth/account.service';
import { Subject } from 'rxjs';
@Component({
selector: 'jhi-footer',
templateUrl: './footer.component.html',
styleUrls: ['./footer.component.scss'],
})
export class FooterComponent {}
export class FooterComponent {
account: Account | null = null;
notAccount: boolean = true;
private readonly destroy$ = new Subject<void>();
constructor(protected accountService: AccountService) {}
ngOnInit(): void {
this.accountService
.getAuthenticationState()
.pipe(takeUntil(this.destroy$))
.subscribe(account => {
if (account !== null) {
this.account = account;
this.notAccount = false;
} else {
this.notAccount = true;
}
});
}
}

View File

@ -22,6 +22,8 @@ export const ADMIN_ROUTES: RouteInfo[] = [
// type: 'link',
// icontype: 'nc-icon nc-chart-bar-32',
// },
{ path: '/pagina-principal', title: 'Inicio', type: 'link', icontype: 'nc-icon nc-world-2' },
{
path: '/encuesta',
title: 'Encuestas',
@ -55,6 +57,7 @@ export const ADMIN_ROUTES: RouteInfo[] = [
];
export const USER_ROUTES: RouteInfo[] = [
{ path: '/pagina-principal', title: 'Inicio', type: 'link', icontype: 'nc-icon nc-world-2' },
{
path: '/encuesta',
title: 'Encuestas',

View File

@ -55,7 +55,7 @@ export class LoginComponent implements OnInit, AfterViewInit {
// if already authenticated then navigate to home page
this.accountService.identity().subscribe(() => {
if (this.accountService.isAuthenticated()) {
this.router.navigate(['']);
this.router.navigate(['/pagina-principal']);
}
});
}
@ -90,7 +90,7 @@ export class LoginComponent implements OnInit, AfterViewInit {
if (!this.router.getCurrentNavigation()) {
this.localStorageService.store('IsGoogle', 'true');
// There were no routing during login (eg from navigationToStoredUrl)
this.router.navigate(['']);
this.router.navigate(['/pagina-principal']);
}
},
response => {
@ -173,7 +173,7 @@ export class LoginComponent implements OnInit, AfterViewInit {
this.authenticationError = false;
if (!this.router.getCurrentNavigation()) {
// There were no routing during login (eg from navigationToStoredUrl)
this.router.navigate(['']);
this.router.navigate(['/pagina-principal']);
}
// }
},

View File

@ -0,0 +1,11 @@
import { Route, RouterModule } from '@angular/router';
import { PaginaPrincipalComponent } from './pagina-principal.component';
export const PAGINA_PRINCIPAL_ROUTE: Route = {
path: 'pagina-principal',
component: PaginaPrincipalComponent,
data: {
pageTitle: 'paginaPrincipal.title',
},
};

View File

@ -0,0 +1,120 @@
<div class="row">
<div class="col">
<div class="container-fluid navbar navbar-marketing navbar-expand-lg bg-white navbar-light">
<div class="container px-5 py-4">
<h1 class="ds-title" [hidden]="notAccount">Inicio</h1>
<a class="text-dark" href=" " [hidden]="!notAccount">
<img src="http://datasurvey.org/content/img_datasurvey/datasurvey-logo-text-black.svg" width="300" alt="" />
</a>
<a href=" ">
<button class="ds-btn btn-outline-secondary fw-500 ms-lg-4">Sobre DataSurvey</button>
</a>
<div class="col-6" style="text-align: end">
<!--<a routerlink="" [hidden]="!notAccount">
<button class="ds-btn btn-light fw-500 ms-lg-4">Sobre DataSurvey</button>
</a>-->
<a routerLink="/login" [hidden]="!notAccount">
<button class="ds-btn ds-btn--primary fw-500 ms-lg-4">Iniciar Sesión</button>
</a>
<a routerLink="/account/register" [hidden]="!notAccount">
<button class="ds-btn ds-btn--primary fw-500 ms-lg-4">Registrarse</button>
</a>
</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="input-group-addon"><i class="glyphicon glyphicon-search"></i></div>
<input type="text" name="searchString" placeholder="Buscar por nombre..." [(ngModel)]="searchString" />
</div>
<div class="ds-filter">
<div class="input-group-addon"><i class="glyphicon glyphicon-search"></i></div>
<select name="accesoEncuestas" id="accesoEncuesta" [(ngModel)]="searchCategoria" style="width: 200px">
<option selected="selected" *ngFor="let categoria of categorias" [value]="categoria.nombre">{{categoria.nombre}}</option>
</select>
</div>
</div>-->
<div class="container">
<h1 class="ds-title">Encuestas</h1>
<hr />
<div class="social-box">
<h1>
<fa-icon [icon]="faFileAlt"></fa-icon>
</h1>
</div>
</div>
<!--Inicio de los cards-->
<!-- <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; trackBy: trackId">
<div
class="card-encuesta lift h-100"
[attr.data-id]="encuesta.id"
>
&lt;!&ndash;(dblclick)="openSurvey($event)"
(click)="selectSurvey($event)"&ndash;&gt;
&lt;!&ndash; <div class="card-body p-3">
<div class="card-title mb-0">{{ encuesta.nombre }}</div>
<div class="entity-body&#45;&#45;row m-2">
<span class="tag mt-2">{{ encuesta.categoria?.nombre | lowercase }}</span>
</div>
<div class="entity-body&#45;&#45;row m-2">
<span class="subtitle mt-2">{{ encuesta.descripcion | titlecase }}</span>
</div>
<div class="text-xs text-gray-500">
<div class="entity-body">
<div class="entity-body&#45;&#45;row m-2">
<span class="mt-2"
>Fecha de inicio&nbsp;&nbsp;<fa-icon class="entity-icon&#45;&#45;access" [icon]="faCalendarAlt"></fa-icon>&nbsp;&nbsp;{{
encuesta.fechaPublicacion | formatShortDatetime | titlecase
}}</span
>
</div>
<div class="entity-body&#45;&#45;row m-2">
<span class="mt-2"
>Fecha de finalización &nbsp;&nbsp;<fa-icon class="entity-icon&#45;&#45;access" [icon]="faCalendarAlt"></fa-icon
>&nbsp;&nbsp;{{ encuesta.fechaFinalizar | formatShortDatetime | titlecase }}</span
>
</div>
<div class="entity-body&#45;&#45;row m-2">
<p>Calificacion</p>
<fa-icon *ngFor="let i of [].constructor(encuesta.calificacion)" class="entity-icon&#45;&#45;star" [icon]="faStar"></fa-icon>
<fa-icon
*ngFor="let i of [].constructor(5 - encuesta.calificacion!)"
class="entity-icon&#45;&#45;star&#45;&#45;off"
[icon]="faStar"
></fa-icon>
</div>
<div class="entity-body&#45;&#45;row m-2">
<button class="ds-btn btn-card"><fa-icon [icon]="faPollH"></fa-icon>&nbsp;&nbsp;Completar encuesta</button>
</div>
</div>
</div>
</div>&ndash;&gt;
</div>
</div>
</div>-->
</div>
</div>
</div>
<!--Inicio de cards-->
</div>

View File

@ -0,0 +1,13 @@
.social-box {
display: inline-block;
width: 3em;
height: 4em;
margin-left: 2.7em;
text-align: center;
font-size: 130px;
opacity: 0.3;
}
.container div:last-child {
margin-right: 0;
}

View File

@ -0,0 +1,112 @@
import { Component, OnInit } from '@angular/core';
import { Account } from '../core/auth/account.model';
import { takeUntil } from 'rxjs/operators';
import { EncuestaService } from '../entities/encuesta/service/encuesta.service';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { CategoriaService } from '../entities/categoria/service/categoria.service';
import { UsuarioExtraService } from '../entities/usuario-extra/service/usuario-extra.service';
import { ActivatedRoute, Router } from '@angular/router';
import { FormBuilder } from '@angular/forms';
import { AccountService } from '../core/auth/account.service';
import { HttpResponse } from '@angular/common/http';
import { IEncuesta } from '../entities/encuesta/encuesta.model';
import { UsuarioExtra } from '../entities/usuario-extra/usuario-extra.model';
import { Subject } from 'rxjs';
import { faPollH, faCalendarAlt, faStar, faListAlt, faFileAlt } from '@fortawesome/free-solid-svg-icons';
import { ICategoria } from '../entities/categoria/categoria.model';
@Component({
selector: 'jhi-pagina-principal',
templateUrl: './pagina-principal.component.html',
styleUrls: ['./pagina-principal.component.scss'],
})
export class PaginaPrincipalComponent implements OnInit {
public searchString: string;
public searchCategoria: string;
categorias?: ICategoria[];
account: Account | null = null;
public searchEncuestaPublica: string;
notAccount: boolean = true;
usuarioExtra: UsuarioExtra | null = null;
encuestas?: IEncuesta[];
isLoading = false;
private readonly destroy$ = new Subject<void>();
faStar = faStar;
faCalendarAlt = faCalendarAlt;
faPollH = faPollH;
faListAlt = faListAlt;
faFileAlt = faFileAlt;
constructor(
protected encuestaService: EncuestaService,
protected modalService: NgbModal,
protected categoriaService: CategoriaService,
protected usuarioExtraService: UsuarioExtraService,
protected activatedRoute: ActivatedRoute,
protected fb: FormBuilder,
protected accountService: AccountService,
protected router: Router
) {
this.searchEncuestaPublica = '';
this.searchString = '';
this.searchCategoria = '';
}
ngOnInit(): void {
this.searchEncuestaPublica = '';
this.accountService
.getAuthenticationState()
.pipe(takeUntil(this.destroy$))
.subscribe(account => {
if (account !== null) {
this.account = account;
this.notAccount = false;
} else {
this.notAccount = true;
}
});
this.loadAll();
this.loadAllCategorias();
}
ngOnDestroy(): void {
this.destroy$.next();
this.destroy$.complete();
}
loadAll(): void {
this.isLoading = true;
this.encuestaService.query().subscribe(
(res: HttpResponse<IEncuesta[]>) => {
this.isLoading = false;
const tmpEncuestas = res.body ?? [];
this.encuestas = tmpEncuestas.filter(e => e.estado === 'ACTIVE' && e.acceso === 'PUBLIC');
},
() => {
this.isLoading = false;
}
);
}
loadAllCategorias(): void {
this.isLoading = true;
this.categoriaService.query().subscribe(
(res: HttpResponse<ICategoria[]>) => {
this.isLoading = false;
this.categorias = res.body ?? [];
},
() => {
this.isLoading = false;
}
);
}
trackId(index: number, item: IEncuesta): number {
return item.id!;
}
}

View File

@ -0,0 +1,13 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { SharedModule } from 'app/shared/shared.module';
import { PAGINA_PRINCIPAL_ROUTE } from './pagina-princial.route';
import { PaginaPrincipalComponent } from './pagina-principal.component';
@NgModule({
imports: [SharedModule, RouterModule.forChild([PAGINA_PRINCIPAL_ROUTE])],
declarations: [PaginaPrincipalComponent],
})
export class PaginaPrincipalModule {}