add filtro por nombre en la pagina principal

This commit is contained in:
Mariela Bonilla 2021-07-24 03:40:14 -06:00
parent 4710ed3d8c
commit c305c1d369
2 changed files with 22 additions and 7 deletions

View File

@ -68,8 +68,8 @@
</div>
<div class="col-lg-4">
<div class="icon-stack icon-stack-xl bg-gradient-primary-to-secondary text-white mb-4"><i data-feather="truck"></i></div>
<h2>Pensar en el texto</h2>
<p class="mb-0">Pensar en el texto</p>
<h2>Diverso contenido</h2>
<p class="mb-0">Podrá encontrar y crear encuestas de diferentes categorías.</p>
</div>
</div>
</div>
@ -83,8 +83,19 @@
<div class="bg-light py-10 container-encuestas">
<div class="container px-0">
<h1 class="text-center mb-4">Encuestas</h1>
<div class="row gx-5">
<div class="col-xl-4 col-lg-4 col-md-6 mb-5" *ngFor="let encuesta of encuestas; trackBy: trackId">
<form class="ds-form d-inline">
<div class="input-group">
<div class="col-3">
<div class="input-group-addon"><i class="glyphicon glyphicon-search"></i></div>
<input type="text" name="searchEncuesta" placeholder="Buscar por nombre..." [(ngModel)]="searchEncuestaPublica" />
</div>
</div>
</form>
<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 | filter: 'nombre':searchEncuestaPublica; trackBy: trackId"
>
<div class="card lift h-100" (dblclick)="openSurvey($event)" (click)="selectSurvey($event)" [attr.data-id]="encuesta.id">
<div class="card-body p-3">
<div class="card-title mb-0">{{ encuesta.nombre }}</div>

View File

@ -17,7 +17,7 @@ import { UsuarioExtraService } from 'app/entities/usuario-extra/service/usuario-
import { AccountService } from 'app/core/auth/account.service';
import { Account } from 'app/core/auth/account.model';
import { faShareAlt, faWindowMaximize, faPollH, faCalendarAlt, faAngleDown, faStar } from '@fortawesome/free-solid-svg-icons';
import { faPollH, faCalendarAlt, faStar } from '@fortawesome/free-solid-svg-icons';
import * as $ from 'jquery';
@ -36,11 +36,12 @@ export class HomeComponent implements OnInit, OnDestroy {
faStar = faStar;
faCalendarAlt = faCalendarAlt;
faWindowMaximize = faWindowMaximize;
faPollH = faPollH;
notAccount: boolean = true;
public searchEncuestaPublica: string;
constructor(
protected encuestaService: EncuestaService,
protected modalService: NgbModal,
@ -50,9 +51,12 @@ export class HomeComponent implements OnInit, OnDestroy {
protected fb: FormBuilder,
protected accountService: AccountService,
protected router: Router
) {}
) {
this.searchEncuestaPublica = '';
}
ngOnInit(): void {
this.searchEncuestaPublica = '';
this.accountService
.getAuthenticationState()
.pipe(takeUntil(this.destroy$))