Skip to content

Commit

Permalink
se arreglo el search y se les agrego el pipe titlecase
Browse files Browse the repository at this point in the history
  • Loading branch information
matias1305 committed Dec 13, 2018
1 parent f1bc62e commit ff0fa45
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 24 deletions.
5 changes: 5 additions & 0 deletions src/app/pages/add-book/add-book.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ <h1 style="padding-top:30px;">Agregar libro</h1>
<div class="form-group">
<input id="file" type="file" style="padding-top: 25px;" (change)="uploadFile($event)" multiple>
</div>
<div class="box-info-text">
<div class="info-text"> <span>*</span> Debe subir todas las imagenes de una vez. </div>
<div class="info-text"> <span>*</span> Para seleccionar mas de una imagen presione <code>CTRL</code> + la imagen que desea subir. </div>
</div>


</div>
<!-- Fin col 1 -->
Expand Down
3 changes: 0 additions & 3 deletions src/app/pages/add-book/add-book.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ export class AddBookComponent implements OnInit {
book.status = 'available';
book.genres = this.selected_categories;

console.log(book.genres);
console.log(this.selected_categories);

// Guarda el libro
this._dbService.addData('books', book)
.then( () => {
Expand Down
24 changes: 12 additions & 12 deletions src/app/pages/search/search.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ <h4 class="card-title">Libros</h4>
[src]="book.images[0]"
width="60">
<div class="media-body">
<h5 class="mt-0 mb-2"> {{ book.title }} </h5>
<h5 class="mt-0 mb-2">{{ book.author }}</h5>
<h5 class="mt-0 mb-2">{{ book.language }}</h5>
<h5 class="mt-0 mb-2"> {{ book.title | titlecase }} </h5>
<h5 class="mt-0 mb-2">{{ book.author | titlecase }}</h5>
<h5 class="mt-0 mb-2">{{ book.language | titlecase }}</h5>
<h5 class="mt-0 mb-2" *ngIf="book.transaction === 'Ambos'"> Venta-Intercambio </h5>
<h5 class="mt-0 mb-2" *ngIf="book.transaction !== 'Ambos'"> {{ book.transaction }}</h5>
<h5 class="mt-0 mb-2 text-success" *ngIf="book.transaction === 'Ambos'"> ${{ book.price }} </h5>
Expand All @@ -36,8 +36,8 @@ <h4 class="card-title">Autores</h4>
[src]="auth.images[0]"
width="60">
<div class="media-body">
<h5 class="mt-0 mb-2"> {{ auth.author }} </h5>
<h5 class="mt-0 mb-2"> {{ auth.title }} </h5>
<h5 class="mt-0 mb-2"> {{ auth.author | titlecase }} </h5>
<h5 class="mt-0 mb-2"> {{ auth.title | titlecase }} </h5>
</div>
</li>
</ul>
Expand All @@ -54,13 +54,13 @@ <h5 class="mt-0 mb-2"> {{ auth.title }} </h5>
<div class="card-body">
<h4 class="card-title">Dueños</h4>
<ul class="list-unstyled" *ngIf="owners.length > 0; else noOwner">
<li class="media media border p-1" *ngFor="let cat of sidebar">
<li class="media media border p-1" *ngFor="let cat of owners">
<img class="d-flex mr-3"
[src]="cat.img"
width="60">
<div class="media-body">
<h5 class="mt-0 mb-2">{{ cat.name }}</h5>
<h5 class="mt-0 mb-2"> {{ cat.last_name1 }} {{ cat.last_name2 }} </h5>
<h5 class="mt-0 mb-2">{{ cat.name | titlecase }}</h5>
<h5 class="mt-0 mb-2"> {{ cat.last_name1 | titlecase }} {{ cat.last_name2 | titlecase }} </h5>
</div>
</li>
</ul>
Expand Down Expand Up @@ -90,16 +90,16 @@ <h4 class="card-title">Búsqueda por categoría: {{ typeInput[1] }}</h4>
[src]="cat.images[0]"
width="60">
<div class="media-body">
<h5 class="mt-0 mb-2"> {{ cat.title }} </h5>
<h5 class="mt-0 mb-2">{{ cat.author }}</h5>
<h5 class="mt-0 mb-2">{{ cat.language }}</h5>
<h5 class="mt-0 mb-2"> {{ cat.title | titlecase }} </h5>
<h5 class="mt-0 mb-2">{{ cat.author | titlecase }}</h5>
<h5 class="mt-0 mb-2">{{ cat.language | titlecase }}</h5>
<h5 class="mt-0 mb-2" *ngIf="cat.transaction === 'Ambos'"> Venta-Intercambio </h5>
<h5 class="mt-0 mb-2" *ngIf="cat.transaction !== 'Ambos'"> {{ cat.transaction }}</h5>
<h5 class="mt-0 mb-2 text-success" *ngIf="cat.transaction === 'Ambos'"> ${{ cat.price }} </h5>
<h5 class="mt-0 mb-2 text-success" *ngIf="cat.transaction === 'Venta'"> ${{ cat.price }} </h5>
<hr>
<h5 class="mt-0 mb-2"> Otras categorías a las que pertenece </h5>
<h6 class="mt-0 mb-2" *ngFor="let genres of cat.genres"> {{ genres }} </h6>
<h6 class="mt-0 mb-2" *ngFor="let genres of cat.genres"> {{ genres | titlecase }} </h6>
</div>
</li>
</ul>
Expand Down
16 changes: 9 additions & 7 deletions src/app/pages/search/search.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,17 @@ export class SearchComponent implements OnInit {
searchOwner(users:any[], search:string) {
console.log(users);
let owners = [...users].filter( data => {

if( data.name.indexOf(search.toLowerCase()) >= 0 ) return data;
});

console.log(owners);

for( let user of users ){
let owner = user.name;
if( owner.indexOf(search.toLowerCase()) >= 0 ) {
owners.push(user);
}
}
// for( let user of users ){
// let owner = user.name;
// if( owner.indexOf(search.toLowerCase()) >= 0 ) {
// owners.push(user);
// }
// }
return owners;
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/register/register.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ <h3 class="box-title m-b-40">Datos de perfil</h3>

<div class="form-group m-t-20">
<div class="col-xs-12">
<input formControlName="rut" class="form-control" type="text" placeholder="RUT">
<input formControlName="rut" class="form-control" type="text" placeholder="RUT ejemplo: 12345678-9">
</div>
<div *ngIf="form.controls['rut'].errors?.required && submit1"><p class="text-danger">El RUT es requerido</p></div>
<div *ngIf="form.controls['rut'].errors?.pattern && submit1"><p class="text-danger">El RUT ingresado no es válido</p></div>
Expand Down
2 changes: 1 addition & 1 deletion src/app/shared/sidebar/sidebar.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<li class="nav-small-cap active"
style="cursor: pointer;"
*ngFor="let m of menu">
<a *ngIf="role === 'normal'" [routerLink]="['/search', 'sidebar.'+m.name]"> {{ m }} </a>
<a *ngIf="role === 'normal'" [routerLink]="['/search', 'sidebar.'+m]"> {{ m }} </a>
<a *ngIf="role === 'admin'" [routerLink]=[m.route]> {{ m }} </a>
</li>
</ul>
Expand Down
14 changes: 14 additions & 0 deletions src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,17 @@
flex-direction: column;
box-shadow: 5px 5px 31px -6px rgba(84, 84, 84, 1);
}

.box-info-text {
background: #F2D7D5;
padding: 1.4rem;
margin-bottom: 2rem;
}
.box-info-text .info-text {
background: #F2D7D5;
width: 400px;
}

.box-info-text .info-text span {
color: red;
}

0 comments on commit ff0fa45

Please sign in to comment.