Merge branch 'dev' into feature/US-60
This commit is contained in:
		
						commit
						e615cb9d7c
					
				| 
						 | 
				
			
			@ -2,15 +2,20 @@ package org.datasurvey.web.rest;
 | 
			
		|||
 | 
			
		||||
import java.net.URI;
 | 
			
		||||
import java.net.URISyntaxException;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Objects;
 | 
			
		||||
import java.util.Optional;
 | 
			
		||||
import java.util.stream.Collectors;
 | 
			
		||||
import javax.validation.Valid;
 | 
			
		||||
import javax.validation.constraints.NotNull;
 | 
			
		||||
import org.datasurvey.domain.UsuarioEncuesta;
 | 
			
		||||
import org.datasurvey.domain.UsuarioExtra;
 | 
			
		||||
import org.datasurvey.repository.UsuarioEncuestaRepository;
 | 
			
		||||
import org.datasurvey.service.EncuestaService;
 | 
			
		||||
import org.datasurvey.service.UsuarioEncuestaQueryService;
 | 
			
		||||
import org.datasurvey.service.UsuarioEncuestaService;
 | 
			
		||||
import org.datasurvey.service.UsuarioExtraService;
 | 
			
		||||
import org.datasurvey.service.criteria.UsuarioEncuestaCriteria;
 | 
			
		||||
import org.datasurvey.web.rest.errors.BadRequestAlertException;
 | 
			
		||||
import org.slf4j.Logger;
 | 
			
		||||
| 
						 | 
				
			
			@ -36,6 +41,8 @@ public class UsuarioEncuestaResource {
 | 
			
		|||
    private String applicationName;
 | 
			
		||||
 | 
			
		||||
    private final UsuarioEncuestaService usuarioEncuestaService;
 | 
			
		||||
    private final UsuarioExtraService usuarioExtraService;
 | 
			
		||||
    private final EncuestaService encuestaService;
 | 
			
		||||
 | 
			
		||||
    private final UsuarioEncuestaRepository usuarioEncuestaRepository;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -44,11 +51,15 @@ public class UsuarioEncuestaResource {
 | 
			
		|||
    public UsuarioEncuestaResource(
 | 
			
		||||
        UsuarioEncuestaService usuarioEncuestaService,
 | 
			
		||||
        UsuarioEncuestaRepository usuarioEncuestaRepository,
 | 
			
		||||
        UsuarioEncuestaQueryService usuarioEncuestaQueryService
 | 
			
		||||
        UsuarioEncuestaQueryService usuarioEncuestaQueryService,
 | 
			
		||||
        UsuarioExtraService usuarioExtraService,
 | 
			
		||||
        EncuestaService encuestaService
 | 
			
		||||
    ) {
 | 
			
		||||
        this.usuarioEncuestaService = usuarioEncuestaService;
 | 
			
		||||
        this.usuarioEncuestaRepository = usuarioEncuestaRepository;
 | 
			
		||||
        this.usuarioEncuestaQueryService = usuarioEncuestaQueryService;
 | 
			
		||||
        this.usuarioExtraService = usuarioExtraService;
 | 
			
		||||
        this.encuestaService = encuestaService;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
| 
						 | 
				
			
			@ -195,4 +206,23 @@ public class UsuarioEncuestaResource {
 | 
			
		|||
            .headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, id.toString()))
 | 
			
		||||
            .build();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @GetMapping("/usuario-encuestas/encuesta/{id}")
 | 
			
		||||
    public ResponseEntity<List<UsuarioEncuesta>> getColaboradores(@PathVariable Long id) {
 | 
			
		||||
        List<UsuarioExtra> usuariosExtras = usuarioExtraService.findAll();
 | 
			
		||||
        List<UsuarioEncuesta> usuariosEncuestas = usuarioEncuestaService
 | 
			
		||||
            .findAll()
 | 
			
		||||
            .stream()
 | 
			
		||||
            .filter(uE -> Objects.nonNull(uE.getEncuesta()))
 | 
			
		||||
            .filter(uE -> uE.getEncuesta().getId().equals(id))
 | 
			
		||||
            .collect(Collectors.toList());
 | 
			
		||||
 | 
			
		||||
        for (UsuarioEncuesta usuarioEncuesta : usuariosEncuestas) {
 | 
			
		||||
            long usuarioExtraId = usuarioEncuesta.getUsuarioExtra().getId();
 | 
			
		||||
            UsuarioExtra usuarioExtra = usuariosExtras.stream().filter(u -> u.getId() == usuarioExtraId).findFirst().get();
 | 
			
		||||
            usuarioEncuesta.getUsuarioExtra().setNombre(usuarioExtra.getNombre());
 | 
			
		||||
            usuarioEncuesta.getUsuarioExtra().setIconoPerfil(usuarioExtra.getIconoPerfil());
 | 
			
		||||
        }
 | 
			
		||||
        return ResponseEntity.ok().body(usuariosEncuestas);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -141,7 +141,7 @@
 | 
			
		|||
                    >{{
 | 
			
		||||
                      encuesta.fechaPublicacion === undefined
 | 
			
		||||
                        ? 'Sin publicar'
 | 
			
		||||
                        : (encuesta.fechaFinalizada | formatShortDatetime | lowercase)
 | 
			
		||||
                        : (encuesta.fechaPublicacion | formatShortDatetime | lowercase)
 | 
			
		||||
                    }}
 | 
			
		||||
                  </P>
 | 
			
		||||
                </div>
 | 
			
		||||
| 
						 | 
				
			
			@ -157,7 +157,7 @@
 | 
			
		|||
                  {{
 | 
			
		||||
                  encuesta.fechaFinalizar === undefined
 | 
			
		||||
                    ? 'Sin fecha de finalización'
 | 
			
		||||
                    : (encuesta.fechaFinalizada | formatShortDatetime | lowercase)
 | 
			
		||||
                    : (encuesta.fechaFinalizar | formatShortDatetime | lowercase)
 | 
			
		||||
                  }}</span
 | 
			
		||||
                >
 | 
			
		||||
                </dd>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -132,12 +132,16 @@ export class EncuestaComponent implements OnInit, AfterViewInit {
 | 
			
		|||
  loadAll(): void {
 | 
			
		||||
    this.isLoading = true;
 | 
			
		||||
 | 
			
		||||
    this.usuarioExtraService
 | 
			
		||||
      .retrieveAllPublicUsers()
 | 
			
		||||
      .pipe(finalize(() => this.loadPublicUser()))
 | 
			
		||||
      .subscribe(res => {
 | 
			
		||||
        this.userSharedCollection = res;
 | 
			
		||||
      });
 | 
			
		||||
    if (this.isAdmin()) {
 | 
			
		||||
      this.usuarioExtraService
 | 
			
		||||
        .retrieveAllPublicUsers()
 | 
			
		||||
        .pipe(finalize(() => this.loadPublicUser()))
 | 
			
		||||
        .subscribe(res => {
 | 
			
		||||
          this.userSharedCollection = res;
 | 
			
		||||
        });
 | 
			
		||||
    } else {
 | 
			
		||||
      this.loadEncuestas();
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  loadPublicUser(): void {
 | 
			
		||||
| 
						 | 
				
			
			@ -152,30 +156,7 @@ export class EncuestaComponent implements OnInit, AfterViewInit {
 | 
			
		|||
  loadUserExtras() {
 | 
			
		||||
    this.usuarioExtraService
 | 
			
		||||
      .query()
 | 
			
		||||
      .pipe(
 | 
			
		||||
        finalize(() =>
 | 
			
		||||
          this.encuestaService.query().subscribe(
 | 
			
		||||
            (res: HttpResponse<IEncuesta[]>) => {
 | 
			
		||||
              this.isLoading = false;
 | 
			
		||||
              const tmpEncuestas = res.body ?? [];
 | 
			
		||||
              if (this.isAdmin()) {
 | 
			
		||||
                this.encuestas = tmpEncuestas.filter(e => e.estado !== EstadoEncuesta.DELETED);
 | 
			
		||||
 | 
			
		||||
                this.encuestas.forEach(e => {
 | 
			
		||||
                  e.usuarioExtra = this.usuarioExtrasSharedCollection?.find(pU => pU.id == e.usuarioExtra?.id);
 | 
			
		||||
                });
 | 
			
		||||
              } else {
 | 
			
		||||
                this.encuestas = tmpEncuestas
 | 
			
		||||
                  .filter(e => e.usuarioExtra?.id === this.usuarioExtra?.id)
 | 
			
		||||
                  .filter(e => e.estado !== EstadoEncuesta.DELETED);
 | 
			
		||||
              }
 | 
			
		||||
            },
 | 
			
		||||
            () => {
 | 
			
		||||
              this.isLoading = false;
 | 
			
		||||
            }
 | 
			
		||||
          )
 | 
			
		||||
        )
 | 
			
		||||
      )
 | 
			
		||||
      .pipe(finalize(() => this.loadEncuestas()))
 | 
			
		||||
      .subscribe(
 | 
			
		||||
        (res: HttpResponse<IUsuarioExtra[]>) => {
 | 
			
		||||
          this.isLoading = false;
 | 
			
		||||
| 
						 | 
				
			
			@ -190,6 +171,29 @@ export class EncuestaComponent implements OnInit, AfterViewInit {
 | 
			
		|||
      );
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  loadEncuestas() {
 | 
			
		||||
    this.encuestaService.query().subscribe(
 | 
			
		||||
      (res: HttpResponse<IEncuesta[]>) => {
 | 
			
		||||
        this.isLoading = false;
 | 
			
		||||
        const tmpEncuestas = res.body ?? [];
 | 
			
		||||
        if (this.isAdmin()) {
 | 
			
		||||
          this.encuestas = tmpEncuestas.filter(e => e.estado !== EstadoEncuesta.DELETED);
 | 
			
		||||
 | 
			
		||||
          this.encuestas.forEach(e => {
 | 
			
		||||
            e.usuarioExtra = this.usuarioExtrasSharedCollection?.find(pU => pU.id == e.usuarioExtra?.id);
 | 
			
		||||
          });
 | 
			
		||||
        } else {
 | 
			
		||||
          this.encuestas = tmpEncuestas
 | 
			
		||||
            .filter(e => e.usuarioExtra?.id === this.usuarioExtra?.id)
 | 
			
		||||
            .filter(e => e.estado !== EstadoEncuesta.DELETED);
 | 
			
		||||
        }
 | 
			
		||||
      },
 | 
			
		||||
      () => {
 | 
			
		||||
        this.isLoading = false;
 | 
			
		||||
      }
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  ngOnInit(): void {
 | 
			
		||||
    this.searchString = '';
 | 
			
		||||
    this.accesoEncuesta = '';
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,6 +12,25 @@
 | 
			
		|||
        (click)="loadAplicationParameters()"
 | 
			
		||||
      ></fa-icon>
 | 
			
		||||
        <fa-icon class="ds-info--icon" [icon]="faEye" (click)="openPreview()"></fa-icon>
 | 
			
		||||
      <div class="d-flex px-4">
 | 
			
		||||
        <div class="col-12">
 | 
			
		||||
          <div class="row" style="flex-direction: row-reverse">
 | 
			
		||||
            <div class="col-mb-2 iconos-colab">
 | 
			
		||||
              <div class="add-collab">
 | 
			
		||||
                <fa-icon icon="sync" [icon]="faPlus"></fa-icon>
 | 
			
		||||
              </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="col-mb-2 iconos-colab" *ngFor="let colaborador of usuariosColaboradores">
 | 
			
		||||
              <img
 | 
			
		||||
                class="photo-collab"
 | 
			
		||||
                *ngIf="colaborador.usuarioExtra"
 | 
			
		||||
                src="../../../../content/profile_icons/C{{ colaborador.usuarioExtra.iconoPerfil }}.png"
 | 
			
		||||
                alt="{{ colaborador.usuarioExtra.nombre }}"
 | 
			
		||||
              />
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
    <p class="ds-subtitle">Creada el día {{ encuesta!.fechaCreacion | formatShortDatetime | lowercase }}</p>
 | 
			
		||||
| 
						 | 
				
			
			@ -226,7 +245,7 @@
 | 
			
		|||
        [formGroup]="editFormQuestion"
 | 
			
		||||
      >
 | 
			
		||||
        <div class="modal-header">
 | 
			
		||||
          <h1 class="modal-title" id="exampleModalLongTitle2">Crear Pregunta</h1>
 | 
			
		||||
          <h1 class="modal-title" id="exampleModalLongTitle1">Crear Pregunta</h1>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="modal-body">
 | 
			
		||||
          <!-- Survey Create Question Modal -->
 | 
			
		||||
| 
						 | 
				
			
			@ -369,7 +388,7 @@
 | 
			
		|||
  <div class="modal-dialog modal-dialog-centered" role="document">
 | 
			
		||||
    <div class="modal-content">
 | 
			
		||||
      <div class="modal-header">
 | 
			
		||||
        <h1 class="modal-title" id="exampleModalLongTitle">Información de Encuesta</h1>
 | 
			
		||||
        <h1 class="modal-title" id="exampleModalLongTitle2">Información de Encuesta</h1>
 | 
			
		||||
      </div>
 | 
			
		||||
 | 
			
		||||
      <!-- {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -34,6 +34,9 @@ import { ParametroAplicacionService } from './../../parametro-aplicacion/service
 | 
			
		|||
import { IParametroAplicacion } from './../../parametro-aplicacion/parametro-aplicacion.model';
 | 
			
		||||
import { Router } from '@angular/router';
 | 
			
		||||
 | 
			
		||||
import { UsuarioEncuestaService } from 'app/entities/usuario-encuesta/service/usuario-encuesta.service';
 | 
			
		||||
import { IUsuarioEncuesta } from '../../usuario-encuesta/usuario-encuesta.model';
 | 
			
		||||
 | 
			
		||||
@Component({
 | 
			
		||||
  selector: 'jhi-encuesta-update',
 | 
			
		||||
  templateUrl: './encuesta-update.component.html',
 | 
			
		||||
| 
						 | 
				
			
			@ -50,6 +53,7 @@ export class EncuestaUpdateComponent implements OnInit, AfterViewChecked {
 | 
			
		|||
 | 
			
		||||
  categoriasSharedCollection: ICategoria[] = [];
 | 
			
		||||
  usuarioExtrasSharedCollection: IUsuarioExtra[] = [];
 | 
			
		||||
  usuariosColaboradores: IUsuarioEncuesta[] = [];
 | 
			
		||||
 | 
			
		||||
  // editForm = this.fb.group({
 | 
			
		||||
  //   id: [],
 | 
			
		||||
| 
						 | 
				
			
			@ -105,6 +109,7 @@ export class EncuestaUpdateComponent implements OnInit, AfterViewChecked {
 | 
			
		|||
    protected ePreguntaCerradaOpcionService: EPreguntaCerradaOpcionService,
 | 
			
		||||
    protected parametroAplicacionService: ParametroAplicacionService,
 | 
			
		||||
    protected ePreguntaAbiertaService: EPreguntaAbiertaService,
 | 
			
		||||
    protected usuarioEncuestaService: UsuarioEncuestaService,
 | 
			
		||||
    protected router: Router
 | 
			
		||||
  ) {}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -131,6 +136,17 @@ export class EncuestaUpdateComponent implements OnInit, AfterViewChecked {
 | 
			
		|||
        this.isLoading = false;
 | 
			
		||||
      }
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
    this.usuarioEncuestaService.findCollaborators(this.encuesta?.id!).subscribe(
 | 
			
		||||
      (res: any) => {
 | 
			
		||||
        this.isLoading = false;
 | 
			
		||||
        this.usuariosColaboradores = res.body ?? [];
 | 
			
		||||
        console.log(this.usuariosColaboradores);
 | 
			
		||||
      },
 | 
			
		||||
      () => {
 | 
			
		||||
        this.isLoading = false;
 | 
			
		||||
      }
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  async loadAplicationParameters(): Promise<void> {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -49,6 +49,12 @@ export class UsuarioEncuestaService {
 | 
			
		|||
      .pipe(map((res: EntityResponseType) => this.convertDateFromServer(res)));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  findCollaborators(id: number): Observable<EntityResponseType> {
 | 
			
		||||
    return this.http
 | 
			
		||||
      .get<any>(`${this.resourceUrl}/encuesta/${id}`, { observe: 'response' })
 | 
			
		||||
      .pipe(map((res: EntityResponseType) => this.convertDateFromServer(res)));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  query(req?: any): Observable<EntityArrayResponseType> {
 | 
			
		||||
    const options = createRequestOption(req);
 | 
			
		||||
    return this.http
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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  <fa-icon class="entity-icon--access" [icon]="faCalendarAlt"></fa-icon>  {{
 | 
			
		||||
                        >Fecha de inicio  <fa-icon class="entity-icon--access" [icon]="faCalendarAlt"></fa-icon>  {{
 | 
			
		||||
                          encuesta.fechaPublicacion | formatShortDatetime | titlecase
 | 
			
		||||
                        }}</span
 | 
			
		||||
                      >
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="entity-body--row m-2">
 | 
			
		||||
                      <span class="mt-2"
 | 
			
		||||
                        >Fecha de Finalización   <fa-icon class="entity-icon--access" [icon]="faCalendarAlt"></fa-icon
 | 
			
		||||
                        >Fecha de finalización   <fa-icon class="entity-icon--access" [icon]="faCalendarAlt"></fa-icon
 | 
			
		||||
                        >  {{ encuesta.fechaFinalizar | formatShortDatetime | titlecase }}</span
 | 
			
		||||
                      >
 | 
			
		||||
                    </div>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
<div #footer class="footer">
 | 
			
		||||
<div #footer class="footer" [hidden]="!notAccount">
 | 
			
		||||
  <div>
 | 
			
		||||
    <p>
 | 
			
		||||
      Copyright © Derechos reservados - Desarrollado por
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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;
 | 
			
		||||
        }
 | 
			
		||||
      });
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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',
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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']);
 | 
			
		||||
          }
 | 
			
		||||
          // }
 | 
			
		||||
        },
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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',
 | 
			
		||||
  },
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			@ -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"
 | 
			
		||||
            >
 | 
			
		||||
 | 
			
		||||
              <!–(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">
 | 
			
		||||
                  <span class="tag mt-2">{{ encuesta.categoria?.nombre | lowercase }}</span>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="entity-body--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--row m-2">
 | 
			
		||||
                      <span class="mt-2"
 | 
			
		||||
                      >Fecha de inicio  <fa-icon class="entity-icon--access" [icon]="faCalendarAlt"></fa-icon>  {{
 | 
			
		||||
                        encuesta.fechaPublicacion | formatShortDatetime | titlecase
 | 
			
		||||
                        }}</span
 | 
			
		||||
                      >
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="entity-body--row m-2">
 | 
			
		||||
                      <span class="mt-2"
 | 
			
		||||
                      >Fecha de finalización   <fa-icon class="entity-icon--access" [icon]="faCalendarAlt"></fa-icon
 | 
			
		||||
                      >  {{ encuesta.fechaFinalizar | formatShortDatetime | titlecase }}</span
 | 
			
		||||
                      >
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="entity-body--row m-2">
 | 
			
		||||
                      <p>Calificacion</p>
 | 
			
		||||
                      <fa-icon *ngFor="let i of [].constructor(encuesta.calificacion)" class="entity-icon--star" [icon]="faStar"></fa-icon>
 | 
			
		||||
                      <fa-icon
 | 
			
		||||
                        *ngFor="let i of [].constructor(5 - encuesta.calificacion!)"
 | 
			
		||||
                        class="entity-icon--star--off"
 | 
			
		||||
                        [icon]="faStar"
 | 
			
		||||
                      ></fa-icon>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="entity-body--row m-2">
 | 
			
		||||
                      <button class="ds-btn btn-card"><fa-icon [icon]="faPollH"></fa-icon>  Completar encuesta</button>
 | 
			
		||||
                    </div>
 | 
			
		||||
                  </div>
 | 
			
		||||
                </div>
 | 
			
		||||
              </div>–>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>-->
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
  <!--Inicio de cards-->
 | 
			
		||||
</div>
 | 
			
		||||
| 
						 | 
				
			
			@ -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;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -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!;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -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 {}
 | 
			
		||||
| 
						 | 
				
			
			@ -162,3 +162,38 @@
 | 
			
		|||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.iconos-colab {
 | 
			
		||||
  margin-right: -8px;
 | 
			
		||||
  z-index: 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.photo-collab {
 | 
			
		||||
  width: 40px;
 | 
			
		||||
  border-radius: 50px;
 | 
			
		||||
  border: 2px solid #fff;
 | 
			
		||||
 | 
			
		||||
  &:hover {
 | 
			
		||||
    margin-top: -4px;
 | 
			
		||||
    cursor: pointer;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.add-collab {
 | 
			
		||||
  background: #c3c2c2;
 | 
			
		||||
  text-align: center;
 | 
			
		||||
  width: 40px;
 | 
			
		||||
  height: 40px;
 | 
			
		||||
  color: #fff;
 | 
			
		||||
  padding: 4pt 7pt;
 | 
			
		||||
  border-radius: 50px;
 | 
			
		||||
  border: 2px solid #fff;
 | 
			
		||||
  position: relative;
 | 
			
		||||
  top: 0;
 | 
			
		||||
  transition: all 0.1s ease-in-out;
 | 
			
		||||
  &:hover {
 | 
			
		||||
    /*margin-top: -4px;**/
 | 
			
		||||
    top: -5px;
 | 
			
		||||
    cursor: pointer;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue