Commit d302da0ddfe10dd10b6bfc05b6b0e61475987e42

Authored by Eric Fernandez
Exists in master

Merge branch 'master' into 'master'

Master(mpuebla)

See merge request !12
src/app/app.module.ts
1 //#region MODULES 1 //#region MODULES
2 import { BrowserModule } from '@angular/platform-browser'; 2 import { BrowserModule } from '@angular/platform-browser';
3 import { NgModule } from '@angular/core'; 3 import { NgModule } from '@angular/core';
4 import { AppRoutingModule } from './app-routing.module'; 4 import { AppRoutingModule } from './app-routing.module';
5 import { HttpClientModule } from '@angular/common/http'; 5 import { HttpClientModule } from '@angular/common/http';
6 import { FormsModule, ReactiveFormsModule } from '@angular/forms';
6 //#endregion 7 //#endregion
7 8
8 //#region COMPONENTS 9 //#region COMPONENTS
9 import { AppComponent } from './app.component'; 10 import { AppComponent } from './app.component';
10 import { HeaderComponent } from './components/header/header.component'; 11 import { HeaderComponent } from './components/header/header.component';
11 import { SidebarComponent } from './components/sidebar/sidebar.component'; 12 import { SidebarComponent } from './components/sidebar/sidebar.component';
12 import { CarouselComponent } from './components/carousel/carousel.component'; 13 import { CarouselComponent } from './components/carousel/carousel.component';
13 import { HomeComponent } from './components/home/home.component'; 14 import { HomeComponent } from './components/home/home.component';
14 import { InicioComponent } from './components/inicio/inicio.component'; 15 import { InicioComponent } from './components/inicio/inicio.component';
15 import { BusquedaProductosComponent } from './components/busqueda-productos/busqueda-productos.component'; 16 import { BusquedaProductosComponent } from './components/busqueda-productos/busqueda-productos.component';
16 import { ConfirmacionCarritoComponent } from './components/confirmacion-carrito/confirmacion-carrito.component'; 17 import { ConfirmacionCarritoComponent } from './components/confirmacion-carrito/confirmacion-carrito.component';
17 //#endregion 18 //#endregion
18 19
19 @NgModule({ 20 @NgModule({
20 declarations: [ 21 declarations: [
21 AppComponent, 22 AppComponent,
22 HeaderComponent, 23 HeaderComponent,
23 SidebarComponent, 24 SidebarComponent,
24 CarouselComponent, 25 CarouselComponent,
25 HomeComponent, 26 HomeComponent,
26 InicioComponent, 27 InicioComponent,
27 BusquedaProductosComponent, 28 BusquedaProductosComponent,
28 ConfirmacionCarritoComponent 29 ConfirmacionCarritoComponent
29 ], 30 ],
30 imports: [ 31 imports: [
31 BrowserModule, 32 BrowserModule,
32 AppRoutingModule, 33 AppRoutingModule,
33 HttpClientModule 34 HttpClientModule,
35 FormsModule,
36 ReactiveFormsModule,
37 ReactiveFormsModule.withConfig({ warnOnNgModelWithFormControl: 'never' })
34 ], 38 ],
35 providers: [], 39 providers: [],
36 bootstrap: [AppComponent] 40 bootstrap: [AppComponent]
37 }) 41 })
38 export class AppModule { } 42 export class AppModule { }
39 43
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-10 p-0"> 2 <div class="col-10 p-0">
3 <!-- TOP HEADER --> 3 <!-- TOP HEADER -->
4 <app-header></app-header> 4 <app-header></app-header>
5 5
6 <!-- NOMBRE DE SECCION --> 6 <!-- NOMBRE DE SECCION -->
7 <div class="row m-0"> 7 <div class="row m-0">
8 <div class="col-12 p-0"> 8 <div class="col-12 p-0">
9 <p class="h5 py-1 bg-light text-muted text-center"> 9 <p class="h5 py-1 bg-light text-muted text-center">
10 Búsqueda 10 Búsqueda
11 <i class="fa fa-search"></i> 11 <i class="fa fa-search"></i>
12 </p> 12 </p>
13 </div> 13 </div>
14 </div> 14 </div>
15 15
16 <div class="row m-4 disable-user-select"> 16 <div class="row m-4 disable-user-select">
17 17
18 <!-- FILTROS --> 18 <!-- FILTROS -->
19 <div class="col-sm-2"> 19 <div class="col-sm-2">
20 <div class="text-center"> 20 <div class="text-center">
21 <p class="font-weight-bold text-muted border-bottom pb-2">Buscar por Categoría</p> 21 <p class="font-weight-bold text-muted border-bottom pb-2">Buscar por Categoría</p>
22 </div> 22 </div>
23 <ul class="list-group"> 23 <ul class="list-group">
24 <li class="list-group-item list-group-item-action my-1 py-2 h6"> 24 <li class="list-group-item list-group-item-action my-1 py-2 h6">
25 Combos y Promociones 25 Combos y Promociones
26 </li> 26 </li>
27 <li 27 <li
28 class="list-group-item list-group-item-action my-1 p-2 h6 shadow-sm font-weight-bold"> 28 class="list-group-item list-group-item-action my-1 p-2 h6 shadow-sm font-weight-bold">
29 Todos 29 Todos
30 </li> 30 </li>
31 <li 31 <li
32 class="list-group-item list-group-item-action my-1 p-2 h6 shadow-sm"> 32 class="list-group-item list-group-item-action my-1 p-2 h6 shadow-sm">
33 Bebidas 33 Bebidas
34 </li> 34 </li>
35 <li 35 <li
36 class="list-group-item list-group-item-action my-1 p-2 h6 shadow-sm"> 36 class="list-group-item list-group-item-action my-1 p-2 h6 shadow-sm">
37 Sandwichería 37 Sandwichería
38 </li> 38 </li>
39 <li 39 <li
40 class="list-group-item list-group-item-action my-1 p-2 h6 shadow-sm"> 40 class="list-group-item list-group-item-action my-1 p-2 h6 shadow-sm">
41 Panaderia 41 Panaderia
42 </li> 42 </li>
43 <li 43 <li
44 class="list-group-item list-group-item-action my-1 p-2 h6 shadow-sm"> 44 class="list-group-item list-group-item-action my-1 p-2 h6 shadow-sm">
45 Golosinas 45 Golosinas
46 </li> 46 </li>
47 <li 47 <li
48 class="list-group-item list-group-item-action my-1 p-2 h6 shadow-sm"> 48 class="list-group-item list-group-item-action my-1 p-2 h6 shadow-sm">
49 Tabaqueria 49 Tabaqueria
50 </li> 50 </li>
51 </ul> 51 </ul>
52 </div> 52 </div>
53 53
54 <!-- SEARCH INPUT --> 54 <!-- SEARCH INPUT -->
55 <div class="col-sm-10"> 55 <div class="col-sm-10">
56 56
57 <div class="form-group row search"> 57 <div class="form-group row search">
58 <div class="col-sm-10"> 58 <div class="col-sm-10">
59 <span class="fa fa-search form-control-lg form-control-search pl-3"></span> 59 <span class="fa fa-search form-control-lg form-control-search pl-3"></span>
60 <input 60 <input
61 type="text" 61 type="text"
62 class="form-control form-control-lg shadow-sm rounded-pill px-5" 62 class="form-control form-control-lg shadow-sm rounded-pill px-5"
63 placeholder="Búsqueda productos"> 63 placeholder="Búsqueda productos"
64 [(ngModel)]="searchTerm"
65 (ngModelChange)="filterItems()">
64 </div> 66 </div>
65 <!-- BOTON VOLVER --> 67 <!-- BOTON VOLVER -->
66 <div class="col-sm-2"> 68 <div class="col-sm-2">
67 <button 69 <button
68 type="button" 70 type="button"
69 class="btn btn-light btn-lg shadow-sm" 71 class="btn btn-light btn-lg shadow-sm"
70 [routerLink]="['/inicio']"> 72 [routerLink]="['/inicio']">
71 <span class="font-weight-normal h6">Volver&nbsp;&nbsp;</span> 73 <span class="font-weight-normal h6">Volver&nbsp;&nbsp;</span>
72 <i class="fa fa-undo text-warning" aria-hidden="true"></i> 74 <i class="fa fa-undo text-warning" aria-hidden="true"></i>
73 </button> 75 </button>
74 </div> 76 </div>
75 </div> 77 </div>
76 78
77 <!-- LISTA DE PRODUCTOS --> 79 <!-- LISTA DE PRODUCTOS -->
78 <div class="row pr-3 vh-50 overflow-scroll disable-user-select"> 80 <div class="row align-items-start vh-70 overflow-scroll disable-user-select">
79 <div 81 <div
80 class="col-4 p-2" 82 class="col-4 p-2"
81 *ngFor="let producto of productos"> 83 *ngFor="let producto of auxProductos">
82 <div class="card card-effect bg-white rounded-sm shadow border-0"> 84 <div class="card card-effect bg-white rounded-sm shadow border-0">
83 <img src="../../../assets/img/descarga.jpg" class="card-img-top w-75 m-auto"> 85 <img src="../../../assets/img/descarga.jpg" class="card-img-top w-75 m-auto">
84 <div class="card-body p-2"> 86 <div class="card-body p-2">
85 <p class="h6 text-left m-0">{{producto.DetArt}}</p> 87 <p class="h6 text-left m-0">{{producto.DetArt}}</p>
86 <div class="row justify-content-between m-0"> 88 <div class="row justify-content-between m-0">
87 <div class="col-12 p-0"> 89 <div class="col-12 p-0">
88 <div class="text-left"> 90 <div class="text-left">
89 <p class="m-0 h6"><small>{{producto.DetArt}}</small></p> 91 <p class="m-0 h6"><small>{{producto.DetArt}}</small></p>
90 <p class="m-0 h6"><small>COD. {{producto.CodRub}}</small></p> 92 <p class="m-0 h6"><small>COD. {{producto.CodRub}}</small></p>
91 </div> 93 </div>
92 </div> 94 </div>
93 <div class="col-12 my-auto pt-2 pr-2 p-0"> 95 <div class="col-12 my-auto pt-2 pr-2 p-0">
94 <p class="text-right m-0 h6">{{producto.PreVen | currency}}</p> 96 <p class="text-right m-0 h6">{{producto.PreVen | currency}}</p>
95 </div> 97 </div>
96 </div> 98 </div>
97 </div> 99 </div>
98 </div> 100 </div>
99 </div> 101 </div>
100 </div> 102 </div>
101 </div> 103 </div>
102 104
103 </div> 105 </div>
104 106
105 </div> 107 </div>
106 108
107 <!-- SIDEBAR --> 109 <!-- SIDEBAR -->
108 <app-sidebar class="col-3 col-md-2 vh-100 bg-dark text-white"></app-sidebar> 110 <app-sidebar class="col-3 col-md-2 vh-100 bg-dark text-white"></app-sidebar>
109 </div> 111 </div>
110 112
src/app/components/busqueda-productos/busqueda-productos.component.scss
1 .search .form-control-search { 1 .search .form-control-search {
2 position: absolute; 2 position: absolute;
3 z-index: 2; 3 z-index: 2;
4 display: block; 4 display: block;
5 text-align: center; 5 text-align: center;
6 pointer-events: none; 6 pointer-events: none;
7 color: #aaa; 7 color: #aaa;
8 line-height: inherit; 8 line-height: inherit;
9 } 9 }
10 10
11 .vh-50 { 11 .vh-70 {
12 height: 70vh !important; 12 min-height: auto !important;
13 max-height: 70vh !important;
13 } 14 }
14 15
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 4
5 @Component({ 5 @Component({
6 selector: 'app-busqueda-productos', 6 selector: 'app-busqueda-productos',
7 templateUrl: './busqueda-productos.component.html', 7 templateUrl: './busqueda-productos.component.html',
8 styleUrls: ['./busqueda-productos.component.scss'] 8 styleUrls: ['./busqueda-productos.component.scss']
9 }) 9 })
10 export class BusquedaProductosComponent implements OnInit { 10 export class BusquedaProductosComponent implements OnInit {
11 11
12 productos: Producto[] = []; 12 productos: Producto[] = [];
13 auxProductos: Producto[] = [];
14 searchTerm: string = '';
13 15
14 constructor(private productoService: ProductoService) { } 16 constructor(private productoService: ProductoService) { }
15 17
16 ngOnInit() { 18 ngOnInit() {
17 19
18 this.productoService.getAll() 20 this.productoService.getAll()
19 .subscribe((data: Producto[]) => { 21 .subscribe((data: Producto[]) => {
20 22
21 this.productos = data; 23 this.auxProductos = this.productos = data;
22 }, (error) => { 24 }, (error) => {
23 25
24 console.error(error); 26 console.error(error);
25 }); 27 });
26 } 28 }
27 29
30 filterItems() {
31 console.log('');
32 this.auxProductos = this.productos.filter(x => x.DetArt.toLowerCase().includes(this.searchTerm.toLowerCase()));
33 }
34
28 } 35 }
29 36
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 3
4 html, 4 html,
5 body { 5 body {
6 background-color: rgb(245, 245, 245); 6 background-color: rgb(245, 245, 245);
7 overflow: hidden; 7 overflow: hidden;
8 } 8 }
9 9
10 .blur { 10 .blur {
11 filter: blur(10px); 11 filter: blur(10px);
12 -webkit-filter: blur(10px); 12 -webkit-filter: blur(10px);
13 } 13 }
14 14
15 .disable-user-select { 15 .disable-user-select {
16 -webkit-user-select: none; 16 -webkit-user-select: none;
17 -moz-user-select: none; 17 -moz-user-select: none;
18 -ms-user-select: none; 18 -ms-user-select: none;
19 user-select: none; 19 user-select: none;
20 } 20 }
21 21
22 .blue-gradient { 22 .blue-gradient {
23 background: linear-gradient(0deg, rgb(20, 56, 68), rgb(252, 252, 252)); 23 background: linear-gradient(0deg, rgb(20, 56, 68), rgb(252, 252, 252));
24 } 24 }
25 25
26 .rounded { 26 .rounded {
27 border-radius: 1.5rem !important; 27 border-radius: 1.5rem !important;
28 } 28 }
29 29
30 .rounded-sm { 30 .rounded-sm {
31 border-radius: 0.75rem !important; 31 border-radius: 0.75rem !important;
32 } 32 }
33 33
34 .card-effect { 34 .card-effect {
35 &:active, 35 &:active,
36 img { 36 img {
37 background-color: #c9c9c9b3 !important; 37 background-color: #c9c9c9b3 !important;
38 transition: background-color 0.5s; 38 transition: background-color 0.5s;
39 } 39 }
40 &:focus, 40 &:focus,
41 img { 41 img {
42 background-color: #c9c9c9b3 !important; 42 background-color: #c9c9c9b3 !important;
43 transition: background-color 0.5s; 43 transition: background-color 0.5s;
44 } 44 }
45 } 45 }
46 46
47 .overflow-scroll { 47 .overflow-scroll {
48 overflow-y: scroll !important; 48 overflow-y: auto !important;
49 overflow-x: hidden !important; 49 overflow-x: hidden !important;
50 &::-webkit-scrollbar { 50 &::-webkit-scrollbar {
51 width: 0.5em; 51 width: 0.5em;
52 } 52 }
53 &::-webkit-scrollbar-track { 53 &::-webkit-scrollbar-track {
54 border-radius: 10px; 54 border-radius: 10px;
55 -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.4); 55 -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.4);
56 } 56 }
57 &::-webkit-scrollbar-thumb { 57 &::-webkit-scrollbar-thumb {
58 -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.7); 58 -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.7);
59 outline: 1px solid slategrey; 59 outline: 1px solid slategrey;
60 border-radius: 10px; 60 border-radius: 10px;
61 height: 12px; 61 height: 12px;
62 &:active { 62 &:active {
63 -webkit-box-shadow: inset 0 0 8px rgba(255, 0, 0, 0.9); 63 -webkit-box-shadow: inset 0 0 8px rgba(255, 0, 0, 0.9);
64 } 64 }
65 } 65 }
66 &::-webkit-scrollbar-corner { 66 &::-webkit-scrollbar-corner {
67 border-radius: 10px; 67 border-radius: 10px;
68 } 68 }
69 } 69 }
70 70