add filtrar plantilla para administrador

This commit is contained in:
Mariela Bonilla 2021-08-05 23:56:00 -06:00
parent a336d41277
commit 2ed331130f
2 changed files with 43 additions and 3 deletions

View File

@ -25,7 +25,36 @@
</div> </div>
</div> </div>
</h2> </h2>
<form class="ds-form" *ngIf="isAdmin() && isAuthenticated()">
<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="estadoPlantilla" id="estadoPlantilla" [(ngModel)]="estadoPlantilla" style="width: 200px">
<option value="" selected="selected" disabled="disabled">Filtrar por estado</option>
<option value="">Todos Estados</option>
<option value="Draft">Borradores</option>
<option value="Active">En tienda</option>
<option value="Disabled">Desactivadas</option>
</select>
</div>
<!--<div class="col-3">
<div class="input-group-addon "><i class="glyphicon glyphicon-search"></i></div>
<select id="categoriaEncuesta" name="categoriaEncuesta" [(ngModel)]="categoriaEncuesta">
<option [ngValue]="null" selected>Filtre por categoría</option>
<option
*ngFor="let categoriaOption of categoriasSharedCollection; trackBy: trackCategoriaById"
[ngValue]="categoriaOption.nombre" >
{{ categoriaOption.nombre }}
</option>
</select>
</div>-->
</div>
</form>
<!-- <jhi-alert-error></jhi-alert-error> <!-- <jhi-alert-error></jhi-alert-error>
<jhi-alert></jhi-alert> --> <jhi-alert></jhi-alert> -->
@ -48,7 +77,10 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr *ngFor="let plantilla of plantillas; trackBy: trackId" data-cy="entityTable"> <tr
*ngFor="let plantilla of plantillas | filter: 'nombre':searchString | filter: 'estado':estadoPlantilla; trackBy: trackId"
data-cy="entityTable"
>
<td>{{ plantilla.nombre }}</td> <td>{{ plantilla.nombre }}</td>
<!-- <td>{{ plantilla.fechaCreacion | formatMediumDatetime }}</td> --> <!-- <td>{{ plantilla.fechaCreacion | formatMediumDatetime }}</td> -->
<td *ngIf="plantilla.fechaPublicacionTienda">{{ plantilla.fechaPublicacionTienda | formatShortDatetime | titlecase }}</td> <td *ngIf="plantilla.fechaPublicacionTienda">{{ plantilla.fechaPublicacionTienda | formatShortDatetime | titlecase }}</td>

View File

@ -43,17 +43,25 @@ export class PlantillaComponent implements OnInit {
}); });
faExchangeAlt = faExchangeAlt; faExchangeAlt = faExchangeAlt;
public searchString: string;
public estadoPlantilla: string;
constructor( constructor(
protected plantillaService: PlantillaService, protected plantillaService: PlantillaService,
protected modalService: NgbModal, protected modalService: NgbModal,
protected accountService: AccountService, protected accountService: AccountService,
protected fb: FormBuilder, protected fb: FormBuilder,
protected categoriaService: CategoriaService protected categoriaService: CategoriaService
) {} ) {
this.searchString = '';
this.estadoPlantilla = '';
}
loadAll(): void { loadAll(): void {
this.isLoading = true; this.isLoading = true;
this.searchString = '';
this.estadoPlantilla = '';
this.plantillaService.query().subscribe( this.plantillaService.query().subscribe(
(res: HttpResponse<IPlantilla[]>) => { (res: HttpResponse<IPlantilla[]>) => {
this.isLoading = false; this.isLoading = false;