add filtro de encuesta por nombre

This commit is contained in:
Mariela Bonilla 2021-07-20 21:52:42 -06:00
parent c905854300
commit 8e22d769f6
2 changed files with 196 additions and 163 deletions

View File

@ -34,6 +34,13 @@
<div class="alert alert-warning" id="no-result" *ngIf="encuestas?.length === 0"> <div class="alert alert-warning" id="no-result" *ngIf="encuestas?.length === 0">
<span jhiTranslate="dataSurveyApp.encuesta.home.notFound">No encuestas found</span> <span jhiTranslate="dataSurveyApp.encuesta.home.notFound">No encuestas found</span>
</div> </div>
<div class="table-responsive" id="entities" *ngIf="encuestas && encuestas.length > 0">
<form class="ds-form">
<div class="input-group">
<div class="input-group-addon"><i class="glyphicon glyphicon-search"></i></div>
<input type="text" name="searchEncuesta" placeholder="Buscar..." [(ngModel)]="searchEncuesta" />
</div>
</form>
<!-- Lista de Encuestas del Usuario --> <!-- Lista de Encuestas del Usuario -->
<div class="ds-list" (contextmenu)="openContextMenu($event)"> <div class="ds-list" (contextmenu)="openContextMenu($event)">
@ -58,7 +65,9 @@
<button type="button" id="contextmenu-edit"><fa-icon class="contextmenu__icon" [icon]="faEdit"></fa-icon>Editar</button> <button type="button" id="contextmenu-edit"><fa-icon class="contextmenu__icon" [icon]="faEdit"></fa-icon>Editar</button>
</li> </li>
<li> <li>
<button type="button" id="contextmenu-duplicate"><fa-icon class="contextmenu__icon" [icon]="faCopy"></fa-icon>Duplicar</button> <button type="button" id="contextmenu-duplicate">
<fa-icon class="contextmenu__icon" [icon]="faCopy"></fa-icon>Duplicar
</button>
</li> </li>
<li> <li>
<button type="button" id="contextmenu-rename"> <button type="button" id="contextmenu-rename">
@ -66,7 +75,9 @@
</button> </button>
</li> </li>
<li> <li>
<button type="button" id="contextmenu-share"><fa-icon class="contextmenu__icon" [icon]="faShareAlt"></fa-icon>Compartir</button> <button type="button" id="contextmenu-share">
<fa-icon class="contextmenu__icon" [icon]="faShareAlt"></fa-icon>Compartir
</button>
</li> </li>
</div> </div>
<div class="ds-contextmenu__divider" id="contextmenu-delete--separator"> <div class="ds-contextmenu__divider" id="contextmenu-delete--separator">
@ -79,7 +90,7 @@
<div <div
class="ds-list--entity" class="ds-list--entity"
*ngFor="let encuesta of encuestas; trackBy: trackId" *ngFor="let encuesta of encuestas | filter: 'nombre':searchEncuesta; trackBy: trackId"
(dblclick)="openSurvey($event)" (dblclick)="openSurvey($event)"
(click)="selectSurvey($event)" (click)="selectSurvey($event)"
[attr.data-id]="encuesta.id" [attr.data-id]="encuesta.id"
@ -89,28 +100,44 @@
<div <div
class="entity-state" class="entity-state"
[ngClass]=" [ngClass]="
encuesta.estado == 'DRAFT' ? 'entity-state--blue' : encuesta.estado == 'ACTIVE' ? 'entity-state--green' : 'entity-state--red' encuesta.estado == 'DRAFT'
? 'entity-state--blue'
: encuesta.estado == 'ACTIVE'
? 'entity-state--green'
: 'entity-state--red'
" "
style="animation-delay: 0s" style="animation-delay: 0s"
></div> ></div>
<div <div
class="entity-state" class="entity-state"
[ngClass]=" [ngClass]="
encuesta.estado == 'DRAFT' ? 'entity-state--blue' : encuesta.estado == 'ACTIVE' ? 'entity-state--green' : 'entity-state--red' encuesta.estado == 'DRAFT'
? 'entity-state--blue'
: encuesta.estado == 'ACTIVE'
? 'entity-state--green'
: 'entity-state--red'
" "
style="animation-delay: 1s" style="animation-delay: 1s"
></div> ></div>
<div <div
class="entity-state entity-state--blue" class="entity-state entity-state--blue"
[ngClass]=" [ngClass]="
encuesta.estado == 'DRAFT' ? 'entity-state--blue' : encuesta.estado == 'ACTIVE' ? 'entity-state--green' : 'entity-state--red' encuesta.estado == 'DRAFT'
? 'entity-state--blue'
: encuesta.estado == 'ACTIVE'
? 'entity-state--green'
: 'entity-state--red'
" "
style="animation-delay: 2s" style="animation-delay: 2s"
></div> ></div>
<div <div
class="entity-state entity-state--blue" class="entity-state entity-state--blue"
[ngClass]=" [ngClass]="
encuesta.estado == 'DRAFT' ? 'entity-state--blue' : encuesta.estado == 'ACTIVE' ? 'entity-state--green' : 'entity-state--red' encuesta.estado == 'DRAFT'
? 'entity-state--blue'
: encuesta.estado == 'ACTIVE'
? 'entity-state--green'
: 'entity-state--red'
" "
style="animation-delay: 3s" style="animation-delay: 3s"
></div> ></div>
@ -204,6 +231,7 @@
</div> </div>
</div> </div>
</div> </div>
</div>
<!-- <div class="table-responsive" id="entities" *ngIf="encuestas && encuestas.length > 0"> <!-- <div class="table-responsive" id="entities" *ngIf="encuestas && encuestas.length > 0">
<table class="table table-striped" aria-describedby="page-heading"> <table class="table table-striped" aria-describedby="page-heading">

View File

@ -66,6 +66,8 @@ export class EncuestaComponent implements OnInit, AfterViewInit {
categoriasSharedCollection: ICategoria[] = []; categoriasSharedCollection: ICategoria[] = [];
usuarioExtrasSharedCollection: IUsuarioExtra[] = []; usuarioExtrasSharedCollection: IUsuarioExtra[] = [];
public searchEncuesta: string;
editForm = this.fb.group({ editForm = this.fb.group({
id: [], id: [],
nombre: [null, [Validators.required, Validators.minLength(1), Validators.maxLength(50)]], nombre: [null, [Validators.required, Validators.minLength(1), Validators.maxLength(50)]],
@ -93,7 +95,9 @@ export class EncuestaComponent implements OnInit, AfterViewInit {
protected fb: FormBuilder, protected fb: FormBuilder,
protected accountService: AccountService, protected accountService: AccountService,
protected router: Router protected router: Router
) {} ) {
this.searchEncuesta = '';
}
resetForm(): void { resetForm(): void {
this.editForm.reset(); this.editForm.reset();
@ -115,6 +119,7 @@ export class EncuestaComponent implements OnInit, AfterViewInit {
} }
ngOnInit(): void { ngOnInit(): void {
this.searchEncuesta = '';
document.body.addEventListener('click', e => { document.body.addEventListener('click', e => {
document.getElementById('contextmenu')!.classList.add('ds-contextmenu--closed'); document.getElementById('contextmenu')!.classList.add('ds-contextmenu--closed');
document.getElementById('contextmenu')!.classList.remove('ds-contextmenu--open'); document.getElementById('contextmenu')!.classList.remove('ds-contextmenu--open');