Commit 344c5a1549e30344e809269849faa0f401cc2f4d
Exists in
master
and in
1 other branch
Merge branch 'master' into 'master'
Master(efernandez) See merge request !23
Showing
10 changed files
Show diff stats
src/app/app-routing.module.ts
1 | import { NgModule } from '@angular/core'; | 1 | import { NgModule } from '@angular/core'; |
2 | import { Routes, RouterModule } from '@angular/router'; | 2 | import { Routes, RouterModule } from '@angular/router'; |
3 | import { HomeComponent } from './components/home/home.component'; | 3 | import { HomeComponent } from './components/home/home.component'; |
4 | import { InicioComponent } from './components/inicio/inicio.component'; | 4 | import { InicioComponent } from './components/inicio/inicio.component'; |
5 | import { BusquedaProductosComponent } from './components/busqueda-productos/busqueda-productos.component'; | 5 | import { BusquedaProductosComponent } from './components/busqueda-productos/busqueda-productos.component'; |
6 | import { ConfirmacionCarritoComponent } from './components/confirmacion-carrito/confirmacion-carrito.component'; | 6 | import { ConfirmacionCarritoComponent } from './components/confirmacion-carrito/confirmacion-carrito.component'; |
7 | import { MasterComponent } from './components/master/master.component'; | 7 | import { MasterComponent } from './components/master/master.component'; |
8 | import { AmbImagenesComponent } from './components/amb-imagenes/amb-imagenes.component'; | ||
8 | 9 | ||
9 | const routes: Routes = [ | 10 | const routes: Routes = [ |
10 | { path: '', component: HomeComponent }, | 11 | { path: '', component: HomeComponent }, |
11 | { path: 'home', component: HomeComponent }, | 12 | { path: 'home', component: HomeComponent }, |
13 | { path: 'abm-imagenes', component: AmbImagenesComponent }, | ||
12 | { | 14 | { |
13 | path: '', | 15 | path: '', |
14 | component: MasterComponent, | 16 | component: MasterComponent, |
15 | children: [ | 17 | children: [ |
16 | { path: 'inicio', component: InicioComponent }, | 18 | { path: 'inicio', component: InicioComponent }, |
17 | { path: 'busqueda-productos', component: BusquedaProductosComponent }, | 19 | { path: 'busqueda-productos', component: BusquedaProductosComponent }, |
18 | { path: 'confirmacion-carrito', component: ConfirmacionCarritoComponent }, | 20 | { path: 'confirmacion-carrito', component: ConfirmacionCarritoComponent } |
19 | ] | 21 | ] |
20 | }, | 22 | }, |
21 | { path: '**', redirectTo: '/home', pathMatch: 'full' }, | 23 | { path: '**', redirectTo: '/home', pathMatch: 'full' }, |
22 | ]; | 24 | ]; |
23 | 25 | ||
24 | @NgModule({ | 26 | @NgModule({ |
25 | imports: [RouterModule.forRoot(routes)], | 27 | imports: [RouterModule.forRoot(routes)], |
26 | exports: [RouterModule] | 28 | exports: [RouterModule] |
27 | }) | 29 | }) |
28 | 30 | ||
29 | export class AppRoutingModule { } | 31 | export class AppRoutingModule { } |
30 | 32 |
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 | import { FormsModule, ReactiveFormsModule } from '@angular/forms'; |
7 | import { TooltipModule } from 'ngx-bootstrap/tooltip'; | 7 | import { TooltipModule } from 'ngx-bootstrap/tooltip'; |
8 | import { PopoverModule } from 'ngx-bootstrap/popover'; | 8 | import { PopoverModule } from 'ngx-bootstrap/popover'; |
9 | //#endregion | 9 | //#endregion |
10 | 10 | ||
11 | //#region COMPONENTS | 11 | //#region COMPONENTS |
12 | import { AppComponent } from './app.component'; | 12 | import { AppComponent } from './app.component'; |
13 | import { HeaderComponent } from './components/header/header.component'; | 13 | import { HeaderComponent } from './components/header/header.component'; |
14 | import { SidebarComponent } from './components/sidebar/sidebar.component'; | 14 | import { SidebarComponent } from './components/sidebar/sidebar.component'; |
15 | import { CarouselComponent } from './components/carousel/carousel.component'; | 15 | import { CarouselComponent } from './components/carousel/carousel.component'; |
16 | import { HomeComponent } from './components/home/home.component'; | 16 | import { HomeComponent } from './components/home/home.component'; |
17 | import { InicioComponent } from './components/inicio/inicio.component'; | 17 | import { InicioComponent } from './components/inicio/inicio.component'; |
18 | import { BusquedaProductosComponent } from './components/busqueda-productos/busqueda-productos.component'; | 18 | import { BusquedaProductosComponent } from './components/busqueda-productos/busqueda-productos.component'; |
19 | import { ConfirmacionCarritoComponent } from './components/confirmacion-carrito/confirmacion-carrito.component'; | 19 | import { ConfirmacionCarritoComponent } from './components/confirmacion-carrito/confirmacion-carrito.component'; |
20 | import { MasterComponent } from './components/master/master.component'; | 20 | import { MasterComponent } from './components/master/master.component'; |
21 | import { PopoverComponent } from './components/popover/popover.component'; | 21 | import { PopoverComponent } from './components/popover/popover.component'; |
22 | import { AmbImagenesComponent } from './components/amb-imagenes/amb-imagenes.component'; | ||
22 | //#endregion | 23 | //#endregion |
23 | 24 | ||
24 | @NgModule({ | 25 | @NgModule({ |
25 | declarations: [ | 26 | declarations: [ |
26 | AppComponent, | 27 | AppComponent, |
27 | HeaderComponent, | 28 | HeaderComponent, |
28 | SidebarComponent, | 29 | SidebarComponent, |
29 | CarouselComponent, | 30 | CarouselComponent, |
30 | HomeComponent, | 31 | HomeComponent, |
31 | InicioComponent, | 32 | InicioComponent, |
32 | BusquedaProductosComponent, | 33 | BusquedaProductosComponent, |
33 | ConfirmacionCarritoComponent, | 34 | ConfirmacionCarritoComponent, |
34 | MasterComponent, | 35 | MasterComponent, |
35 | PopoverComponent | 36 | PopoverComponent, |
37 | AmbImagenesComponent | ||
36 | ], | 38 | ], |
37 | imports: [ | 39 | imports: [ |
38 | BrowserModule, | 40 | BrowserModule, |
39 | AppRoutingModule, | 41 | AppRoutingModule, |
40 | HttpClientModule, | 42 | HttpClientModule, |
41 | FormsModule, | 43 | FormsModule, |
42 | ReactiveFormsModule, | 44 | ReactiveFormsModule, |
43 | ReactiveFormsModule.withConfig({ warnOnNgModelWithFormControl: 'never' }), | 45 | ReactiveFormsModule.withConfig({ warnOnNgModelWithFormControl: 'never' }), |
44 | TooltipModule.forRoot(), | 46 | TooltipModule.forRoot(), |
45 | PopoverModule.forRoot() | 47 | PopoverModule.forRoot() |
46 | ], | 48 | ], |
47 | providers: [], | 49 | providers: [], |
48 | bootstrap: [AppComponent] | 50 | bootstrap: [AppComponent] |
49 | }) | 51 | }) |
50 | export class AppModule { } | 52 | export class AppModule { } |
51 | 53 |
src/app/components/amb-imagenes/amb-imagenes.component.html
File was created | 1 | <app-header></app-header> | |
2 | |||
3 | <h1>Configuración imágenes</h1> | ||
4 | <br> | ||
5 | <span class="fa fa-search form-control-lg form-control-search pl-3"></span> | ||
6 | <input | ||
7 | type="text" | ||
8 | class="form-control form-control-lg shadow-sm rounded-pill px-5" | ||
9 | placeholder="Búsqueda productos" | ||
10 | [(ngModel)]="searchTerm" | ||
11 | (ngModelChange)="filterItems()"> | ||
12 | |||
13 | <div class="row px-5"> | ||
14 | <h5>Productos</h5> | ||
15 | <table class="table"> | ||
16 | <thead> | ||
17 | <tr> | ||
18 | <th>Nombre</th> | ||
19 | <th>Descripción</th> | ||
20 | <th>Imagen</th> | ||
21 | <th></th> | ||
22 | </tr> | ||
23 | </thead> | ||
24 | <tbody> | ||
25 | <tr *ngFor="let articulo of auxProductos"> | ||
26 | <td>{{articulo.DetArt}}</td> | ||
27 | <td>{{articulo.DET_LAR}}</td> | ||
28 | <td> | ||
29 | <img *ngIf="articulo.imagenes.length" src="{{apiUrl}}/imagenes/{{articulo.imagenes[0].imagen}}"> | ||
30 | <img id="{{articulo.CodSec + articulo.CodArt}}" [hidden]="articulo.imagenes.length"> | ||
31 | </td> | ||
32 | <td><input type="file" accept="image/*" (change)="onFileSelected($event, articulo)"></td> | ||
33 | </tr> | ||
34 | </tbody> | ||
35 | </table> | ||
36 | </div> | ||
37 |
src/app/components/amb-imagenes/amb-imagenes.component.scss
src/app/components/amb-imagenes/amb-imagenes.component.spec.ts
File was created | 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | |
2 | |||
3 | import { AmbImagenesComponent } from './amb-imagenes.component'; | ||
4 | |||
5 | describe('AmbImagenesComponent', () => { | ||
6 | let component: AmbImagenesComponent; | ||
7 | let fixture: ComponentFixture<AmbImagenesComponent>; | ||
8 | |||
9 | beforeEach(async(() => { | ||
10 | TestBed.configureTestingModule({ | ||
11 | declarations: [ AmbImagenesComponent ] | ||
12 | }) | ||
13 | .compileComponents(); | ||
14 | })); | ||
15 | |||
16 | beforeEach(() => { | ||
17 | fixture = TestBed.createComponent(AmbImagenesComponent); | ||
18 | component = fixture.componentInstance; | ||
19 | fixture.detectChanges(); | ||
20 | }); | ||
21 | |||
22 | it('should create', () => { | ||
23 | expect(component).toBeTruthy(); | ||
24 | }); | ||
25 | }); | ||
26 |
src/app/components/amb-imagenes/amb-imagenes.component.ts
File was created | 1 | import { Component, OnInit } from '@angular/core'; | |
2 | import { appSettings } from 'src/etc/AppSettings'; | ||
3 | import { ProductoService } from 'src/app/services/producto.service'; | ||
4 | import { Producto } from 'src/app/wrappers/producto'; | ||
5 | import { HttpClient } from '@angular/common/http'; | ||
6 | |||
7 | @Component({ | ||
8 | selector: 'app-amb-imagenes', | ||
9 | templateUrl: './amb-imagenes.component.html', | ||
10 | styleUrls: ['./amb-imagenes.component.scss'] | ||
11 | }) | ||
12 | |||
13 | export class AmbImagenesComponent implements OnInit { | ||
14 | |||
15 | apiUrl = appSettings.apiUrl; | ||
16 | articulos: Producto[] = []; | ||
17 | private auxProductos: Producto[] = []; | ||
18 | private searchTerm: string = ''; | ||
19 | |||
20 | constructor(private productoService: ProductoService, private http: HttpClient) {} | ||
21 | |||
22 | ngOnInit() { | ||
23 | |||
24 | this.productoService.getAll().subscribe((productos: Producto[]) => { | ||
25 | this.articulos = productos; | ||
26 | this.filterItems(); | ||
27 | }); | ||
28 | } | ||
29 | |||
30 | onFileSelected(event, articulo) { | ||
31 | |||
32 | let file: File = event.target.files[0]; | ||
33 | |||
34 | this.onLoad(file) | ||
35 | .then(result => { | ||
36 | |||
37 | articulo.imagenes = []; | ||
38 | |||
39 | document.getElementById(articulo.CodSec + articulo.CodArt)['src'] = result; | ||
40 | |||
41 | this.saveInBase({ | ||
42 | name: file.name, | ||
43 | base64: result, | ||
44 | codigo: articulo.CodArt, | ||
45 | sector: articulo.CodSec | ||
46 | }); | ||
47 | }); | ||
48 | } | ||
49 | |||
50 | filterItems() { | ||
51 | |||
52 | this.auxProductos = this.articulos.filter(x => { | ||
53 | return x.DetArt.toLowerCase().includes(this.searchTerm.toLowerCase()) | ||
54 | }); | ||
55 | } | ||
56 | |||
57 | |||
58 | saveInBase(img) { | ||
59 | |||
60 | this.http.post(`${appSettings.apiUrl}/imagenes/guardar`, img) | ||
61 | .subscribe(data => { | ||
62 | console.log(data); | ||
63 | }); | ||
64 | } | ||
65 | |||
66 | onLoad(file) { | ||
67 | |||
68 | return new Promise((resolve, reject) => { | ||
69 | |||
70 | var fr = new FileReader(); | ||
71 | |||
72 | fr.onload = function() { | ||
73 | |||
74 | resolve(fr.result); | ||
75 | }; | ||
76 | |||
77 | fr.readAsDataURL(file); | ||
78 | }); | ||
79 | |||
80 | } | ||
81 | } | ||
82 |
src/app/components/confirmacion-carrito/confirmacion-carrito.component.html
1 | <div class="row"> | 1 | <div class="row"> |
2 | <div class="col-12"> | 2 | <div class="col-12"> |
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">Pago <i class="fa fa-usd"></i></p> | 7 | <p class="h5 py-1 bg-gray text-muted text-center">Pago <i class="fa fa-usd"></i></p> |
8 | </div> | 8 | </div> |
9 | </div> | 9 | </div> |
10 | 10 | ||
11 | <div class="row m-3 d-flex align-items-center"> | 11 | <div class="row m-3 d-flex align-items-center"> |
12 | <div class="col-4"> | 12 | <div class="col-4"> |
13 | <h1>Mi Compra <i class="fa fa-shopping-cart "></i></h1> | 13 | <h1>Mi Compra <i class="fa fa-shopping-cart "></i></h1> |
14 | </div> | 14 | </div> |
15 | <div class="col-8"> | 15 | <div class="col-8"> |
16 | <h2>¿Desea finalizar su compra?</h2> | 16 | <h2>¿Desea finalizar su compra?</h2> |
17 | <h3>Por favor, controle y confirme su compra.</h3> | 17 | <h3>Por favor, controle y confirme su compra.</h3> |
18 | </div> | 18 | </div> |
19 | <div class="col-sm-7"> | 19 | <div class="col-sm-7"> |
20 | 20 | ||
21 | <div class="row pr-3 vh-50 overflow-scroll"> | 21 | <div class="row pr-3 vh-50 overflow-scroll"> |
22 | <div class="col-4 p-2" *ngFor="let producto of productos"> | 22 | <div class="col-4 p-2" *ngFor="let producto of productos"> |
23 | <div class="card card-effect bg-white rounded-sm shadow border-0"> | 23 | <div class="card card-effect bg-white rounded-sm shadow border-0"> |
24 | <img src="{{apiUrl}}/imagenes/{{producto.nombreImagen}}" class="card-img-top w-75 m-auto"> | 24 | <img src="{{apiUrl}}/imagenes/{{producto.imagenes[0].imagen}}" class="card-img-top w-75 m-auto"> |
25 | <div class="card-body"> | 25 | <div class="card-body"> |
26 | <p class="h5 text-left m-0">{{producto.variable}}</p> | 26 | <p class="h5 text-left m-0">{{producto.variable}}</p> |
27 | <div class="text-left"> | 27 | <div class="text-left"> |
28 | <p class="m-0"><small>ASDASDSADASDSA</small></p> | 28 | <p class="m-0"><small>ASDASDSADASDSA</small></p> |
29 | <p class="m-0"><small>COD. 1222</small></p> | 29 | <p class="m-0"><small>COD. 1222</small></p> |
30 | <p class="m-0"><strong>$ 563</strong></p> | 30 | <p class="m-0"><strong>$ 563</strong></p> |
31 | </div> | 31 | </div> |
32 | </div> | 32 | </div> |
33 | </div> | 33 | </div> |
34 | </div> | 34 | </div> |
35 | </div> | 35 | </div> |
36 | </div> | 36 | </div> |
37 | <div class="col-sm-5"> | 37 | <div class="col-sm-5"> |
38 | <h3>TOTAL: $553</h3> | 38 | <h3>TOTAL: $553</h3> |
39 | </div> | 39 | </div> |
40 | </div> | 40 | </div> |
41 | </div> | 41 | </div> |
42 | </div> | 42 | </div> |
43 | 43 |
src/app/components/sidebar/sidebar.component.html
1 | <div class="disable-user-select d-flex align-items-center flex-column h-100 pt-2 text-center"> | 1 | <div class="disable-user-select d-flex align-items-center flex-column h-100 pt-2 text-center"> |
2 | 2 | ||
3 | <p class="h4 border-bottom border-white text-white mt-4 pb-2"> | 3 | <p class="h4 border-bottom border-white text-white mt-4 pb-2"> |
4 | Mi compra | 4 | Mi compra |
5 | <i class="fa fa-shopping-cart" aria-hidden="true"></i> | 5 | <i class="fa fa-shopping-cart" aria-hidden="true"></i> |
6 | </p> | 6 | </p> |
7 | 7 | ||
8 | <div class="overflow-auto overflow-scroll mb-2 w-100"> | 8 | <div class="overflow-auto overflow-scroll mb-2 w-100"> |
9 | <!-- PRODUCTOS CARRITO --> | 9 | <!-- PRODUCTOS CARRITO --> |
10 | <div class="fade-left my-2 bg-white border-0 rounded-sm" *ngFor="let producto of productosCarrito; let i = index"> | 10 | <div class="fade-left my-2 bg-white border-0 rounded-sm" *ngFor="let producto of productosCarrito; let i = index"> |
11 | <img class="m-auto pt-2" src="{{apiUrl}}/imagenes/{{producto.nombreImagen}}"> | 11 | <img class="m-auto pt-2" src="{{apiUrl}}/imagenes/{{producto.imagenes[0].imagen}}"> |
12 | <div class="row m-0 p-0 px-1 py-1 shadow rounded-sm"> | 12 | <div class="row m-0 p-0 px-1 py-1 shadow rounded-sm"> |
13 | <div class="col-12 p-0 pt-2 text-left my-auto"> | 13 | <div class="col-12 p-0 pt-2 text-left my-auto"> |
14 | <p class="m-0 h6"><small>{{producto.DetArt}}</small></p> | 14 | <p class="m-0 h6"><small>{{producto.DetArt}}</small></p> |
15 | <p class="m-0 h6"><small>COD: {{producto.CodRub}}</small></p> | 15 | <p class="m-0 h6"><small>COD: {{producto.CodRub}}</small></p> |
16 | </div> | 16 | </div> |
17 | <div class="col-12 pr-1 text-right h6 my-auto "> | 17 | <div class="col-12 pr-1 text-right h6 my-auto "> |
18 | <p class="m-0">{{producto.PreVen | currency}}</p> | 18 | <p class="m-0">{{producto.PreVen | currency}}</p> |
19 | </div> | 19 | </div> |
20 | </div> | 20 | </div> |
21 | <div class="row m-0 p-0"> | 21 | <div class="row m-0 p-0"> |
22 | <div class="col-6 px-2 my-2"> | 22 | <div class="col-6 px-2 my-2"> |
23 | <div class="btn-group-sm btn-group float-left my-auto" role="group"> | 23 | <div class="btn-group-sm btn-group float-left my-auto" role="group"> |
24 | <button type="button" class="btn btn-light btn-sm my-auto border" (click)="aumentarContador(i)"> | 24 | <button type="button" class="btn btn-light btn-sm my-auto border" (click)="aumentarContador(i)"> |
25 | <i class="fa fa-plus" aria-hidden="true"></i> | 25 | <i class="fa fa-plus" aria-hidden="true"></i> |
26 | </button> | 26 | </button> |
27 | <div class="bg-white border border-white px-3 my-auto text-dark h5"> | 27 | <div class="bg-white border border-white px-3 my-auto text-dark h5"> |
28 | <small>{{producto.cantidad}}</small> | 28 | <small>{{producto.cantidad}}</small> |
29 | </div> | 29 | </div> |
30 | <button type="button" class="btn btn-light btn-sm my-auto border" (click)="decrementarContador(i)"> | 30 | <button type="button" class="btn btn-light btn-sm my-auto border" (click)="decrementarContador(i)"> |
31 | <i class="fa fa-minus" aria-hidden="true"></i> | 31 | <i class="fa fa-minus" aria-hidden="true"></i> |
32 | </button> | 32 | </button> |
33 | </div> | 33 | </div> |
34 | </div> | 34 | </div> |
35 | <div class="col-6 px-2 my-2"> | 35 | <div class="col-6 px-2 my-2"> |
36 | <div class="btn-group-sm btn-group float-right my-auto" role="group"> | 36 | <div class="btn-group-sm btn-group float-right my-auto" role="group"> |
37 | <button type="button" class="btn btn-light btn-sm my-auto float-left border mr-2"> | 37 | <button type="button" class="btn btn-light btn-sm my-auto float-left border mr-2"> |
38 | <i class="fa fa-hand-o-up" aria-hidden="true"></i> | 38 | <i class="fa fa-hand-o-up" aria-hidden="true"></i> |
39 | </button> | 39 | </button> |
40 | <button type="button" class="btn btn-secondary btn-sm my-auto ml-2" (click)="deleteProducto(i)"> | 40 | <button type="button" class="btn btn-secondary btn-sm my-auto ml-2" (click)="deleteProducto(i)"> |
41 | <i class="fa fa-times" aria-hidden="true"></i> | 41 | <i class="fa fa-times" aria-hidden="true"></i> |
42 | </button> | 42 | </button> |
43 | </div> | 43 | </div> |
44 | </div> | 44 | </div> |
45 | </div> | 45 | </div> |
46 | </div> | 46 | </div> |
47 | </div> | 47 | </div> |
48 | 48 | ||
49 | <!-- TOTAL --> | 49 | <!-- TOTAL --> |
50 | <div class="card rounded-top-sm mt-auto blue-gradient border-0"> | 50 | <div class="card rounded-top-sm mt-auto blue-gradient border-0"> |
51 | <div class="card-body row"> | 51 | <div class="card-body row"> |
52 | <div class="col-12"> | 52 | <div class="col-12"> |
53 | <p class="h4 border-bottom border-secondary text-secondary pb-2" *ngIf="cont === 1">({{cont}}) item</p> | 53 | <p class="h4 border-bottom border-secondary text-secondary pb-2" *ngIf="cont === 1">({{cont}}) item</p> |
54 | <p class="h4 border-bottom border-secondary text-secondary pb-2" *ngIf="cont > 1">({{cont}}) items</p> | 54 | <p class="h4 border-bottom border-secondary text-secondary pb-2" *ngIf="cont > 1">({{cont}}) items</p> |
55 | <p class="h3 text-secondary">Total</p> | 55 | <p class="h3 text-secondary">Total</p> |
56 | <p class="h3 font-weight-bold">{{getTotal() | currency}}</p> | 56 | <p class="h3 font-weight-bold">{{getTotal() | currency}}</p> |
57 | </div> | 57 | </div> |
58 | <div class="col-12"> | 58 | <div class="col-12"> |
59 | <button type="button" class="btn btn-block btn-light btn-lg shadow mb-2 p-1" routerLink="/confirmacion-carrito"> | 59 | <button type="button" class="btn btn-block btn-light btn-lg shadow mb-2 p-1" routerLink="/confirmacion-carrito"> |
60 | <span class="font-weight-bold pr-1">Finalizar y Pagar</span> | 60 | <span class="font-weight-bold pr-1">Finalizar y Pagar</span> |
61 | <i class="fa fa-check text-success" aria-hidden="true"></i> | 61 | <i class="fa fa-check text-success" aria-hidden="true"></i> |
62 | </button> | 62 | </button> |
63 | <button type="button" class="btn btn-block btn-light shadow btn-sm shadow" (click)="cleanCarrito()"> | 63 | <button type="button" class="btn btn-block btn-light shadow btn-sm shadow" (click)="cleanCarrito()"> |
64 | <span class="pr-1">Cancelar</span> | 64 | <span class="pr-1">Cancelar</span> |
65 | <i class="fa fa-times text-danger" aria-hidden="true"></i> | 65 | <i class="fa fa-times text-danger" aria-hidden="true"></i> |
66 | </button> | 66 | </button> |
67 | </div> | 67 | </div> |
68 | </div> | 68 | </div> |
69 | </div> | 69 | </div> |
70 | </div> | 70 | </div> |
71 | 71 |
src/app/services/producto.service.ts
1 | import { Injectable } from '@angular/core'; | 1 | import { Injectable } from '@angular/core'; |
2 | import { HttpClient } from '@angular/common/http'; | 2 | import { HttpClient } from '@angular/common/http'; |
3 | import { Observable } from 'rxjs'; | 3 | import { Observable } from 'rxjs'; |
4 | import { appSettings } from 'src/etc/AppSettings'; | 4 | import { appSettings } from 'src/etc/AppSettings'; |
5 | import { Producto } from '../wrappers/producto'; | 5 | import { Producto } from '../wrappers/producto'; |
6 | 6 | ||
7 | @Injectable({ | 7 | @Injectable({ |
8 | providedIn: 'root' | 8 | providedIn: 'root' |
9 | }) | 9 | }) |
10 | export class ProductoService { | 10 | export class ProductoService { |
11 | 11 | ||
12 | productos: Producto[] = []; | 12 | productos: Producto[] = []; |
13 | productoAcargar: Producto; | 13 | productoAcargar: Producto; |
14 | 14 | ||
15 | constructor(private http: HttpClient) { } | 15 | constructor(private http: HttpClient) { } |
16 | 16 | ||
17 | getAll(): Observable<any> { | 17 | getAll(): Observable<any> { |
18 | 18 | ||
19 | return this.http.get(`${appSettings.apiUrl}/articulos`); | 19 | return this.http.get(`${appSettings.apiUrl}/articulos`); |
20 | } | 20 | } |
21 | 21 | ||
22 | setProductos(producto: Producto) { | 22 | setProductos(producto: Producto) { |
23 | 23 | ||
24 | this.productos.push(producto); | 24 | this.productos.push(producto); |
25 | } | 25 | } |
26 | 26 | ||
27 | getPromocion(sector, codigo): Observable<any> { | 27 | getPromocion(sector, codigo): Observable<any> { |
28 | 28 | ||
29 | var url = `${appSettings.apiUrl}/promociones/incluir-articulo/${sector}/${codigo}`; | 29 | var url = `${appSettings.apiUrl}/promociones/incluir-articulo/${sector}/${codigo}`; |
30 | return this.http.get(url); | 30 | return this.http.get(url); |
31 | } | 31 | } |
32 | 32 | ||
33 | updateImages(body): Observable<any> { | ||
34 | return this.http.post(`${appSettings.apiUrl}/imagenes/guardar`, body); | ||
35 | } | ||
36 | |||
33 | } | 37 | } |
34 | 38 |
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 | overflow: hidden; | ||
9 | } | 8 | } |
10 | 9 | ||
11 | .blur { | 10 | .blur { |
12 | filter: blur(10px); | 11 | filter: blur(10px); |
13 | -webkit-filter: blur(10px); | 12 | -webkit-filter: blur(10px); |
14 | } | 13 | } |
15 | 14 | ||
16 | .disable-user-select { | 15 | .disable-user-select { |
17 | -webkit-user-select: none; | 16 | -webkit-user-select: none; |
18 | -moz-user-select: none; | 17 | -moz-user-select: none; |
19 | -ms-user-select: none; | 18 | -ms-user-select: none; |
20 | user-select: none; | 19 | user-select: none; |
21 | } | 20 | } |
22 | 21 | ||
23 | .blue-gradient { | 22 | .blue-gradient { |
24 | background: linear-gradient(0deg, #ffffff00, $white); | 23 | background: linear-gradient(0deg, #ffffff00, $white); |
25 | } | 24 | } |
26 | 25 | ||
27 | .rounded { | 26 | .rounded { |
28 | border-radius: 1.5rem !important; | 27 | border-radius: 1.5rem !important; |
29 | } | 28 | } |
30 | 29 | ||
31 | .rounded-top-sm { | 30 | .rounded-top-sm { |
32 | border-top-left-radius: 0.75rem !important; | 31 | border-top-left-radius: 0.75rem !important; |
33 | border-top-right-radius: 0.75rem !important; | 32 | border-top-right-radius: 0.75rem !important; |
34 | } | 33 | } |
35 | 34 | ||
36 | .rounded-sm { | 35 | .rounded-sm { |
37 | border-radius: 0.75rem !important; | 36 | border-radius: 0.75rem !important; |
38 | } | 37 | } |
39 | 38 | ||
40 | .card-effect { | 39 | .card-effect { |
41 | &:active { | 40 | &:active { |
42 | background-color: #c9c9c9b3 !important; | 41 | background-color: #c9c9c9b3 !important; |
43 | transition: background-color 0.5s; | 42 | transition: background-color 0.5s; |
44 | } | 43 | } |
45 | &:focus { | 44 | &:focus { |
46 | background-color: #c9c9c9b3 !important; | 45 | background-color: #c9c9c9b3 !important; |
47 | transition: background-color 0.5s; | 46 | transition: background-color 0.5s; |
48 | } | 47 | } |
49 | } | 48 | } |
50 | 49 | ||
51 | .overflow-scroll { | 50 | .overflow-scroll { |
52 | overflow-y: auto !important; | 51 | overflow-y: auto !important; |
53 | overflow-x: hidden !important; | 52 | overflow-x: hidden !important; |
54 | &::-webkit-scrollbar { | 53 | &::-webkit-scrollbar { |
55 | width: 0.5em; | 54 | width: 0.5em; |
56 | } | 55 | } |
57 | &::-webkit-scrollbar-track { | 56 | &::-webkit-scrollbar-track { |
58 | border-radius: 10px; | 57 | border-radius: 10px; |
59 | box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.4); | 58 | 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); | 59 | -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.4); |
61 | background-color: $white; | 60 | background-color: $white; |
62 | } | 61 | } |
63 | &::-webkit-scrollbar-thumb { | 62 | &::-webkit-scrollbar-thumb { |
64 | box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.7); | 63 | 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); | 64 | -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.7); |
66 | outline: 1px solid slategrey; | 65 | outline: 1px solid slategrey; |
67 | border-radius: 10px; | 66 | border-radius: 10px; |
68 | height: 12px; | 67 | height: 12px; |
69 | &:active { | 68 | &:active { |
70 | box-shadow: inset 0 0 8px rgba(255, 0, 0, 0.9); | 69 | box-shadow: inset 0 0 8px rgba(255, 0, 0, 0.9); |
71 | -webkit-box-shadow: inset 0 0 8px rgba(255, 0, 0, 0.9); | 70 | -webkit-box-shadow: inset 0 0 8px rgba(255, 0, 0, 0.9); |
72 | } | 71 | } |
73 | } | 72 | } |
74 | &::-webkit-scrollbar-corner { | 73 | &::-webkit-scrollbar-corner { |
75 | border-radius: 10px; | 74 | border-radius: 10px; |
76 | } | 75 | } |
77 | } | 76 | } |
78 | 77 | ||
79 | .bg-gray { | 78 | .bg-gray { |
80 | background-color: #e6e6e6; | 79 | background-color: #e6e6e6; |
81 | } | 80 | } |
82 | 81 | ||
83 | .bg-primary-gradient { | 82 | .bg-primary-gradient { |
84 | background: linear-gradient(135deg, rgba(40, 112, 175, 1) 0%, rgba(0, 32, 66, 1) 100%); | 83 | background: linear-gradient(135deg, rgba(40, 112, 175, 1) 0%, rgba(0, 32, 66, 1) 100%); |
85 | } | 84 | } |
86 | 85 | ||
87 | .icon-dim { | 86 | .icon-dim { |
88 | height: 40px !important; | 87 | height: 40px !important; |
89 | width: auto !important; | 88 | width: auto !important; |
90 | background-color: white !important; | 89 | background-color: white !important; |
91 | } | 90 | } |
92 | 91 | ||
93 | .text-purple { | 92 | .text-purple { |
94 | color: $purple; | 93 | color: $purple; |
95 | } | 94 | } |
96 | 95 | ||
97 | .vh-70 { | 96 | .vh-70 { |
98 | min-height: auto !important; | 97 | min-height: auto !important; |
99 | max-height: 70vh !important; | 98 | max-height: 70vh !important; |
100 | } | 99 | } |
101 | 100 | ||
102 | .vh-60 { | 101 | .vh-60 { |
103 | min-height: auto !important; | 102 | min-height: auto !important; |
104 | max-height: 60vh !important; | 103 | max-height: 60vh !important; |
105 | } | 104 | } |
106 | 105 | ||
107 | .spinner-lg { | 106 | .spinner-lg { |
108 | width: 3rem !important; | 107 | width: 3rem !important; |
109 | height: 3rem !important; | 108 | height: 3rem !important; |
110 | } | 109 | } |
111 | 110 | ||
112 | .sidebar { | 111 | .sidebar { |
113 | right: 0; | 112 | right: 0; |
114 | } | 113 | } |
115 | 114 |