Commit ae020369cd2976b564e21f4a7e2a6c925c9dc315
1 parent
f09b30280b
Exists in
master
and in
1 other branch
Quitado scroll de body, quitado boton de cargar producto en busqueda de productos.
Showing
3 changed files
with
6 additions
and
23 deletions
Show diff stats
src/app/components/busqueda-productos/busqueda-productos.component.html
1 | <div class="row m-0 fade-in"> | 1 | <div class="row m-0 fade-in"> |
2 | <div class="col-12 p-0"> | 2 | <div class="col-12 p-0"> |
3 | 3 | ||
4 | <!-- NOMBRE DE SECCION --> | 4 | <!-- NOMBRE DE SECCION --> |
5 | <div class="row m-0"> | 5 | <div class="row m-0"> |
6 | <div class="col-12 p-0"> | 6 | <div class="col-12 p-0"> |
7 | <p class="h5 py-1 bg-gray text-muted text-center"> | 7 | <p class="h5 py-1 bg-gray text-muted text-center"> |
8 | Búsqueda | 8 | Búsqueda |
9 | <i class="fa fa-search"></i> | 9 | <i class="fa fa-search"></i> |
10 | </p> | 10 | </p> |
11 | </div> | 11 | </div> |
12 | </div> | 12 | </div> |
13 | 13 | ||
14 | <div class="row m-3 disable-user-select"> | 14 | <div class="row m-3 disable-user-select"> |
15 | 15 | ||
16 | <!-- FILTROS --> | 16 | <!-- FILTROS --> |
17 | <div *ngIf="verCategorias" class="col-sm-2 p-1"> | 17 | <div *ngIf="verCategorias" class="col-sm-2 p-1"> |
18 | <div class="text-center"> | 18 | <div class="text-center"> |
19 | <p class="font-weight-bold text-muted border-bottom pb-2">Buscar por Categoría</p> | 19 | <p class="font-weight-bold text-muted border-bottom pb-2">Buscar por Categoría</p> |
20 | </div> | 20 | </div> |
21 | <ul class="list-group"> | 21 | <ul class="list-group"> |
22 | <li | 22 | <li |
23 | *ngFor="let categoria of categorias" | 23 | *ngFor="let categoria of categorias" |
24 | [ngClass]="{active: categoriaActive == categoria.id}" | 24 | [ngClass]="{active: categoriaActive == categoria.id}" |
25 | (click)="categoriaActive = categoria.id; filterItems()" | 25 | (click)="categoriaActive = categoria.id; filterItems()" |
26 | class="list-group-item list-group-item-action text-center my-1 p-2 h6"> | 26 | class="list-group-item list-group-item-action text-center my-1 p-2 h6"> |
27 | {{categoria.detalle}} | 27 | {{categoria.detalle}} |
28 | </li> | 28 | </li> |
29 | </ul> | 29 | </ul> |
30 | </div> | 30 | </div> |
31 | 31 | ||
32 | <!-- SEARCH INPUT --> | 32 | <!-- SEARCH INPUT --> |
33 | <div *ngIf="productos.length > 0" class="fade-in col"> | 33 | <div *ngIf="productos.length > 0" class="fade-in col"> |
34 | 34 | ||
35 | <div class="form-group row search"> | 35 | <div class="row search"> |
36 | <div class="col-sm-10"> | 36 | <div class="col-sm-10"> |
37 | <span class="fa fa-search form-control-lg form-control-search pl-3"></span> | 37 | <span class="fa fa-search form-control-lg form-control-search pl-3"></span> |
38 | <input | 38 | <input |
39 | type="text" | 39 | type="text" |
40 | class="form-control form-control-lg shadow-sm rounded-pill px-5" | 40 | class="form-control form-control-lg shadow-sm rounded-pill px-5" |
41 | placeholder="Búsqueda productos" | 41 | placeholder="Búsqueda productos" |
42 | [(ngModel)]="searchTerm" | 42 | [(ngModel)]="searchTerm" |
43 | (ngModelChange)="filterItems()"> | 43 | (ngModelChange)="filterItems()"> |
44 | </div> | 44 | </div> |
45 | <!-- BOTON VOLVER --> | 45 | <!-- BOTON VOLVER --> |
46 | <div class="col-sm-2"> | 46 | <div class="col-sm-2"> |
47 | <button | 47 | <button |
48 | type="button" | 48 | type="button" |
49 | class="btn btn-light btn-lg shadow-sm" | 49 | class="btn btn-light btn-lg shadow-sm" |
50 | [routerLink]="['/inicio']"> | 50 | [routerLink]="['/inicio']"> |
51 | <span class="font-weight-normal h6 pr-2">Volver</span> | 51 | <span class="font-weight-normal h6 pr-2">Volver</span> |
52 | <i class="fa fa-undo text-warning" aria-hidden="true"></i> | 52 | <i class="fa fa-undo text-warning" aria-hidden="true"></i> |
53 | </button> | 53 | </button> |
54 | </div> | 54 | </div> |
55 | <div class="col-sm-12 my-2"> | ||
56 | <span class="badge badge-light px-2">Más vendidos</span> | ||
57 | </div> | ||
55 | </div> | 58 | </div> |
56 | <!-- LISTA DE PRODUCTOS --> | 59 | <!-- LISTA DE PRODUCTOS --> |
57 | <div class="row align-items-start vh-70 overflow-scroll disable-user-select"> | 60 | <div class="row align-items-start vh-70 overflow-scroll disable-user-select"> |
58 | <div | 61 | <div |
59 | class="col-4 p-2" | 62 | class="col-4 p-2" |
60 | *ngFor="let producto of auxProductos"> | 63 | *ngFor="let producto of auxProductos"> |
61 | <div | 64 | <div |
62 | class="card-effect bg-white rounded-sm shadow border-0" | 65 | class="card-effect bg-white rounded-sm shadow border-0" |
63 | (click)="mostrarBotonCargar(producto)"> | 66 | (click)="elegirProducto(producto)"> |
64 | <img src="{{apiUrl}}/imagenes/{{producto.imagenes[0].imagen}}" class="rounded-sm w-100 m-auto"> | 67 | <img src="{{apiUrl}}/imagenes/{{producto.imagenes[0].imagen}}" class="rounded-sm w-100 m-auto"> |
65 | <div class="p-2"> | 68 | <div class="p-2"> |
66 | <p class="h6 text-left m-0">{{producto.DetArt}}</p> | 69 | <p class="h6 text-left m-0">{{producto.DetArt}}</p> |
67 | <div class="row justify-content-between m-0"> | 70 | <div class="row justify-content-between m-0"> |
68 | <div class="col-12 p-0"> | 71 | <div class="col-12 p-0"> |
69 | <div class="text-left"> | 72 | <div class="text-left"> |
70 | <p class="m-0 h6"><small>{{producto.DetArt}}</small></p> | 73 | <p class="m-0 h6"><small>{{producto.DetArt}}</small></p> |
71 | <p class="m-0 h6"><small>COD. {{producto.CodRub}}</small></p> | 74 | <p class="m-0 h6"><small>COD. {{producto.CodRub}}</small></p> |
72 | </div> | 75 | </div> |
73 | </div> | 76 | </div> |
74 | <div class="col-12 my-auto pt-2 pr-2 p-0"> | 77 | <div class="col-12 my-auto pt-2 pr-2 p-0"> |
75 | <p class="text-right m-0 h6">{{producto.PreVen | currency}}</p> | 78 | <p class="text-right m-0 h6">{{producto.PreVen | currency}}</p> |
76 | </div> | 79 | </div> |
77 | </div> | 80 | </div> |
78 | <div *ngIf="producto.showCargarProducto" class="row mt-2 fade-bottom"> | ||
79 | <div class="col-sm-12"> | ||
80 | <button | ||
81 | type="button" | ||
82 | class="btn btn-block btn-outline-primary shadow" | ||
83 | (click)="elegirProducto(producto)"> | ||
84 | Cargar Producto | ||
85 | </button> | ||
86 | </div> | ||
87 | </div> | ||
88 | </div> | 81 | </div> |
89 | </div> | 82 | </div> |
90 | </div> | 83 | </div> |
91 | </div> | 84 | </div> |
92 | </div> | 85 | </div> |
93 | 86 | ||
94 | <!-- SPINNER --> | 87 | <!-- SPINNER --> |
95 | <div | 88 | <div |
96 | *ngIf="productos.length === 0 && showSpinner" | 89 | *ngIf="productos.length === 0 && showSpinner" |
97 | class="col-sm-10 p-0 align-self-center text-center"> | 90 | class="col-sm-10 p-0 align-self-center text-center"> |
98 | <div class="spinner-border spinner-lg text-secondary" role="status"></div> | 91 | <div class="spinner-border spinner-lg text-secondary" role="status"></div> |
99 | <span class="text-secondary m-2 h5">Cargando información.</span> | 92 | <span class="text-secondary m-2 h5">Cargando información.</span> |
100 | </div> | 93 | </div> |
101 | 94 | ||
102 | </div> | 95 | </div> |
103 | 96 | ||
104 | </div> | 97 | </div> |
src/app/components/busqueda-productos/busqueda-productos.component.ts
1 | import { Component, OnInit } from '@angular/core'; | 1 | import { Component, OnInit } from '@angular/core'; |
2 | import { ProductoService } from 'src/app/services/producto.service'; | 2 | import { ProductoService } from 'src/app/services/producto.service'; |
3 | import { Producto } from 'src/app/wrappers/producto'; | 3 | import { Producto } from 'src/app/wrappers/producto'; |
4 | import { Categoria } from 'src/app/wrappers/categoria'; | 4 | import { Categoria } from 'src/app/wrappers/categoria'; |
5 | import { appSettings } from 'src/etc/AppSettings'; | 5 | import { appSettings } from 'src/etc/AppSettings'; |
6 | import { Router } from '@angular/router'; | 6 | import { Router } from '@angular/router'; |
7 | 7 | ||
8 | @Component({ | 8 | @Component({ |
9 | selector: 'app-busqueda-productos', | 9 | selector: 'app-busqueda-productos', |
10 | templateUrl: './busqueda-productos.component.html', | 10 | templateUrl: './busqueda-productos.component.html', |
11 | styleUrls: ['./busqueda-productos.component.scss'] | 11 | styleUrls: ['./busqueda-productos.component.scss'] |
12 | }) | 12 | }) |
13 | export class BusquedaProductosComponent implements OnInit { | 13 | export class BusquedaProductosComponent implements OnInit { |
14 | 14 | ||
15 | private productos: Producto[] = []; | 15 | private productos: Producto[] = []; |
16 | private auxProductos: Producto[] = []; | 16 | private auxProductos: Producto[] = []; |
17 | private searchTerm: string = ''; | 17 | private searchTerm: string = ''; |
18 | private categoriaActive: number = null; | 18 | private categoriaActive: number = null; |
19 | private showSpinner: boolean = true; | 19 | private showSpinner: boolean = true; |
20 | private verCategorias: boolean = true; | 20 | private verCategorias: boolean = true; |
21 | private apiUrl: string = appSettings.apiUrl; | 21 | private apiUrl: string = appSettings.apiUrl; |
22 | private showBtnCargarProducto: boolean = false; | ||
23 | private categorias: Categoria[] = []; | 22 | private categorias: Categoria[] = []; |
24 | 23 | ||
25 | constructor( | 24 | constructor( |
26 | private productoService: ProductoService, | 25 | private productoService: ProductoService, |
27 | private router: Router) { } | 26 | private router: Router) { } |
28 | 27 | ||
29 | ngOnInit() { | 28 | ngOnInit() { |
30 | 29 | ||
31 | this.verCategorias = this.productoService.verCategoriasProductos; | 30 | this.verCategorias = this.productoService.verCategoriasProductos; |
32 | 31 | ||
33 | this.productoService.getCategorias() | 32 | this.productoService.getCategorias() |
34 | .subscribe((categorias: Categoria[]) => { | 33 | .subscribe((categorias: Categoria[]) => { |
35 | this.categorias = categorias; | 34 | this.categorias = categorias; |
36 | this.categoriaActive = this.verCategorias ? 1 : categorias[0].id; | 35 | this.categoriaActive = this.verCategorias ? 1 : categorias[0].id; |
37 | }); | 36 | }); |
38 | 37 | ||
39 | this.productoService.productoAcargar = undefined; | 38 | this.productoService.productoAcargar = undefined; |
40 | this.productoService.getAll() | 39 | this.productoService.getAll() |
41 | .subscribe((data: Producto[]) => { | 40 | .subscribe((data: Producto[]) => { |
42 | 41 | ||
43 | this.productos = data; | 42 | this.productos = data; |
44 | this.filterItems(); | 43 | this.filterItems(); |
45 | }, (error) => { | 44 | }, (error) => { |
46 | this.showSpinner = false; | 45 | this.showSpinner = false; |
47 | console.error(error); | 46 | console.error(error); |
48 | }); | 47 | }); |
49 | } | 48 | } |
50 | 49 | ||
51 | filterItems() { | 50 | filterItems() { |
52 | 51 | ||
53 | this.auxProductos = this.productos.filter(x => { | 52 | this.auxProductos = this.productos.filter(x => { |
54 | return x.DetArt.toLowerCase().includes(this.searchTerm.toLowerCase()) && | 53 | return x.DetArt.toLowerCase().includes(this.searchTerm.toLowerCase()) && |
55 | x.categoria_selfservice == this.categoriaActive; | 54 | x.categoria_selfservice == this.categoriaActive; |
56 | }); | 55 | }); |
57 | } | 56 | } |
58 | 57 | ||
59 | agregarAlCarrito(producto: Producto) { | 58 | agregarAlCarrito(producto: Producto) { |
60 | 59 | ||
61 | producto.cantidad = 1; | 60 | producto.cantidad = 1; |
62 | this.productoService.productos.push(producto); | 61 | this.productoService.productos.push(producto); |
63 | } | 62 | } |
64 | 63 | ||
65 | private mostrarBotonCargar(producto: Producto) { | ||
66 | |||
67 | for (let i = 0; i < this.auxProductos.length; i++) { | ||
68 | if (this.auxProductos[i].id !== producto.id) | ||
69 | this.auxProductos[i].showCargarProducto = false; | ||
70 | else if (producto.showCargarProducto) return; | ||
71 | } | ||
72 | producto.showCargarProducto = !producto.showCargarProducto | ||
73 | } | ||
74 | |||
75 | private elegirProducto(producto: Producto) { | 64 | private elegirProducto(producto: Producto) { |
76 | 65 | ||
77 | this.productoService.productoAcargar = producto; | 66 | this.productoService.productoAcargar = producto; |
78 | this.router.navigate(['inicio']); | 67 | this.router.navigate(['inicio']); |
79 | } | 68 | } |
80 | } | 69 | } |
81 | 70 |
src/styles.scss
1 | @import "./assets/scss/animation.scss"; | 1 | @import "./assets/scss/animation.scss"; |
2 | @import "./assets/scss/bootstrap-override.scss"; | 2 | @import "./assets/scss/bootstrap-override.scss"; |
3 | @import "../node_modules/bootstrap/scss/_variables.scss"; | 3 | @import "../node_modules/bootstrap/scss/_variables.scss"; |
4 | 4 | ||
5 | html, | 5 | html, |
6 | body { | 6 | body { |
7 | background-color: #f0f0f0; | 7 | background-color: #f0f0f0; |
8 | font-family: bahnschrift; | 8 | font-family: bahnschrift; |
9 | overflow: hidden !important; | ||
9 | } | 10 | } |
10 | 11 | ||
11 | .blur { | 12 | .blur { |
12 | filter: blur(10px); | 13 | filter: blur(10px); |
13 | -webkit-filter: blur(10px); | 14 | -webkit-filter: blur(10px); |
14 | } | 15 | } |
15 | 16 | ||
16 | .disable-user-select { | 17 | .disable-user-select { |
17 | -webkit-user-select: none; | 18 | -webkit-user-select: none; |
18 | -moz-user-select: none; | 19 | -moz-user-select: none; |
19 | -ms-user-select: none; | 20 | -ms-user-select: none; |
20 | user-select: none; | 21 | user-select: none; |
21 | } | 22 | } |
22 | 23 | ||
23 | .blue-gradient { | 24 | .blue-gradient { |
24 | background: linear-gradient(0deg, #ffffff00, $white); | 25 | background: linear-gradient(0deg, #ffffff00, $white); |
25 | } | 26 | } |
26 | 27 | ||
27 | .rounded { | 28 | .rounded { |
28 | border-radius: 1.5rem !important; | 29 | border-radius: 1.5rem !important; |
29 | } | 30 | } |
30 | 31 | ||
31 | .rounded-top-sm { | 32 | .rounded-top-sm { |
32 | border-top-left-radius: 0.75rem !important; | 33 | border-top-left-radius: 0.75rem !important; |
33 | border-top-right-radius: 0.75rem !important; | 34 | border-top-right-radius: 0.75rem !important; |
34 | } | 35 | } |
35 | 36 | ||
36 | .rounded-sm { | 37 | .rounded-sm { |
37 | border-radius: 0.75rem !important; | 38 | border-radius: 0.75rem !important; |
38 | } | 39 | } |
39 | 40 | ||
40 | .card-effect { | 41 | .card-effect { |
41 | &:active { | 42 | &:active { |
42 | background-color: #c9c9c9b3 !important; | 43 | background-color: #c9c9c9b3 !important; |
43 | transition: background-color 0.5s; | 44 | transition: background-color 0.5s; |
44 | } | 45 | } |
45 | &:focus { | 46 | &:focus { |
46 | background-color: #c9c9c9b3 !important; | 47 | background-color: #c9c9c9b3 !important; |
47 | transition: background-color 0.5s; | 48 | transition: background-color 0.5s; |
48 | } | 49 | } |
49 | } | 50 | } |
50 | 51 | ||
51 | .overflow-scroll { | 52 | .overflow-scroll { |
52 | overflow-y: auto !important; | 53 | overflow-y: auto !important; |
53 | overflow-x: hidden !important; | 54 | overflow-x: hidden !important; |
54 | &::-webkit-scrollbar { | 55 | &::-webkit-scrollbar { |
55 | width: 1em; | 56 | width: 1em; |
56 | } | 57 | } |
57 | &::-webkit-scrollbar-track { | 58 | &::-webkit-scrollbar-track { |
58 | border-radius: 10px; | 59 | border-radius: 10px; |
59 | box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.4); | 60 | box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.4); |
60 | -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.4); | 61 | -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.4); |
61 | background-color: $white; | 62 | background-color: $white; |
62 | } | 63 | } |
63 | &::-webkit-scrollbar-thumb { | 64 | &::-webkit-scrollbar-thumb { |
64 | box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.7); | 65 | box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.7); |
65 | -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.7); | 66 | -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.7); |
66 | outline: 1px solid slategrey; | 67 | outline: 1px solid slategrey; |
67 | border-radius: 10px; | 68 | border-radius: 10px; |
68 | height: 12px; | 69 | height: 12px; |
69 | &:active { | 70 | &:active { |
70 | box-shadow: inset 0 0 8px $primary; | 71 | box-shadow: inset 0 0 8px $primary; |
71 | -webkit-box-shadow: inset 0 0 8px $primary; | 72 | -webkit-box-shadow: inset 0 0 8px $primary; |
72 | } | 73 | } |
73 | } | 74 | } |
74 | &::-webkit-scrollbar-corner { | 75 | &::-webkit-scrollbar-corner { |
75 | border-radius: 10px; | 76 | border-radius: 10px; |
76 | } | 77 | } |
77 | } | 78 | } |
78 | 79 | ||
79 | .bg-gray { | 80 | .bg-gray { |
80 | background-color: #e6e6e6; | 81 | background-color: #e6e6e6; |
81 | } | 82 | } |
82 | 83 | ||
83 | .bg-primary-gradient { | 84 | .bg-primary-gradient { |
84 | background: linear-gradient(135deg, rgba(40, 112, 175, 1) 0%, rgba(0, 32, 66, 1) 100%); | 85 | background: linear-gradient(135deg, rgba(40, 112, 175, 1) 0%, rgba(0, 32, 66, 1) 100%); |
85 | } | 86 | } |
86 | 87 | ||
87 | .bg-primary-gradient-horizontal { | 88 | .bg-primary-gradient-horizontal { |
88 | background: linear-gradient(90deg, rgba(40, 112, 175, 1) 0%, rgba(0, 32, 66, 1) 100%); | 89 | background: linear-gradient(90deg, rgba(40, 112, 175, 1) 0%, rgba(0, 32, 66, 1) 100%); |
89 | } | 90 | } |
90 | 91 | ||
91 | .icon-dim { | 92 | .icon-dim { |
92 | height: 40px !important; | 93 | height: 40px !important; |
93 | width: auto !important; | 94 | width: auto !important; |
94 | background-color: white !important; | 95 | background-color: white !important; |
95 | } | 96 | } |
96 | 97 | ||
97 | .text-purple { | 98 | .text-purple { |
98 | color: $purple; | 99 | color: $purple; |
99 | } | 100 | } |
100 | 101 | ||
101 | .vh-70 { | 102 | .vh-70 { |
102 | min-height: auto !important; | 103 | min-height: auto !important; |
103 | max-height: 70vh !important; | 104 | max-height: 70vh !important; |
104 | } | 105 | } |
105 | 106 | ||
106 | .vh-60 { | 107 | .vh-60 { |
107 | min-height: auto !important; | 108 | min-height: auto !important; |
108 | max-height: 60vh !important; | 109 | max-height: 60vh !important; |
109 | } | 110 | } |
110 | 111 | ||
111 | .spinner-lg { | 112 | .spinner-lg { |
112 | width: 3rem !important; | 113 | width: 3rem !important; |
113 | height: 3rem !important; | 114 | height: 3rem !important; |
114 | } | 115 | } |
115 | 116 | ||
116 | .sidebar { | 117 | .sidebar { |
117 | right: 0; | 118 | right: 0; |
118 | } | 119 | } |
119 | 120 | ||
120 | .background-image { | 121 | .background-image { |
121 | background-repeat: no-repeat; | 122 | background-repeat: no-repeat; |
122 | background-size: cover; | 123 | background-size: cover; |
123 | position: fixed; | 124 | position: fixed; |
124 | } | 125 | } |
125 | 126 | ||
126 | .rounded-bottom-right { | 127 | .rounded-bottom-right { |
127 | border-bottom-right-radius: 10rem; | 128 | border-bottom-right-radius: 10rem; |
128 | &:before { | 129 | &:before { |
129 | border-radius: 0 40px 40px 0; | 130 | border-radius: 0 40px 40px 0; |
130 | background-color: #fff; | 131 | background-color: #fff; |
131 | } | 132 | } |
132 | } | 133 | } |
133 | 134 | ||
134 | .rounded-top-left { | 135 | .rounded-top-left { |
135 | border-top-left-radius: 10rem; | 136 | border-top-left-radius: 10rem; |
136 | } | 137 | } |
137 | 138 | ||
138 | .bg-gray { | 139 | .bg-gray { |
139 | background-color: #cccccc; | 140 | background-color: #cccccc; |
140 | } | 141 | } |
141 | 142 |