Merge pull request #115 from Quantum-P3/feature/US-66

add filtrar plantillas para administrador
This commit is contained in:
Eduardo Quiros 2021-08-09 03:23:08 +00:00 committed by GitHub
commit 3ee63630d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 3 deletions

View File

@ -25,7 +25,36 @@
</div>
</div>
</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></jhi-alert> -->
@ -48,7 +77,10 @@
</tr>
</thead>
<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.fechaCreacion | formatMediumDatetime }}</td> -->
<td *ngIf="plantilla.fechaPublicacionTienda">{{ plantilla.fechaPublicacionTienda | formatShortDatetime | titlecase }}</td>

View File

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