Commit 6ff8cc8cab822f06a19aee9f002791d19e9857ee
Exists in
master
and in
1 other branch
Merge branch 'master' of git.focasoftware.com:angular/autoservicio
# Conflicts: # src/app/app.module.ts # src/app/services/producto.service.ts # src/styles.scss
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 { PopoverPromosComponent } from './components/popover-promos/popover-promos.component'; | 21 | import { PopoverPromosComponent } from './components/popover-promos/popover-promos.component'; |
| 22 | import { PopoverSinonimosComponent } from './components/popover-sinonimos/popover-sinonimos.component'; | ||
| 22 | import { PopoverSinonimosComponent } from './components/popover-sinonimos/popover-sinonimos.component'; | 23 | import { AmbImagenesComponent } from './components/amb-imagenes/amb-imagenes.component'; |
| 23 | //#endregion | 24 | //#endregion |
| 24 | 25 | ||
| 25 | @NgModule({ | 26 | @NgModule({ |
| 26 | declarations: [ | 27 | declarations: [ |
| 27 | AppComponent, | 28 | AppComponent, |
| 28 | HeaderComponent, | 29 | HeaderComponent, |
| 29 | SidebarComponent, | 30 | SidebarComponent, |
| 30 | CarouselComponent, | 31 | CarouselComponent, |
| 31 | HomeComponent, | 32 | HomeComponent, |
| 32 | InicioComponent, | 33 | InicioComponent, |
| 33 | BusquedaProductosComponent, | 34 | BusquedaProductosComponent, |
| 34 | ConfirmacionCarritoComponent, | 35 | ConfirmacionCarritoComponent, |
| 35 | MasterComponent, | 36 | MasterComponent, |
| 37 | PopoverPromosComponent, | ||
| 36 | PopoverPromosComponent, | 38 | PopoverSinonimosComponent, |
| 37 | PopoverSinonimosComponent | 39 | AmbImagenesComponent |
| 38 | ], | 40 | ], |
| 39 | imports: [ | 41 | imports: [ |
| 40 | BrowserModule, | 42 | BrowserModule, |
| 41 | AppRoutingModule, | 43 | AppRoutingModule, |
| 42 | HttpClientModule, | 44 | HttpClientModule, |
| 43 | FormsModule, | 45 | FormsModule, |
| 44 | ReactiveFormsModule, | 46 | ReactiveFormsModule, |
| 45 | ReactiveFormsModule.withConfig({ warnOnNgModelWithFormControl: 'never' }), | 47 | ReactiveFormsModule.withConfig({ warnOnNgModelWithFormControl: 'never' }), |
| 46 | TooltipModule.forRoot(), | 48 | TooltipModule.forRoot(), |
| 47 | PopoverModule.forRoot() | 49 | PopoverModule.forRoot() |
| 48 | ], | 50 | ], |
| 49 | providers: [], | 51 | providers: [], |
| 50 | bootstrap: [AppComponent] | 52 | bootstrap: [AppComponent] |
| 51 | }) | 53 | }) |
| 52 | export class AppModule { } | 54 | export class AppModule { } |
| 53 | 55 |
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 | 27 | getPromocion(sector, codigo): Observable<any> { | |
| 28 | getPromocion(sector, codigo): Observable<any> { | 28 | |
| 29 | 29 | var url = `${appSettings.apiUrl}/promociones/incluir-articulo/${sector}/${codigo}`; | |
| 30 | // var url = `${appSettings.apiUrl}/promociones/incluir-articulo/${sector}/${codigo}`; | 30 | // var url = `${appSettings.apiUrl}/promociones/incluir-articulo/${2}/${1306}`; |
| 31 | var url = `${appSettings.apiUrl}/promociones/incluir-articulo/${2}/${1306}`; | 31 | return this.http.get(url); |
| 32 | return this.http.get(url); | 32 | } |
| 33 | |||
| 34 | getPromocionSinonimos(sector, codigo): Observable<any> { | ||
| 35 | |||
| 36 | var url = `${appSettings.apiUrl}/promociones/incluir-articulo/${sector}/${codigo}`; | ||
| 33 | } | 37 | // var url = `${appSettings.apiUrl}/sinonimos/promo/${2}/${7}`; |
| 34 | 38 | return this.http.get(url); | |
| 35 | getPromocionSinonimos(sector, codigo): Observable<any> { | 39 | } |
| 36 | 40 | ||
| 37 | // var url = `${appSettings.apiUrl}/promociones/incluir-articulo/${sector}/${codigo}`; | 41 | updateImages(body): Observable<any> { |
| 38 | var url = `${appSettings.apiUrl}/sinonimos/promo/${2}/${7}`; | 42 | return this.http.post(`${appSettings.apiUrl}/imagenes/guardar`, body); |
| 39 | return this.http.get(url); | 43 | } |
| 40 | } | 44 | |
| 41 | } | 45 | } |
| 42 | 46 |
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 | font-family: bahnschrift; | 8 | font-family: bahnschrift; |
| 10 | } | 9 | } |
| 11 | 10 | ||
| 12 | .blur { | 11 | .blur { |
| 13 | filter: blur(10px); | 12 | filter: blur(10px); |
| 14 | -webkit-filter: blur(10px); | 13 | -webkit-filter: blur(10px); |
| 15 | } | 14 | } |
| 16 | 15 | ||
| 17 | .disable-user-select { | 16 | .disable-user-select { |
| 18 | -webkit-user-select: none; | 17 | -webkit-user-select: none; |
| 19 | -moz-user-select: none; | 18 | -moz-user-select: none; |
| 20 | -ms-user-select: none; | 19 | -ms-user-select: none; |
| 21 | user-select: none; | 20 | user-select: none; |
| 22 | } | 21 | } |
| 23 | 22 | ||
| 24 | .blue-gradient { | 23 | .blue-gradient { |
| 25 | background: linear-gradient(0deg, #ffffff00, $white); | 24 | background: linear-gradient(0deg, #ffffff00, $white); |
| 26 | } | 25 | } |
| 27 | 26 | ||
| 28 | .rounded { | 27 | .rounded { |
| 29 | border-radius: 1.5rem !important; | 28 | border-radius: 1.5rem !important; |
| 30 | } | 29 | } |
| 31 | 30 | ||
| 32 | .rounded-top-sm { | 31 | .rounded-top-sm { |
| 33 | border-top-left-radius: 0.75rem !important; | 32 | border-top-left-radius: 0.75rem !important; |
| 34 | border-top-right-radius: 0.75rem !important; | 33 | border-top-right-radius: 0.75rem !important; |
| 35 | } | 34 | } |
| 36 | 35 | ||
| 37 | .rounded-sm { | 36 | .rounded-sm { |
| 38 | border-radius: 0.75rem !important; | 37 | border-radius: 0.75rem !important; |
| 39 | } | 38 | } |
| 40 | 39 | ||
| 41 | .card-effect { | 40 | .card-effect { |
| 42 | &:active { | 41 | &:active { |
| 43 | background-color: #c9c9c9b3 !important; | 42 | background-color: #c9c9c9b3 !important; |
| 44 | transition: background-color 0.5s; | 43 | transition: background-color 0.5s; |
| 45 | } | 44 | } |
| 46 | &:focus { | 45 | &:focus { |
| 47 | background-color: #c9c9c9b3 !important; | 46 | background-color: #c9c9c9b3 !important; |
| 48 | transition: background-color 0.5s; | 47 | transition: background-color 0.5s; |
| 49 | } | 48 | } |
| 50 | } | 49 | } |
| 51 | 50 | ||
| 52 | .overflow-scroll { | 51 | .overflow-scroll { |
| 53 | overflow-y: auto !important; | 52 | overflow-y: auto !important; |
| 54 | overflow-x: hidden !important; | 53 | overflow-x: hidden !important; |
| 55 | &::-webkit-scrollbar { | 54 | &::-webkit-scrollbar { |
| 56 | width: 0.5em; | 55 | width: 0.5em; |
| 57 | } | 56 | } |
| 58 | &::-webkit-scrollbar-track { | 57 | &::-webkit-scrollbar-track { |
| 59 | border-radius: 10px; | 58 | border-radius: 10px; |
| 60 | box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.4); | 59 | 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); | 60 | -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.4); |
| 62 | background-color: $white; | 61 | background-color: $white; |
| 63 | } | 62 | } |
| 64 | &::-webkit-scrollbar-thumb { | 63 | &::-webkit-scrollbar-thumb { |
| 65 | box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.7); | 64 | 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); | 65 | -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.7); |
| 67 | outline: 1px solid slategrey; | 66 | outline: 1px solid slategrey; |
| 68 | border-radius: 10px; | 67 | border-radius: 10px; |
| 69 | height: 12px; | 68 | height: 12px; |
| 70 | &:active { | 69 | &:active { |
| 71 | box-shadow: inset 0 0 8px rgba(255, 0, 0, 0.9); | 70 | box-shadow: inset 0 0 8px rgba(255, 0, 0, 0.9); |
| 72 | -webkit-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); |
| 73 | } | 72 | } |
| 74 | } | 73 | } |
| 75 | &::-webkit-scrollbar-corner { | 74 | &::-webkit-scrollbar-corner { |
| 76 | border-radius: 10px; | 75 | border-radius: 10px; |
| 77 | } | 76 | } |
| 78 | } | 77 | } |
| 79 | 78 | ||
| 80 | .bg-gray { | 79 | .bg-gray { |
| 81 | background-color: #e6e6e6; | 80 | background-color: #e6e6e6; |
| 82 | } | 81 | } |
| 83 | 82 | ||
| 84 | .bg-primary-gradient { | 83 | .bg-primary-gradient { |
| 85 | background: linear-gradient(135deg, rgba(40, 112, 175, 1) 0%, rgba(0, 32, 66, 1) 100%); | 84 | background: linear-gradient(135deg, rgba(40, 112, 175, 1) 0%, rgba(0, 32, 66, 1) 100%); |
| 86 | } | 85 | } |
| 87 | 86 | ||
| 88 | .icon-dim { | 87 | .icon-dim { |
| 89 | height: 40px !important; | 88 | height: 40px !important; |
| 90 | width: auto !important; | 89 | width: auto !important; |
| 91 | background-color: white !important; | 90 | background-color: white !important; |
| 92 | } | 91 | } |
| 93 | 92 | ||
| 94 | .text-purple { | 93 | .text-purple { |
| 95 | color: $purple; | 94 | color: $purple; |
| 96 | } | 95 | } |
| 97 | 96 | ||
| 98 | .vh-70 { | 97 | .vh-70 { |
| 99 | min-height: auto !important; | 98 | min-height: auto !important; |
| 100 | max-height: 70vh !important; | 99 | max-height: 70vh !important; |
| 101 | } | 100 | } |
| 102 | 101 | ||
| 103 | .vh-60 { | 102 | .vh-60 { |
| 104 | min-height: auto !important; | 103 | min-height: auto !important; |
| 105 | max-height: 60vh !important; | 104 | max-height: 60vh !important; |
| 106 | } | 105 | } |
| 107 | 106 | ||
| 108 | .spinner-lg { | 107 | .spinner-lg { |
| 109 | width: 3rem !important; | 108 | width: 3rem !important; |
| 110 | height: 3rem !important; | 109 | height: 3rem !important; |
| 111 | } | 110 | } |
| 112 | 111 | ||
| 113 | .sidebar { | 112 | .sidebar { |
| 114 | right: 0; | 113 | right: 0; |
| 115 | } | 114 | } |
| 116 | 115 |