Commit 27f29326c7c53ce39e1505390526e9e238301a3e
1 parent
f4af24c2cb
Exists in
20200117-axion-responsive
corregido error en sleeccion de articulos, adaptado carrito y opciones de pago
Showing
14 changed files
with
103 additions
and
37 deletions
Show diff stats
src/app/modules/cancelar-compra/cancelar-compra.component.ts
| 1 | import { Component, OnInit } from '@angular/core'; | 1 | import { Component, OnInit } from '@angular/core'; |
| 2 | import { Location } from '@angular/common'; | 2 | import { Location } from '@angular/common'; |
| 3 | import { ArticuloService } from 'src/app/services/articulo/articulo.service'; | 3 | import { ArticuloService } from 'src/app/services/articulo/articulo.service'; |
| 4 | import { Router } from '@angular/router'; | 4 | import { Router } from '@angular/router'; |
| 5 | 5 | ||
| 6 | @Component({ | 6 | @Component({ |
| 7 | selector: 'app-cancelar-compra', | 7 | selector: 'app-cancelar-compra', |
| 8 | templateUrl: './cancelar-compra.component.html', | 8 | templateUrl: './cancelar-compra.component.html', |
| 9 | styleUrls: ['./cancelar-compra.component.scss'] | 9 | styleUrls: ['./cancelar-compra.component.scss'] |
| 10 | }) | 10 | }) |
| 11 | export class CancelarCompraComponent implements OnInit { | 11 | export class CancelarCompraComponent implements OnInit { |
| 12 | 12 | ||
| 13 | constructor( | 13 | constructor( |
| 14 | private location: Location, | 14 | private location: Location, |
| 15 | private router: Router, | 15 | private router: Router, |
| 16 | private articuloService: ArticuloService | 16 | private articuloService: ArticuloService |
| 17 | ) { } | 17 | ) { } |
| 18 | 18 | ||
| 19 | ngOnInit() { | 19 | ngOnInit() { |
| 20 | setTimeout(() => { | 20 | setTimeout(() => { |
| 21 | this.limpiarCarritoYvolver(); | 21 | this.limpiarCarritoYvolver(); |
| 22 | }, 90000); | 22 | }, 90000); |
| 23 | if ($("body").hasClass("lash")) { | 23 | this.mediaPantalla(); |
| 24 | $("#cancelImg,#cancelCard").addClass("lash"); | 24 | |
| 25 | } | ||
| 26 | } | 25 | } |
| 27 | 26 | ||
| 28 | volverPreviousPage() { | 27 | volverPreviousPage() { |
| 29 | this.location.back(); | 28 | this.location.back(); |
| 30 | } | 29 | } |
| 31 | 30 | ||
| 32 | limpiarCarritoYvolver() { | 31 | limpiarCarritoYvolver() { |
| 33 | this.articuloService.carrito = undefined; | 32 | this.articuloService.carrito = undefined; |
| 34 | this.router.navigate(['/']); | 33 | this.router.navigate(['/']); |
| 35 | } | 34 | } |
| 35 | |||
| 36 | mediaPantalla(){ | ||
| 37 | if ($("body").hasClass("lash")) { | ||
| 38 | $("#cancelImg,#cancelCard").addClass("lash"); | ||
| 39 | } | ||
| 40 | } | ||
| 36 | } | 41 | } |
src/app/modules/carrito/carrito.component.html
| 1 | <div class="h-92 bg-white fade-in-left"> | 1 | <div class="h-92 bg-white fade-in-left"> |
| 2 | <!-- PUBLICIDADES --> | 2 | <!-- PUBLICIDADES --> |
| 3 | <app-header-publicidad></app-header-publicidad> | 3 | <app-header-publicidad></app-header-publicidad> |
| 4 | 4 | ||
| 5 | <div class="h-75"> | 5 | <div class="h-75"> |
| 6 | <!-- CABECERA --> | 6 | <!-- CABECERA --> |
| 7 | <div class="row mx-3 h-auto border border-primary rounded-sm"> | 7 | <div class="row mx-3 h-auto border border-primary rounded-sm"> |
| 8 | <div class="col-12 px-0 py-2 align-self-center"> | 8 | <div class="col-12 px-0 py-2 align-self-center"> |
| 9 | <div class="px-3"> | 9 | <div class="px-3"> |
| 10 | <p class="h6 text-truncate">ESTE ES TÚ CARRITO DE COMPRAS</p> | 10 | <p class="h6 text-truncate">ESTE ES TÚ CARRITO DE COMPRAS</p> |
| 11 | </div> | 11 | </div> |
| 12 | </div> | 12 | </div> |
| 13 | </div> | 13 | </div> |
| 14 | 14 | ||
| 15 | <!-- CARRITO --> | 15 | <!-- CARRITO --> |
| 16 | <div class="row mx-2 mt-4 h-80 justify-content-center align-content-start scroll-y-visible"> | 16 | <div class="row mx-2 mt-4 h-80 justify-content-center align-content-start scroll-y-visible" id="carrito"> |
| 17 | <!-- MENSAJE DE ADVERTENCIA --> | 17 | <!-- MENSAJE DE ADVERTENCIA --> |
| 18 | <div class="col-10 align-self-center alert alert-primary" *ngIf="!articuloService.carrito.length"> | 18 | <div class="col-10 align-self-center alert alert-primary" *ngIf="!articuloService.carrito.length"> |
| 19 | <p class="h5 text-center">No hay artículos en el carrito</p> | 19 | <p class="h5 text-center">No hay artículos en el carrito</p> |
| 20 | </div> | 20 | </div> |
| 21 | <!-- ARTICULOS --> | 21 | <!-- ARTICULOS --> |
| 22 | <div | 22 | <div |
| 23 | class="col-12 col-xl-6 p-2 h-25 text-center text-truncate" | 23 | class="col-12 col-xl-6 p-2 h-25 text-center text-truncate" [ngClass]="{'lash':flagPantalla == true}" id="art-carrito" |
| 24 | *ngFor="let articulo of articuloService.carrito; let i = index;" | 24 | *ngFor="let articulo of articuloService.carrito; let i = index;" |
| 25 | @EnterLeave> | 25 | @EnterLeave> |
| 26 | <!-- ARTICULO --> | 26 | <!-- ARTICULO --> |
| 27 | <div class="h-100 px-2 py-4 border border-primary rounded-sm"> | 27 | <div class="h-100 px-2 py-4 border border-primary rounded-sm"> |
| 28 | <div class="row mx-0 h-100"> | 28 | <div class="row mx-0 h-100"> |
| 29 | <!-- NOMBRE E IMAGEN --> | 29 | <!-- NOMBRE E IMAGEN --> |
| 30 | <div class="col-3 h-100 border-right border-primary align-self-center"> | 30 | <div class="col-3 h-100 border-right border-primary align-self-center"> |
| 31 | <img | 31 | <img |
| 32 | draggable="false" | 32 | draggable="false" |
| 33 | ondragstart="return false;" | 33 | ondragstart="return false;" |
| 34 | (contextmenu)="false" | 34 | (contextmenu)="false" |
| 35 | class="d-block mx-auto h-55 rounded-sm shadow-sm" | 35 | class="d-block mx-auto h-55 rounded-sm shadow-sm" |
| 36 | src="{{urlImagenes}}{{articulo.imagenes[0].imagen}}" | 36 | src="{{urlImagenes}}{{articulo.imagenes[0].imagen}}" |
| 37 | onerror="this.src='assets/img/image-not-found.jpg'"> | 37 | onerror="this.src='assets/img/image-not-found.jpg'"> |
| 38 | <div class="row mx-0 h-45"> | 38 | <div class="row mx-0 h-45"> |
| 39 | <p class="col text-primary text-truncate align-self-end"> | 39 | <p class="col text-primary text-truncate align-self-end"> |
| 40 | <small>{{articulo.DetArt}}</small> | 40 | <small>{{articulo.DetArt}}</small> |
| 41 | </p> | 41 | </p> |
| 42 | </div> | 42 | </div> |
| 43 | </div> | 43 | </div> |
| 44 | <!-- CANTIDAD --> | 44 | <!-- CANTIDAD --> |
| 45 | <div class="col-3 border-right border-primary"> | 45 | <div class="col-3 border-right border-primary"> |
| 46 | <p><small>CANT</small></p> | 46 | <p><small>CANT</small></p> |
| 47 | <div class="row mt-2 mx-0"> | 47 | <div class="row mt-2 mx-0"> |
| 48 | <div class="col-12 h-auto"> | 48 | <div class="col-12 h-auto"> |
| 49 | <div class="row mx-0 justify-content-between bg-primary badge-pill"> | 49 | <div class="row mx-0 justify-content-between bg-primary badge-pill"> |
| 50 | <!-- BOTON MENOS --> | 50 | <!-- BOTON MENOS --> |
| 51 | <div class="col-auto px-0"> | 51 | <div class="col-auto px-0"> |
| 52 | <img | 52 | <img |
| 53 | draggable="false" | 53 | draggable="false" |
| 54 | ondragstart="return false;" | 54 | ondragstart="return false;" |
| 55 | (contextmenu)="false" | 55 | (contextmenu)="false" |
| 56 | class="d-block ml-auto py-2 icon-20 btn-effect" | 56 | class="d-block ml-auto py-2 icon-20 btn-effect" |
| 57 | src="assets/img/menos-blanco.svg" | 57 | src="assets/img/menos-blanco.svg" |
| 58 | (click)="substractCant(articulo)"> | 58 | (click)="substractCant(articulo)"> |
| 59 | </div> | 59 | </div> |
| 60 | <!-- CANTIDAD --> | 60 | <!-- CANTIDAD --> |
| 61 | <div class="col px-0 align-self-center text-white"> | 61 | <div class="col px-0 align-self-center text-white"> |
| 62 | <p><small>{{articulo.cantidad}}</small></p> | 62 | <p><small>{{articulo.cantidad}}</small></p> |
| 63 | </div> | 63 | </div> |
| 64 | <!-- BOTON MAS --> | 64 | <!-- BOTON MAS --> |
| 65 | <div class="col-auto px-0"> | 65 | <div class="col-auto px-0"> |
| 66 | <img | 66 | <img |
| 67 | draggable="false" | 67 | draggable="false" |
| 68 | ondragstart="return false;" | 68 | ondragstart="return false;" |
| 69 | (contextmenu)="false" | 69 | (contextmenu)="false" |
| 70 | class="d-block ml-auto py-2 icon-20 btn-effect" | 70 | class="d-block ml-auto py-2 icon-20 btn-effect" |
| 71 | src="assets/img/mas-blanco.svg" | 71 | src="assets/img/mas-blanco.svg" |
| 72 | (click)="addCant(articulo)"> | 72 | (click)="addCant(articulo)"> |
| 73 | </div> | 73 | </div> |
| 74 | </div> | 74 | </div> |
| 75 | </div> | 75 | </div> |
| 76 | </div> | 76 | </div> |
| 77 | </div> | 77 | </div> |
| 78 | <!-- OPCIONALES --> | 78 | <!-- OPCIONALES --> |
| 79 | <!-- <div class="col-3 border-right border-primary"> | 79 | <!-- <div class="col-3 border-right border-primary"> |
| 80 | <p><small>OPCIONALES</small></p> | 80 | <p><small>OPCIONALES</small></p> |
| 81 | <div class="py-1 badge-pill bg-dark text-white"><p><small>{{'AZÚCAR'}}</small></p></div> | 81 | <div class="py-1 badge-pill bg-dark text-white"><p><small>{{'AZÚCAR'}}</small></p></div> |
| 82 | <div class="row mx-0 mt-2 justify-content-center"> | 82 | <div class="row mx-0 mt-2 justify-content-center"> |
| 83 | <div class="col-auto pl-3 btn-effect bg-primary badge-pill text-white"> | 83 | <div class="col-auto pl-3 btn-effect bg-primary badge-pill text-white"> |
| 84 | <span> | 84 | <span> |
| 85 | <small class="pr-2">CAMBIAR</small> | 85 | <small class="pr-2">CAMBIAR</small> |
| 86 | <img | 86 | <img |
| 87 | draggable="false" | 87 | draggable="false" |
| 88 | ondragstart="return false;" | 88 | ondragstart="return false;" |
| 89 | (contextmenu)="false" | 89 | (contextmenu)="false" |
| 90 | class="icon-20" | 90 | class="icon-20" |
| 91 | src="assets/img/ir.svg"> | 91 | src="assets/img/ir.svg"> |
| 92 | </span> | 92 | </span> |
| 93 | </div> | 93 | </div> |
| 94 | </div> --> | 94 | </div> --> |
| 95 | <!-- PRECIO --> | 95 | <!-- PRECIO --> |
| 96 | <div class="col-3 border-right border-primary"> | 96 | <div class="col-3 border-right border-primary"> |
| 97 | <p><small>PRECIO</small></p> | 97 | <p><small>PRECIO</small></p> |
| 98 | <div class="py-1 mt-2 badge-pill bg-dark text-white"> | 98 | <div class="py-1 mt-2 badge-pill bg-dark text-white"> |
| 99 | <p><small>{{articulo.PreVen | currency}}</small></p> | 99 | <p><small>{{articulo.PreVen | currency}}</small></p> |
| 100 | </div> | 100 | </div> |
| 101 | </div> | 101 | </div> |
| 102 | <!-- ELIMINAR --> | 102 | <!-- ELIMINAR --> |
| 103 | <div class="col-3 align-self-center"> | 103 | <div class="col-3 align-self-center"> |
| 104 | <div class="row mx-0 justify-content-center"> | 104 | <div class="row mx-0 justify-content-center"> |
| 105 | <div | 105 | <div |
| 106 | class="col-auto px-3 py-1 btn-effect bg-primary badge-pill text-white" | 106 | class="col-auto px-3 py-1 btn-effect bg-primary badge-pill text-white" |
| 107 | (click)="deleteArticulo(i)"> | 107 | (click)="deleteArticulo(i)"> |
| 108 | <span> | 108 | <span> |
| 109 | <small class="pr-2">ELIMINAR</small> | 109 | <small class="pr-2">ELIMINAR</small> |
| 110 | <img | 110 | <img |
| 111 | draggable="false" | 111 | draggable="false" |
| 112 | ondragstart="return false;" | 112 | ondragstart="return false;" |
| 113 | (contextmenu)="false" | 113 | (contextmenu)="false" |
| 114 | class="icon-20 rotate-45" | 114 | class="icon-20 rotate-45" |
| 115 | src="assets/img/mas-blanco.svg"> | 115 | src="assets/img/mas-blanco.svg"> |
| 116 | </span> | 116 | </span> |
| 117 | </div> | 117 | </div> |
| 118 | </div> | 118 | </div> |
| 119 | </div> | 119 | </div> |
| 120 | </div> | 120 | </div> |
| 121 | </div> | 121 | </div> |
| 122 | </div> | 122 | </div> |
| 123 | </div> | 123 | </div> |
| 124 | <!-- TOTAL --> | 124 | <!-- TOTAL --> |
| 125 | <div class="row mx-3 mt-2 h-auto justify-content-end"> | 125 | <div class="row mx-3 mt-2 h-auto justify-content-end"> |
| 126 | <div class="col-auto align-self-center text-primary"><small>TOTAL</small></div> | 126 | <div class="col-auto align-self-center text-primary"><small>TOTAL</small></div> |
| 127 | <div class="col-auto p-0 bg-primary d-none d-sm-block bg-total"> | 127 | <div class="col-auto p-0 bg-primary d-none d-sm-block bg-total"> |
| 128 | <p class="text-center text-white mt-1 py-1">{{articuloService.subTotal | currency}}</p> | 128 | <p class="text-center text-white mt-1 py-1">{{articuloService.subTotal | currency}}</p> |
| 129 | </div> | 129 | </div> |
| 130 | </div> | 130 | </div> |
| 131 | <!-- CONTINUAR --> | 131 | <!-- CONTINUAR --> |
| 132 | <div | 132 | <div |
| 133 | *ngIf="articuloService.carrito.length" | 133 | *ngIf="articuloService.carrito.length" |
| 134 | class="row mx-3 mt-4 h-auto justify-content-end"> | 134 | class="row mx-3 mt-4 h-auto justify-content-end"> |
| 135 | <div | 135 | <div |
| 136 | class="col-auto py-2 px-3 align-self-center btn-effect bg-primary badge-pill text-white" | 136 | class="col-auto py-2 px-3 align-self-center btn-effect bg-primary badge-pill text-white" |
| 137 | [routerLink]="['/forma-pago']"> | 137 | [routerLink]="['/forma-pago']"> |
| 138 | <span> | 138 | <span> |
| 139 | <small class="pr-2">CONTINUAR</small> | 139 | <small class="pr-2">CONTINUAR</small> |
| 140 | <img | 140 | <img |
| 141 | draggable="false" | 141 | draggable="false" |
| 142 | ondragstart="return false;" | 142 | ondragstart="return false;" |
| 143 | (contextmenu)="false" | 143 | (contextmenu)="false" |
| 144 | class="icon-20" | 144 | class="icon-20" |
| 145 | src="assets/img/ir.svg"> | 145 | src="assets/img/ir.svg"> |
| 146 | </span> | 146 | </span> |
| 147 | </div> | 147 | </div> |
| 148 | </div> | 148 | </div> |
| 149 | <!-- SEGUIR COMPRANDO --> | 149 | <!-- SEGUIR COMPRANDO --> |
| 150 | <!-- <div class="row mx-3 mt-2 h-auto justify-content-end"> | 150 | <!-- <div class="row mx-3 mt-2 h-auto justify-content-end"> |
| 151 | <div | 151 | <div |
| 152 | class="col-auto py-2 px-3 align-self-center btn-effect bg-primary badge-pill text-white" | 152 | class="col-auto py-2 px-3 align-self-center btn-effect bg-primary badge-pill text-white" |
| 153 | (click)="goBack()"> | 153 | (click)="goBack()"> |
| 154 | <span> | 154 | <span> |
| 155 | <small class="pr-2">SEGUIR COMPRANDO</small> | 155 | <small class="pr-2">SEGUIR COMPRANDO</small> |
| 156 | <img | 156 | <img |
| 157 | draggable="false" | 157 | draggable="false" |
| 158 | ondragstart="return false;" | 158 | ondragstart="return false;" |
| 159 | (contextmenu)="false" | 159 | (contextmenu)="false" |
| 160 | class="icon-20" | 160 | class="icon-20" |
| 161 | src="assets/img/ir.svg"> | 161 | src="assets/img/ir.svg"> |
| 162 | </span> | 162 | </span> |
| 163 | </div> | 163 | </div> |
| 164 | </div> --> | 164 | </div> --> |
| 165 | </div> | 165 | </div> |
| 166 | 166 | ||
| 167 | </div> | 167 | </div> |
| 168 | 168 |
src/app/modules/carrito/carrito.component.scss
| 1 | .bg-total { | 1 | .bg-total { |
| 2 | width: 75px; | 2 | width: 75px; |
| 3 | border-radius: 1.5rem; | 3 | border-radius: 1.5rem; |
| 4 | } | 4 | } |
| 5 | |||
| 6 | #art-carrito.lash{ | ||
| 7 | min-height: 130px !important; | ||
| 8 | } | ||
| 9 | |||
| 10 | #carrito.lash{ | ||
| 11 | max-height: 60% !important; | ||
| 12 | } |
src/app/modules/carrito/carrito.component.ts
| 1 | import { Component, OnInit } from '@angular/core'; | 1 | import { Component, OnInit } from '@angular/core'; |
| 2 | import { Location } from '@angular/common'; | 2 | import { Location } from '@angular/common'; |
| 3 | import { ArticuloService } from 'src/app/services/articulo/articulo.service'; | 3 | import { ArticuloService } from 'src/app/services/articulo/articulo.service'; |
| 4 | import { APP_SETTINGS } from 'src/etc/AppSettings'; | 4 | import { APP_SETTINGS } from 'src/etc/AppSettings'; |
| 5 | import { trigger, state, style, transition, animate } from '@angular/animations'; | 5 | import { trigger, state, style, transition, animate } from '@angular/animations'; |
| 6 | import { IArticulo } from 'src/app/interfaces/IArticulo'; | 6 | import { IArticulo } from 'src/app/interfaces/IArticulo'; |
| 7 | import { Router } from '@angular/router'; | 7 | import { Router } from '@angular/router'; |
| 8 | 8 | ||
| 9 | @Component({ | 9 | @Component({ |
| 10 | selector: 'app-carrito', | 10 | selector: 'app-carrito', |
| 11 | templateUrl: './carrito.component.html', | 11 | templateUrl: './carrito.component.html', |
| 12 | styleUrls: ['./carrito.component.scss'], | 12 | styleUrls: ['./carrito.component.scss'], |
| 13 | animations: [ | 13 | animations: [ |
| 14 | trigger('EnterLeave', [ | 14 | trigger('EnterLeave', [ |
| 15 | state('flyIn', style({ transform: 'translateX(0)' })), | 15 | state('flyIn', style({ transform: 'translateX(0)' })), |
| 16 | transition(':enter', [ | 16 | transition(':enter', [ |
| 17 | style({ transform: 'translateX(-100%)' }), | 17 | style({ transform: 'translateX(-100%)' }), |
| 18 | animate('1s ease-in') | 18 | animate('1s ease-in') |
| 19 | ]), | 19 | ]), |
| 20 | transition(':leave', [ | 20 | transition(':leave', [ |
| 21 | animate('1s ease-out', style({ transform: 'translateX(-100%)' })) | 21 | animate('1s ease-out', style({ transform: 'translateX(-100%)' })) |
| 22 | ]) | 22 | ]) |
| 23 | ]) | 23 | ]) |
| 24 | ] | 24 | ] |
| 25 | }) | 25 | }) |
| 26 | export class CarritoComponent implements OnInit { | 26 | export class CarritoComponent implements OnInit { |
| 27 | urlImagenes = `${APP_SETTINGS.apiDeboSuite}/imagenes/`; | 27 | urlImagenes = `${APP_SETTINGS.apiDeboSuite}/imagenes/`; |
| 28 | maxCantidad = 50; | 28 | maxCantidad = 50; |
| 29 | 29 | flagPantalla:boolean = false; | |
| 30 | constructor( | 30 | constructor( |
| 31 | public articuloService: ArticuloService, | 31 | public articuloService: ArticuloService, |
| 32 | private location: Location, | 32 | private location: Location, |
| 33 | private router: Router, | 33 | private router: Router, |
| 34 | ) { } | 34 | ) { } |
| 35 | 35 | ||
| 36 | ngOnInit() { | 36 | ngOnInit() { |
| 37 | if (!this.articuloService.carrito.length) { | 37 | if (!this.articuloService.carrito.length) { |
| 38 | this.router.navigate(['']); | 38 | this.router.navigate(['']); |
| 39 | return; | 39 | return; |
| 40 | } | 40 | } |
| 41 | this.mediaPantalla() | ||
| 41 | } | 42 | } |
| 42 | 43 | ||
| 43 | deleteArticulo(index: number) { | 44 | deleteArticulo(index: number) { |
| 44 | this.articuloService.carrito.splice(index, 1); | 45 | this.articuloService.carrito.splice(index, 1); |
| 45 | this.articuloService.calcularTotal(); | 46 | this.articuloService.calcularTotal(); |
| 46 | } | 47 | } |
| 47 | 48 | ||
| 48 | substractCant(articulo: IArticulo) { | 49 | substractCant(articulo: IArticulo) { |
| 49 | if (articulo.cantidad === 1) return; | 50 | if (articulo.cantidad === 1) return; |
| 50 | articulo.cantidad--; | 51 | articulo.cantidad--; |
| 51 | this.articuloService.calcularTotal(); | 52 | this.articuloService.calcularTotal(); |
| 52 | } | 53 | } |
| 53 | 54 | ||
| 54 | addCant(articulo: IArticulo) { | 55 | addCant(articulo: IArticulo) { |
| 55 | if (articulo.cantidad >= this.maxCantidad) return; | 56 | if (articulo.cantidad >= this.maxCantidad) return; |
| 56 | articulo.cantidad++; | 57 | articulo.cantidad++; |
| 57 | this.articuloService.calcularTotal(); | 58 | this.articuloService.calcularTotal(); |
| 58 | } | 59 | } |
| 59 | 60 | ||
| 60 | goBack() { | 61 | goBack() { |
| 61 | this.location.back(); | 62 | this.location.back(); |
| 62 | } | 63 | } |
| 63 | 64 | mediaPantalla(){ | |
| 65 | if ($("body").hasClass("lash")) { | ||
| 66 | $("#carrito").addClass("lash"); | ||
| 67 | this.flagPantalla = true; | ||
| 68 | } | ||
| 69 | } | ||
| 64 | } | 70 | } |
| 65 | 71 |
src/app/modules/forma-pago/forma-pago.component.html
| 1 | <div class="h-92 bg-white fade-in-left"> | 1 | <div class="h-92 bg-white fade-in-left"> |
| 2 | <div class="row mx-0 h-15"> | 2 | <div class="row mx-0 h-15"> |
| 3 | <div class="col-12 px-0 h-80 my-auto"> | 3 | <div class="col-12 px-0 h-80 my-auto"> |
| 4 | <img | 4 | <img |
| 5 | draggable="false" | 5 | draggable="false" |
| 6 | ondragstart="return false;" | 6 | ondragstart="return false;" |
| 7 | (contextmenu)="false" | 7 | (contextmenu)="false" |
| 8 | class="d-block mx-auto h-100" | 8 | class="d-block mx-auto h-100" |
| 9 | src="assets/img/logo-spot.svg"> | 9 | src="assets/img/logo-spot.svg"> |
| 10 | </div> | 10 | </div> |
| 11 | </div> | 11 | </div> |
| 12 | <div class="h-85"> | 12 | <div class="h-85"> |
| 13 | <div class="row mt-5 mx-3 h-auto border border-primary rounded-sm"> | 13 | <div class="row mt-5 mx-3 h-auto border border-primary rounded-sm"> |
| 14 | <div class="col-12 px-0 py-2 align-self-center"> | 14 | <div class="col-12 px-0 py-2 align-self-center"> |
| 15 | <div class="px-3 text-center"> | 15 | <div class="px-3 text-center"> |
| 16 | <p class="h6 text-truncate">SELECCIONA UNA FORMA DE PAGO</p> | 16 | <p class="h6 text-truncate">SELECCIONA UNA FORMA DE PAGO</p> |
| 17 | </div> | 17 | </div> |
| 18 | </div> | 18 | </div> |
| 19 | </div> | 19 | </div> |
| 20 | <!-- OPCION PAGO ELECTRONICO --> | 20 | <!-- OPCION PAGO ELECTRONICO --> |
| 21 | <div class="row mt-5 h-auto justify-content-center mx-0"> | 21 | <div class="row mt-5 h-auto justify-content-center mx-0" id="card1"> |
| 22 | <div class="col-auto px-0 h-auto align-self-start"> | 22 | <div class="col-auto px-0 h-auto align-self-start"> |
| 23 | <div | 23 | <div |
| 24 | class="btn-effect col-auto align-self-center px-0 bg-white" | 24 | class="btn-effect col-auto align-self-center px-0 bg-white" |
| 25 | (click)="medioPago(9)"> | 25 | (click)="medioPago(9)"> |
| 26 | <div class="row mx-0 bg-primary badge-pill"> | 26 | <div class="row mx-0 bg-primary badge-pill"> |
| 27 | <div class="col-auto p-0"> | 27 | <div class="col-auto p-0"> |
| 28 | <img | 28 | <img |
| 29 | draggable="false" | 29 | draggable="false" |
| 30 | ondragstart="return false;" | 30 | ondragstart="return false;" |
| 31 | (contextmenu)="false" | 31 | (contextmenu)="false" |
| 32 | class="p-1 icon-50" | 32 | class="p-1 icon-50" |
| 33 | src="assets/img/icono-plato.svg"> | 33 | src="assets/img/icono-plato.svg"> |
| 34 | </div> | 34 | </div> |
| 35 | <div class="col-auto align-self-center text-white">Pago electrónico</div> | 35 | <div class="col-auto align-self-center text-white">Pago electrónico</div> |
| 36 | <div class="col-auto align-self-center p-0"> | 36 | <div class="col-auto align-self-center p-0"> |
| 37 | <img | 37 | <img |
| 38 | draggable="false" | 38 | draggable="false" |
| 39 | ondragstart="return false;" | 39 | ondragstart="return false;" |
| 40 | (contextmenu)="false" | 40 | (contextmenu)="false" |
| 41 | class="p-1 icon-30" | 41 | class="p-1 icon-30" |
| 42 | src="assets/img/ir.svg"> | 42 | src="assets/img/ir.svg"> |
| 43 | </div> | 43 | </div> |
| 44 | </div> | 44 | </div> |
| 45 | </div> | 45 | </div> |
| 46 | </div> | 46 | </div> |
| 47 | </div> | 47 | </div> |
| 48 | <!-- OPCION PAGO CON TARJETA --> | 48 | <!-- OPCION PAGO CON TARJETA --> |
| 49 | <div class="row mt-5 h-auto justify-content-center mx-0"> | 49 | <div class="row mt-5 h-auto justify-content-center mx-0" id="card2"> |
| 50 | <div class="col-auto px-0 h-auto align-self-start"> | 50 | <div class="col-auto px-0 h-auto align-self-start"> |
| 51 | <div | 51 | <div |
| 52 | class="btn-effect col-auto align-self-center px-0 bg-white" | 52 | class="btn-effect col-auto align-self-center px-0 bg-white" |
| 53 | (click)="medioPago(4)"> | 53 | (click)="medioPago(4)"> |
| 54 | <div class="row mx-0 bg-primary badge-pill"> | 54 | <div class="row mx-0 bg-primary badge-pill"> |
| 55 | <div class="col-auto p-0"> | 55 | <div class="col-auto p-0"> |
| 56 | <img | 56 | <img |
| 57 | draggable="false" | 57 | draggable="false" |
| 58 | ondragstart="return false;" | 58 | ondragstart="return false;" |
| 59 | (contextmenu)="false" | 59 | (contextmenu)="false" |
| 60 | class="p-1 icon-50" | 60 | class="p-1 icon-50" |
| 61 | src="assets/img/icono-take-away.svg"> | 61 | src="assets/img/icono-take-away.svg"> |
| 62 | </div> | 62 | </div> |
| 63 | <div class="col-auto align-self-center text-white">Pago con tarjeta</div> | 63 | <div class="col-auto align-self-center text-white" id="">Pago con tarjeta</div> |
| 64 | <div class="col-auto align-self-center p-0"> | 64 | <div class="col-auto align-self-center p-0"> |
| 65 | <img | 65 | <img |
| 66 | draggable="false" | 66 | draggable="false" |
| 67 | ondragstart="return false;" | 67 | ondragstart="return false;" |
| 68 | (contextmenu)="false" | 68 | (contextmenu)="false" |
| 69 | class="p-1 icon-30" | 69 | class="p-1 icon-30" |
| 70 | src="assets/img/ir.svg"> | 70 | src="assets/img/ir.svg"> |
| 71 | </div> | 71 | </div> |
| 72 | </div> | 72 | </div> |
| 73 | </div> | 73 | </div> |
| 74 | </div> | 74 | </div> |
| 75 | </div> | 75 | </div> |
| 76 | </div> | 76 | </div> |
| 77 | </div> | 77 | </div> |
| 78 | 78 |
src/app/modules/forma-pago/forma-pago.component.scss
| 1 | #card1.lash{ | ||
| 2 | position: absolute; | ||
| 3 | bottom: 150px; | ||
| 4 | -webkit-box-flex: 0; | ||
| 5 | flex: 0 0 41.6666666667%; | ||
| 6 | max-width: 41.6666666667%; | ||
| 7 | left: 10%; | ||
| 8 | margin-left: 0 !important; | ||
| 9 | } | ||
| 10 | |||
| 11 | #card2.lash{ | ||
| 12 | position: absolute; | ||
| 13 | bottom: 150px; | ||
| 14 | -webkit-box-flex: 0; | ||
| 15 | flex: 0 0 41.6666666667%; | ||
| 16 | max-width: 41.6666666667%; | ||
| 17 | right: 10%; | ||
| 18 | margin-right: 0 !important; | ||
| 19 | } |
src/app/modules/forma-pago/forma-pago.component.ts
| 1 | import { Component, OnInit } from '@angular/core'; | 1 | import { Component, OnInit } from '@angular/core'; |
| 2 | import { ArticuloService } from 'src/app/services/articulo/articulo.service'; | 2 | import { ArticuloService } from 'src/app/services/articulo/articulo.service'; |
| 3 | import { Router } from '@angular/router'; | 3 | import { Router } from '@angular/router'; |
| 4 | 4 | ||
| 5 | @Component({ | 5 | @Component({ |
| 6 | selector: 'app-forma-pago', | 6 | selector: 'app-forma-pago', |
| 7 | templateUrl: './forma-pago.component.html', | 7 | templateUrl: './forma-pago.component.html', |
| 8 | styleUrls: ['./forma-pago.component.scss'] | 8 | styleUrls: ['./forma-pago.component.scss'] |
| 9 | }) | 9 | }) |
| 10 | export class FormaPagoComponent implements OnInit { | 10 | export class FormaPagoComponent implements OnInit { |
| 11 | 11 | ||
| 12 | constructor( | 12 | constructor( |
| 13 | private articuloService: ArticuloService, | 13 | private articuloService: ArticuloService, |
| 14 | private router: Router, | 14 | private router: Router, |
| 15 | ) { } | 15 | ) { } |
| 16 | 16 | ||
| 17 | ngOnInit() { | 17 | ngOnInit() { |
| 18 | if (!this.articuloService.carrito.length) { | 18 | if (!this.articuloService.carrito.length) { |
| 19 | this.router.navigate(['']); | 19 | this.router.navigate(['']); |
| 20 | return; | 20 | return; |
| 21 | } | 21 | } |
| 22 | this.mediaPantalla(); | ||
| 23 | |||
| 22 | } | 24 | } |
| 23 | 25 | ||
| 24 | medioPago(medioPago: number) { | 26 | medioPago(medioPago: number) { |
| 25 | this.articuloService.medioPago = medioPago; | 27 | this.articuloService.medioPago = medioPago; |
| 26 | switch (medioPago) { | 28 | switch (medioPago) { |
| 27 | case 4: | 29 | case 4: |
| 28 | this.router.navigate(['pago-tarjeta']); | 30 | this.router.navigate(['pago-tarjeta']); |
| 29 | break; | 31 | break; |
| 30 | case 9: | 32 | case 9: |
| 31 | this.router.navigate(['pago-electronico']); | 33 | this.router.navigate(['pago-electronico']); |
| 32 | break; | 34 | break; |
| 33 | } | 35 | } |
| 34 | } | 36 | } |
| 35 | 37 | mediaPantalla(){ | |
| 38 | if ($("body").hasClass("lash")) { | ||
| 39 | $("#card1,#card2").addClass("lash"); | ||
| 40 | } | ||
| 41 | } | ||
| 36 | } | 42 | } |
| 37 | 43 |
src/app/modules/info-formas-pago/info-formas-pago.component.ts
| 1 | import { Component, OnInit } from '@angular/core'; | 1 | import { Component, OnInit } from '@angular/core'; |
| 2 | 2 | ||
| 3 | @Component({ | 3 | @Component({ |
| 4 | selector: 'app-formas-pago', | 4 | selector: 'app-formas-pago', |
| 5 | templateUrl: './info-formas-pago.component.html', | 5 | templateUrl: './info-formas-pago.component.html', |
| 6 | styleUrls: ['./info-formas-pago.component.scss'] | 6 | styleUrls: ['./info-formas-pago.component.scss'] |
| 7 | }) | 7 | }) |
| 8 | export class InfoFormasPagoComponent implements OnInit { | 8 | export class InfoFormasPagoComponent implements OnInit { |
| 9 | constructor() {} | 9 | constructor() {} |
| 10 | 10 | ||
| 11 | ngOnInit() { | 11 | ngOnInit() { |
| 12 | this.mediaPantalla(); | ||
| 13 | } | ||
| 12 | 14 | ||
| 15 | mediaPantalla(){ | ||
| 13 | if ($("body").hasClass("lash")) { | 16 | if ($("body").hasClass("lash")) { |
| 14 | $("#card1,#card2").addClass("lash"); | 17 | $("#card1,#card2").addClass("lash"); |
| 15 | } | 18 | } |
| 16 | } | 19 | } |
| 17 | } | 20 | } |
| 18 | 21 | ||
| 19 | 22 | ||
| 20 | 23 |
src/app/modules/opcion-pedido/opcion-pedido.component.ts
| 1 | import { Component, OnInit } from '@angular/core'; | 1 | import { Component, OnInit } from '@angular/core'; |
| 2 | import { Router } from '@angular/router'; | 2 | import { Router } from '@angular/router'; |
| 3 | 3 | ||
| 4 | @Component({ | 4 | @Component({ |
| 5 | selector: 'app-opcion-pedido', | 5 | selector: 'app-opcion-pedido', |
| 6 | templateUrl: './opcion-pedido.component.html', | 6 | templateUrl: './opcion-pedido.component.html', |
| 7 | styleUrls: ['./opcion-pedido.component.scss'] | 7 | styleUrls: ['./opcion-pedido.component.scss'] |
| 8 | }) | 8 | }) |
| 9 | export class OpcionPedidoComponent implements OnInit { | 9 | export class OpcionPedidoComponent implements OnInit { |
| 10 | 10 | ||
| 11 | constructor( | 11 | constructor( |
| 12 | private router: Router, | 12 | private router: Router, |
| 13 | ) { } | 13 | ) { } |
| 14 | 14 | ||
| 15 | ngOnInit() { | 15 | ngOnInit() { |
| 16 | if ($("body").hasClass("lash")) { | 16 | this.mediaPantalla(); |
| 17 | $("#card1,#card2").addClass("lash"); | ||
| 18 | } | ||
| 19 | } | 17 | } |
| 20 | 18 | ||
| 21 | goTo(path) { | 19 | goTo(path) { |
| 22 | this.router.navigate([path]); | 20 | this.router.navigate([path]); |
| 23 | } | 21 | } |
| 24 | 22 | ||
| 25 | seleccionPedido(lugar) { | 23 | seleccionPedido(lugar) { |
| 26 | localStorage.setItem('pedidoPara', lugar); | 24 | localStorage.setItem('pedidoPara', lugar); |
| 27 | } | 25 | } |
| 26 | mediaPantalla(){ | ||
| 27 | if ($("body").hasClass("lash")) { | ||
| 28 | $("#card1,#card2").addClass("lash"); | ||
| 29 | } | ||
| 30 | } |
src/app/modules/pago-tarjeta/pago-tarjeta.component.html
| 1 | <div class="h-92 bg-white fade-in-left"> | 1 | <div class="h-92 bg-white fade-in-left"> |
| 2 | <div class="row mx-0 h-15"> | 2 | <div class="row mx-0 h-15"> |
| 3 | <div class="col-12 px-0 h-80 my-auto"> | 3 | <div class="col-12 px-0 h-80 my-auto"> |
| 4 | <img | 4 | <img |
| 5 | draggable="false" | 5 | draggable="false" |
| 6 | ondragstart="return false;" | 6 | ondragstart="return false;" |
| 7 | (contextmenu)="false" | 7 | (contextmenu)="false" |
| 8 | class="d-block mx-auto h-100" | 8 | class="d-block mx-auto h-100" |
| 9 | src="assets/img/logo-spot.svg"> | 9 | src="assets/img/logo-spot.svg"> |
| 10 | </div> | 10 | </div> |
| 11 | </div> | 11 | </div> |
| 12 | <div class="h-85"> | 12 | <div class="h-85"> |
| 13 | <div class="row h-50 mx-0 justify-content-center text-center"> | 13 | <div class="row h-50 mx-0 justify-content-center text-center"> |
| 14 | <div class="col-7 p-5 h-auto align-self-end border border-secondary rounded"> | 14 | <div class="col-7 p-5 mt-5 h-auto align-self-end border border-secondary rounded"> |
| 15 | <img | 15 | <img |
| 16 | draggable="false" | 16 | draggable="false" |
| 17 | ondragstart="return false;" | 17 | ondragstart="return false;" |
| 18 | (contextmenu)="false" | 18 | (contextmenu)="false" |
| 19 | class="img-in-top px-4 bg-white" | 19 | class="img-in-top px-4 bg-white" |
| 20 | src="assets/img/icono-tarjetas.svg"> | 20 | src="assets/img/icono-tarjetas.svg"> |
| 21 | <p class="h6 m-0">AHORA</p> | 21 | <p class="h6 m-0">AHORA</p> |
| 22 | <p class="h2 mb-3 text-secondary"> | 22 | <p class="h2 mb-3 text-secondary"> |
| 23 | introducí o insertá tu tarjeta | 23 | introducí o insertá tu tarjeta |
| 24 | </p> | 24 | </p> |
| 25 | <p class="h6 m-0">Y SEGUÍ LAS INSTRUCCIONES DEL LECTOR</p> | 25 | <p class="h6 m-0">Y SEGUÍ LAS INSTRUCCIONES DEL LECTOR</p> |
| 26 | </div> | 26 | </div> |
| 27 | </div> | 27 | </div> |
| 28 | <div class="row mt-5 justify-content-center arrow-slide arrow-delay-1"> | 28 | <div class="row mt-5 justify-content-center arrow-slide arrow-delay-1"> |
| 29 | <div class="col-1"> | 29 | <div class="col-1"> |
| 30 | <img | 30 | <img |
| 31 | draggable="false" | 31 | draggable="false" |
| 32 | ondragstart="return false;" | 32 | ondragstart="return false;" |
| 33 | (contextmenu)="false" | 33 | (contextmenu)="false" |
| 34 | class="img-fluid" | 34 | class="img-fluid" |
| 35 | src="assets/img/down-chevron.svg"> | 35 | src="assets/img/down-chevron.svg"> |
| 36 | </div> | 36 | </div> |
| 37 | </div> | 37 | </div> |
| 38 | <div class="row justify-content-center arrow-slide arrow-delay-2"> | 38 | <div class="row justify-content-center arrow-slide arrow-delay-2"> |
| 39 | <div class="col-1"> | 39 | <div class="col-1"> |
| 40 | <img | 40 | <img |
| 41 | draggable="false" | 41 | draggable="false" |
| 42 | ondragstart="return false;" | 42 | ondragstart="return false;" |
| 43 | (contextmenu)="false" | 43 | (contextmenu)="false" |
| 44 | class="img-fluid" | 44 | class="img-fluid" |
| 45 | src="assets/img/down-chevron.svg"> | 45 | src="assets/img/down-chevron.svg"> |
| 46 | </div> | 46 | </div> |
| 47 | </div> | 47 | </div> |
| 48 | <div class="row justify-content-center arrow-slide arrow-delay-3"> | 48 | <div class="row justify-content-center arrow-slide arrow-delay-3"> |
| 49 | <div class="col-1"> | 49 | <div class="col-1"> |
| 50 | <img | 50 | <img |
| 51 | draggable="false" | 51 | draggable="false" |
| 52 | ondragstart="return false;" | 52 | ondragstart="return false;" |
| 53 | (contextmenu)="false" | 53 | (contextmenu)="false" |
| 54 | class="img-fluid" | 54 | class="img-fluid" |
| 55 | src="assets/img/down-chevron.svg"> | 55 | src="assets/img/down-chevron.svg"> |
| 56 | </div> | 56 | </div> |
| 57 | </div> | 57 | </div> |
| 58 | </div> | 58 | </div> |
| 59 | </div> | 59 | </div> |
| 60 | 60 |
src/app/modules/seleccion-articulos/seleccion-articulos.component.html
| 1 | <div class="h-92 bg-white fade-in-left"> | 1 | <div class="h-92 bg-white fade-in-left"> |
| 2 | <!-- PUBLICIDADES --> | 2 | <!-- PUBLICIDADES --> |
| 3 | <app-header-publicidad></app-header-publicidad> | 3 | <app-header-publicidad></app-header-publicidad> |
| 4 | 4 | ||
| 5 | <div class="row mx-0 h-80 align-items-end"> | 5 | <div class="row mx-0 h-80 align-items-end"> |
| 6 | <!-- CABECERA --> | 6 | <!-- CABECERA --> |
| 7 | <div class="row w-100 mx-3 h-auto border border-primary rounded-sm"> | 7 | <div class="row w-100 mx-3 h-auto border border-primary rounded-sm"> |
| 8 | <div class="col-12 p-2 align-self-center"> | 8 | <div class="col-12 p-2 align-self-center"> |
| 9 | <div class="px-3"> | 9 | <div class="px-3"> |
| 10 | <p class="h6 text-truncate">SELECCIONÁ TÚ COMIDA Y/O BEBIDA</p> | 10 | <p class="h6 text-truncate">SELECCIONÁ TÚ COMIDA Y/O BEBIDA</p> |
| 11 | </div> | 11 | </div> |
| 12 | </div> | 12 | </div> |
| 13 | </div> | 13 | </div> |
| 14 | <!-- CUERPO --> | 14 | <!-- CUERPO --> |
| 15 | <div class="row w-100 mr-4 h-70" id="content"> | 15 | <div class="row w-100 mr-4 h-70" id="content"> |
| 16 | <div class="col-12 h-100 px-0 py-3"> | 16 | <div class="col-12 h-100 px-0 py-3"> |
| 17 | <div class="row mx-0 h-100"> | 17 | <div class="row mx-0 h-100"> |
| 18 | <!-- FILTRO CATEGORIAS --> | 18 | <!-- FILTRO CATEGORIAS --> |
| 19 | <div class="col-5 col-sm-3 col-xl-2 h-100"> | 19 | <div class="col-5 col-sm-3 col-xl-2 h-100"> |
| 20 | <p class="h6 h-6 m-0 text-center"><small>CATEGORÍAS</small></p> | 20 | <p class="h6 h-6 m-0 text-center"><small>CATEGORÍAS</small></p> |
| 21 | <div class="row mx-0 h-94 justify-content-center align-items-center"> | 21 | <div class="row mx-0 h-94 justify-content-center align-items-center"> |
| 22 | <div class="col-auto btn-effect h-5 cat-btn"> | 22 | <div class="col-auto btn-effect h-5 cat-btn"> |
| 23 | <img | 23 | <img |
| 24 | draggable="false" | 24 | draggable="false" |
| 25 | ondragstart="return false;" | 25 | ondragstart="return false;" |
| 26 | (contextmenu)="false" | 26 | (contextmenu)="false" |
| 27 | class="h-100 d-block mx-auto rotate-90-neg" | 27 | class="h-100 d-block mx-auto rotate-90-neg" |
| 28 | src="assets/img/ir-color.svg" | 28 | src="assets/img/ir-color.svg" |
| 29 | (mousedown)="scrollY(templateCategorias, -100)" | 29 | (mousedown)="scrollY(templateCategorias, -100)" |
| 30 | (mouseup)="mouseup()" | 30 | (mouseup)="mouseup()" |
| 31 | (mouseleave)="mouseup()"> | 31 | (mouseleave)="mouseup()"> |
| 32 | </div> | 32 | </div> |
| 33 | <!-- CATEGORIAS --> | 33 | <!-- CATEGORIAS --> |
| 34 | <div | 34 | <div |
| 35 | #templateCategorias | 35 | #templateCategorias |
| 36 | class="col-12 px-0 box-categorias border border-primary border-left-0 rounded-right scroll-y"> | 36 | class="col-12 px-0 box-categorias border border-primary border-left-0 rounded-right scroll-y"> |
| 37 | <div | 37 | <div |
| 38 | class="row mx-4 mb-2 h-32 justify-content-center tab" | 38 | class="row mx-4 mb-2 h-32 justify-content-center tab catContent" |
| 39 | [ngClass]="{ 'active': allActive, 'border-bottom-effect': !allActive }" | 39 | [ngClass]="{ 'active': allActive, 'border-bottom-effect': !allActive }" |
| 40 | (click)="selectCategoria(-1, 0)" id="catContent"> | 40 | (click)="selectCategoria(-1, 0)" id=""> |
| 41 | <img | 41 | <img |
| 42 | draggable="false" | 42 | draggable="false" |
| 43 | ondragstart="return false;" | 43 | ondragstart="return false;" |
| 44 | (contextmenu)="false" | 44 | (contextmenu)="false" |
| 45 | class="col-12 h-50 align-self-end d-none d-sm-block rounded-circle" | 45 | class="col-12 h-50 align-self-end d-none d-sm-block rounded-circle" |
| 46 | src="assets/img/ir-color.svg"> | 46 | src="assets/img/ir-color.svg"> |
| 47 | <small class="col-12 px-0 my-1 h-25 align-self-end text-center text-truncate">Todos</small> | 47 | <small class="col-12 px-0 my-1 h-25 align-self-end text-center text-truncate">Todos</small> |
| 48 | </div> | 48 | </div> |
| 49 | <div | 49 | <div |
| 50 | class="row mx-4 mb-2 h-32 justify-content-center tab" | 50 | class="row mx-4 mb-2 h-32 justify-content-center tab catContent" |
| 51 | [ngClass]="{ 'active': categoria.selected, 'border-bottom-effect': !categoria.selected }" | 51 | [ngClass]="{ 'active': categoria.selected, 'border-bottom-effect': !categoria.selected, 'lash':mpActive }" |
| 52 | (click)="selectCategoria(i, categoria.id)" | 52 | (click)="selectCategoria(i, categoria.id)" |
| 53 | *ngFor="let categoria of categorias; let i = index;"> | 53 | *ngFor="let categoria of categorias; let i = index;" id=""> |
| 54 | <img | 54 | <img |
| 55 | draggable="false" | 55 | draggable="false" |
| 56 | ondragstart="return false;" | 56 | ondragstart="return false;" |
| 57 | (contextmenu)="false" | 57 | (contextmenu)="false" |
| 58 | class="col-12 h-50 align-self-end d-none d-sm-block rounded-circle" | 58 | class="col-12 h-50 align-self-end d-none d-sm-block rounded-circle" |
| 59 | src="assets/img/ir-color.svg"> | 59 | src="assets/img/ir-color.svg"> |
| 60 | <small class="col-12 px-0 my-1 h-25 align-self-end text-center text-truncate">{{categoria.detalle}}</small> | 60 | <small class="col-12 px-0 my-1 h-25 align-self-end text-center text-truncate">{{categoria.detalle}}</small> |
| 61 | </div> | 61 | </div> |
| 62 | </div> | 62 | </div> |
| 63 | <div class="col-auto btn-effect h-5 cat-btn"> | 63 | <div class="col-auto btn-effect h-5 cat-btn"> |
| 64 | <img | 64 | <img |
| 65 | draggable="false" | 65 | draggable="false" |
| 66 | ondragstart="return false;" | 66 | ondragstart="return false;" |
| 67 | (contextmenu)="false" | 67 | (contextmenu)="false" |
| 68 | class="h-100 d-block mx-auto rotate-90" | 68 | class="h-100 d-block mx-auto rotate-90" |
| 69 | src="assets/img/ir-color.svg" | 69 | src="assets/img/ir-color.svg" |
| 70 | (mousedown)="scrollY(templateCategorias, 100)" | 70 | (mousedown)="scrollY(templateCategorias, 100)" |
| 71 | (mouseup)="mouseup()" | 71 | (mouseup)="mouseup()" |
| 72 | (mouseleave)="mouseup()"> | 72 | (mouseleave)="mouseup()"> |
| 73 | </div> | 73 | </div> |
| 74 | </div> | 74 | </div> |
| 75 | </div> | 75 | </div> |
| 76 | <!-- LISTA DE ARTICULOS --> | 76 | <!-- LISTA DE ARTICULOS --> |
| 77 | <div class="col-7 col-sm-9 col-xl-10 pb-3 h-80 align-self-center scroll-y-visible"> | 77 | <div class="col-7 col-sm-9 col-xl-10 pb-3 h-80 align-self-center scroll-y-visible"> |
| 78 | <div class="row row-cols-1 row-cols-sm-3 row-cols-xl-6"> | 78 | <div class="row row-cols-1 row-cols-sm-3 row-cols-xl-6"> |
| 79 | <!-- ARTICULO --> | 79 | <!-- ARTICULO --> |
| 80 | <div | 80 | <div |
| 81 | class="col px-2 my-1 my-md-3 h-auto" | 81 | class="col px-2 my-1 my-md-3 h-auto" |
| 82 | *ngFor="let articulo of auxArticulos | slice:0:showQuantity;"> | 82 | *ngFor="let articulo of auxArticulos | slice:0:showQuantity;"> |
| 83 | <div class="swing-in-top-fwd card h-auto"> | 83 | <div class="swing-in-top-fwd card h-auto"> |
| 84 | <img | 84 | <img |
| 85 | draggable="false" | 85 | draggable="false" |
| 86 | ondragstart="return false;" | 86 | ondragstart="return false;" |
| 87 | (contextmenu)="false" | 87 | (contextmenu)="false" |
| 88 | src="{{urlImagenes}}{{articulo.imagenes[0].imagen}}" | 88 | src="{{urlImagenes}}{{articulo.imagenes[0].imagen}}" |
| 89 | onerror="this.src='assets/img/image-not-found.jpg'" | 89 | onerror="this.src='assets/img/image-not-found.jpg'" |
| 90 | class="card-img-top h-55 rounded-sm"> | 90 | class="card-img-top h-55 rounded-sm"> |
| 91 | <div class="row mx-0 py-1 h-auto justify-content-center"> | 91 | <div class="row mx-0 py-1 h-auto justify-content-center"> |
| 92 | <p class="col-12 px-1 h6 h-auto text-primary text-center">{{articulo.DetArt}}</p> | 92 | <p class="col-12 px-1 h6 h-auto text-primary text-center">{{articulo.DetArt}}</p> |
| 93 | <p class="col-12 px-1 h-auto text-center line-height-sm"> | 93 | <p class="col-12 px-1 h-auto text-center line-height-sm"> |
| 94 | <small>{{articulo.DET_LAR}}</small> | 94 | <small>{{articulo.DET_LAR}}</small> |
| 95 | </p> | 95 | </p> |
| 96 | <div class="col-12 px-1 align-self-end btn-effect h-auto"> | 96 | <div class="col-12 px-1 align-self-end btn-effect h-auto"> |
| 97 | <div | 97 | <div |
| 98 | [ngClass]="{'bg-secondary': articulo.promo}" | 98 | [ngClass]="{'bg-secondary': articulo.promo}" |
| 99 | class="row mx-0 justify-content-between bg-primary badge-pill" | 99 | class="row mx-0 justify-content-between bg-primary badge-pill" |
| 100 | (click)="elegirArticulo(articulo)"> | 100 | (click)="elegirArticulo(articulo)"> |
| 101 | <div class="col px-0 align-self-center text-white text-right"> | 101 | <div class="col px-0 align-self-center text-white text-right"> |
| 102 | {{articulo.PreVen | currency}} | 102 | {{articulo.PreVen | currency}} |
| 103 | </div> | 103 | </div> |
| 104 | <div class="col-5 px-0"> | 104 | <div class="col-5 px-0"> |
| 105 | <img | 105 | <img |
| 106 | draggable="false" | 106 | draggable="false" |
| 107 | ondragstart="return false;" | 107 | ondragstart="return false;" |
| 108 | (contextmenu)="false" | 108 | (contextmenu)="false" |
| 109 | class="d-block ml-auto py-1 icon-30" | 109 | class="d-block ml-auto py-1 icon-30" |
| 110 | src="assets/img/ir.svg"> | 110 | src="assets/img/ir.svg"> |
| 111 | </div> | 111 | </div> |
| 112 | </div> | 112 | </div> |
| 113 | </div> | 113 | </div> |
| 114 | </div> | 114 | </div> |
| 115 | </div> | 115 | </div> |
| 116 | </div> | 116 | </div> |
| 117 | </div> | 117 | </div> |
| 118 | <!-- BOTON VER MAS --> | 118 | <!-- BOTON VER MAS --> |
| 119 | <div class="row mx-0"> | 119 | <div class="row mx-0"> |
| 120 | <div | 120 | <div |
| 121 | *ngIf="showQuantity <= auxArticulos.slice(0, showQuantity).length" | 121 | *ngIf="showQuantity <= auxArticulos.slice(0, showQuantity).length" |
| 122 | class="col-12 px-0 mb-2"> | 122 | class="col-12 px-0 mb-2"> |
| 123 | <button | 123 | <button |
| 124 | (click)="increaseShow()" | 124 | (click)="increaseShow()" |
| 125 | class="btn btn-block btn-outline-primary"> | 125 | class="btn btn-block btn-outline-primary"> |
| 126 | Ver Más | 126 | Ver Más |
| 127 | </button> | 127 | </button> |
| 128 | </div> | 128 | </div> |
| 129 | </div> | 129 | </div> |
| 130 | </div> | 130 | </div> |
| 131 | </div> | 131 | </div> |
| 132 | </div> | 132 | </div> |
| 133 | </div> | 133 | </div> |
| 134 | <!-- FOOTER CARRITO DE COMPRAS --> | 134 | <!-- FOOTER CARRITO DE COMPRAS --> |
| 135 | <div class="row w-90 mx-auto h-auto justify-content-center"> | 135 | <div class="row w-90 mx-auto h-auto justify-content-center"> |
| 136 | <div class="col-12 h-75 px-0 border border-primary rounded"> | 136 | <div class="h-75 px-0 border border-primary rounded" #boxCarrito [ngClass]="boxCarrito.classList.contains('lash') && articuloService.carrito.length ? 'col-8' : 'col-12'" id="boxCarrito"> |
| 137 | <!-- CABECERA --> | 137 | <!-- CABECERA --> |
| 138 | <div class="row mx-0 h-15 border-bottom border-primary"> | 138 | <div class="row mx-0 h-15 border-bottom border-primary"> |
| 139 | <p class="col align-self-center text-truncate"><small>ARTÍCULOS EN TÚ CARRITO DE COMPRAS</small></p> | 139 | <p class="col align-self-center text-truncate"><small>ARTÍCULOS EN TÚ CARRITO DE COMPRAS</small></p> |
| 140 | </div> | 140 | </div> |
| 141 | <!-- CUERPO --> | 141 | <!-- CUERPO --> |
| 142 | <div class="row h-85 mx-0 justify-content-around"> | 142 | <div class="row h-85 mx-0 justify-content-around"> |
| 143 | <!-- BOTON SCROLL IZQUIERDA --> | 143 | <!-- BOTON SCROLL IZQUIERDA --> |
| 144 | <div *ngIf="articuloService.carrito.length" class="col-auto btn-effect h-20 align-self-center"> | 144 | <div *ngIf="articuloService.carrito.length" class="col-auto btn-effect h-20 align-self-center"> |
| 145 | <img | 145 | <img |
| 146 | draggable="false" | 146 | draggable="false" |
| 147 | ondragstart="return false;" | 147 | ondragstart="return false;" |
| 148 | (contextmenu)="false" | 148 | (contextmenu)="false" |
| 149 | class="icon-30 rotate-180-neg" | 149 | class="icon-30 rotate-180-neg" |
| 150 | src="assets/img/ir-fondo-color.svg" | 150 | src="assets/img/ir-fondo-color.svg" |
| 151 | (mousedown)="scrollX(templateCarrito, -100)" | 151 | (mousedown)="scrollX(templateCarrito, -100)" |
| 152 | (mouseup)="mouseup()" | 152 | (mouseup)="mouseup()" |
| 153 | (mouseleave)="mouseup()"> | 153 | (mouseleave)="mouseup()"> |
| 154 | </div> | 154 | </div> |
| 155 | <!-- CARRITO --> | 155 | <!-- CARRITO --> |
| 156 | <div class="col-6 col-sm-8 col-md-9 col-lg-10 h-100"> | 156 | <div class="col-6 col-sm-8 col-md-9 col-lg-10 h-100"> |
| 157 | <div #templateCarrito class="row flex-row flex-nowrap h-100 mx-0 my-2 scroll-x"> | 157 | <div #templateCarrito class="row flex-row flex-nowrap h-100 mx-0 my-2 scroll-x"> |
| 158 | <!-- MENSAJE DE ADVERTENCIA --> | 158 | <!-- MENSAJE DE ADVERTENCIA --> |
| 159 | <div *ngIf="!articuloService.carrito.length" class="col h-100"> | 159 | <div *ngIf="!articuloService.carrito.length" class="col h-100"> |
| 160 | <p class="text-center py-5">No hay articulos en el carrito</p> | 160 | <p class="text-center py-5">No hay articulos en el carrito</p> |
| 161 | </div> | 161 | </div> |
| 162 | <!-- ARTICULOS --> | 162 | <!-- ARTICULOS --> |
| 163 | <div | 163 | <div |
| 164 | class="col-10 col-sm-4 col-lg-2 px-2 px-xl-4 align-self-center border-right border-primary" | 164 | class="col-10 col-sm-4 col-lg-2 px-2 px-xl-4 align-self-center border-right border-primary" |
| 165 | *ngFor="let articulo of articuloService.carrito; let i = index;"> | 165 | *ngFor="let articulo of articuloService.carrito; let i = index;"> |
| 166 | <div class="swing-in-top-fwd"> | 166 | <div class="swing-in-top-fwd"> |
| 167 | <img | 167 | <img |
| 168 | draggable="false" | 168 | draggable="false" |
| 169 | ondragstart="return false;" | 169 | ondragstart="return false;" |
| 170 | (contextmenu)="false" | 170 | (contextmenu)="false" |
| 171 | class="d-block img-fluid p-2 mx-auto rounded" | 171 | class="d-block img-fluid p-2 mx-auto rounded" |
| 172 | src="{{urlImagenes}}{{articulo.imagenes[0].imagen}}" | 172 | src="{{urlImagenes}}{{articulo.imagenes[0].imagen}}" |
| 173 | onerror="this.src='assets/img/image-not-found.jpg'"> | 173 | onerror="this.src='assets/img/image-not-found.jpg'"> |
| 174 | <p class="d-block mt-auto text-center text-primary text-truncate"> | 174 | <p class="d-block mt-auto text-center text-primary text-truncate"> |
| 175 | <small>{{articulo.DetArt}}</small> | 175 | <small>{{articulo.DetArt}}</small> |
| 176 | </p> | 176 | </p> |
| 177 | </div> | 177 | </div> |
| 178 | </div> | 178 | </div> |
| 179 | </div> | 179 | </div> |
| 180 | </div> | 180 | </div> |
| 181 | <!-- BOTON SCROLL DERECHA --> | 181 | <!-- BOTON SCROLL DERECHA --> |
| 182 | <div *ngIf="articuloService.carrito.length" class="col-auto btn-effect h-20 align-self-center"> | 182 | <div *ngIf="articuloService.carrito.length" class="col-auto btn-effect h-20 align-self-center"> |
| 183 | <img | 183 | <img |
| 184 | draggable="false" | 184 | draggable="false" |
| 185 | ondragstart="return false;" | 185 | ondragstart="return false;" |
| 186 | (contextmenu)="false" | 186 | (contextmenu)="false" |
| 187 | class="icon-30" | 187 | class="icon-30" |
| 188 | src="assets/img/ir-fondo-color.svg" | 188 | src="assets/img/ir-fondo-color.svg" |
| 189 | (mousedown)="scrollX(templateCarrito, 100)" | 189 | (mousedown)="scrollX(templateCarrito, 100)" |
| 190 | (mouseup)="mouseup()" | 190 | (mouseup)="mouseup()" |
| 191 | (mouseleave)="mouseup()"> | 191 | (mouseleave)="mouseup()"> |
| 192 | </div> | 192 | </div> |
| 193 | </div> | 193 | </div> |
| 194 | </div> | 194 | </div> |
| 195 | <!-- VER CARRITO Y TOTAL--> | 195 | <!-- VER CARRITO Y TOTAL--> |
| 196 | <div | 196 | <div |
| 197 | class="col-auto p-0 mt-2 ml-auto h-20" | 197 | class=" p-0 mt-2 ml-auto h-20" |
| 198 | *ngIf="articuloService.carrito.length"> | 198 | *ngIf="articuloService.carrito.length" |
| 199 | [ngClass]="boxCarrito.classList.contains('col-8') ? 'col-4' : 'col-auto'" | ||
| 200 | id="bagsCarrito"> | ||
| 199 | <div | 201 | <div |
| 200 | class="btn-effect col-auto align-self-center px-0 bg-white" | 202 | class="btn-effect col-auto align-self-center px-0 bg-white" |
| 201 | [routerLink]="['/carrito']"> | 203 | [routerLink]="['/carrito']"> |
| 202 | <div class="row justify-content-between mx-0"> | 204 | <div class="row justify-content-between mx-0"> |
| 203 | <div class="col-auto align-self-center text-primary">TOTAL</div> | 205 | <div class="col-auto align-self-center text-primary">TOTAL</div> |
| 204 | <div class="col-auto p-0 bg-primary d-none d-sm-block bg-total"> | 206 | <div class="col-auto p-0 bg-primary d-none d-sm-block bg-total"> |
| 205 | <p class="text-center text-white mt-1 py-1">{{articuloService.subTotal | currency}}</p> | 207 | <p class="text-center text-white mt-1 py-1">{{articuloService.subTotal | currency}}</p> |
| 206 | </div> | 208 | </div> |
| 207 | <div class="col-auto align-self-center text-primary ml-2 bg-light">VER CARRITO</div> | 209 | <div class="col-auto align-self-center text-primary ml-2 bg-light" |
| 208 | <div class="col-auto p-0 bg-primary d-none d-sm-block"> | 210 | [ngClass]="{'mt-4':boxCarrito.classList.contains('col-8')}" id="ver-car">VER CARRITO</div> |
| 211 | <div class="col-auto p-0 bg-primary d-none d-sm-block" | ||
| 212 | [ngClass]="{'mt-4':boxCarrito.classList.contains('col-8')}" id="img-car"> | ||
| 209 | <img | 213 | <img |
| 210 | draggable="false" | 214 | draggable="false" |
| 211 | ondragstart="return false;" | 215 | ondragstart="return false;" |
| 212 | (contextmenu)="false" | 216 | (contextmenu)="false" |
| 213 | class="p-2 icon-40" | 217 | class="p-2 icon-40" |
| 214 | src="assets/img/carrito.svg"> | 218 | src="assets/img/carrito.svg"> |
| 215 | </div> | 219 | </div> |
| 216 | </div> | 220 | </div> |
| 217 | </div> | 221 | </div> |
| 218 | </div> | 222 | </div> |
| 219 | 223 | ||
| 220 | </div> | 224 | </div> |
| 221 | </div> | 225 | </div> |
| 222 | 226 | ||
| 223 | </div> | 227 | </div> |
| 224 | 228 |
src/app/modules/seleccion-articulos/seleccion-articulos.component.scss
| 1 | $primary: #aa006b; | 1 | $primary: #aa006b; |
| 2 | 2 | ||
| 3 | .box-categorias { | 3 | .box-categorias { |
| 4 | height: calc(100% - 100px) !important; | 4 | height: calc(100% - 100px) !important; |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | .active { | 7 | .active { |
| 8 | background-color: white; | 8 | background-color: white; |
| 9 | border-bottom: 3px solid $primary !important; | 9 | border-bottom: 3px solid $primary !important; |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | .border-bottom-effect { | 12 | .border-bottom-effect { |
| 13 | border: none; | 13 | border: none; |
| 14 | position: relative; | 14 | position: relative; |
| 15 | &:hover { | 15 | &:hover { |
| 16 | border: none; | 16 | border: none; |
| 17 | } | 17 | } |
| 18 | &::after { | 18 | &::after { |
| 19 | content: ""; | 19 | content: ""; |
| 20 | position: absolute; | 20 | position: absolute; |
| 21 | width: 0px; | 21 | width: 0px; |
| 22 | height: 3px; | 22 | height: 3px; |
| 23 | left: 50%; | 23 | left: 50%; |
| 24 | bottom: 0; | 24 | bottom: 0; |
| 25 | background-color: $primary; | 25 | background-color: $primary; |
| 26 | transition: all ease-in-out 0.2s; | 26 | transition: all ease-in-out 0.2s; |
| 27 | } | 27 | } |
| 28 | &:hover::after { | 28 | &:hover::after { |
| 29 | width: 100%; | 29 | width: 100%; |
| 30 | left: 0; | 30 | left: 0; |
| 31 | } | 31 | } |
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | .card { | 34 | .card { |
| 35 | border: none; | 35 | border: none; |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | .line-height-sm { | 38 | .line-height-sm { |
| 39 | line-height: 1.2; | 39 | line-height: 1.2; |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | .bg-total { | 42 | .bg-total { |
| 43 | width: 110px; | 43 | width: 110px; |
| 44 | border-radius: 1.5rem; | 44 | border-radius: 1.5rem; |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | #content.lash{ | 47 | #content.lash{ |
| 48 | max-height: 60% !important; | 48 | max-height: 60% !important; |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | #catContent.lash{ | 51 | .catContent.lash{ |
| 52 | margin: 1.3rem 0.9rem !important; | 52 | margin: 1.3rem 0.9rem !important; |
| 53 | height: 60% !important; | 53 | height: 60% !important; |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | .cat-btn.lash{ | 56 | .cat-btn.lash{ |
| 57 | height: 7% !important; | 57 | height: 7% !important; |
| 58 | } | ||
| 58 | } |
src/app/modules/seleccion-articulos/seleccion-articulos.component.ts
| 1 | import { Component, OnInit } from '@angular/core'; | 1 | import { Component, OnInit } from '@angular/core'; |
| 2 | import { BsModalRef } from 'ngx-bootstrap/modal'; | 2 | import { BsModalRef } from 'ngx-bootstrap/modal'; |
| 3 | import { ArticuloService } from 'src/app/services/articulo/articulo.service'; | 3 | import { ArticuloService } from 'src/app/services/articulo/articulo.service'; |
| 4 | import { IArticulo } from 'src/app/interfaces/IArticulo'; | 4 | import { IArticulo } from 'src/app/interfaces/IArticulo'; |
| 5 | import { APP_SETTINGS } from 'src/etc/AppSettings'; | 5 | import { APP_SETTINGS } from 'src/etc/AppSettings'; |
| 6 | import { ICategoria } from 'src/app/interfaces/ICategoria'; | 6 | import { ICategoria } from 'src/app/interfaces/ICategoria'; |
| 7 | import { CategoriaService } from 'src/app/services/categoria/categoria.service'; | 7 | import { CategoriaService } from 'src/app/services/categoria/categoria.service'; |
| 8 | 8 | ||
| 9 | @Component({ | 9 | @Component({ |
| 10 | selector: 'app-seleccion-articulos', | 10 | selector: 'app-seleccion-articulos', |
| 11 | templateUrl: './seleccion-articulos.component.html', | 11 | templateUrl: './seleccion-articulos.component.html', |
| 12 | styleUrls: ['./seleccion-articulos.component.scss'] | 12 | styleUrls: ['./seleccion-articulos.component.scss'] |
| 13 | }) | 13 | }) |
| 14 | export class SeleccionArticulosComponent implements OnInit { | 14 | export class SeleccionArticulosComponent implements OnInit { |
| 15 | showSpinner = true; | 15 | showSpinner = true; |
| 16 | timeoutHandler: any; | 16 | timeoutHandler: any; |
| 17 | urlImagenes = `${APP_SETTINGS.apiDeboSuite}/imagenes/`; | 17 | urlImagenes = `${APP_SETTINGS.apiDeboSuite}/imagenes/`; |
| 18 | articulos: IArticulo[] = []; | 18 | articulos: IArticulo[] = []; |
| 19 | auxArticulos: IArticulo[] = []; | 19 | auxArticulos: IArticulo[] = []; |
| 20 | showQuantity = 100; | 20 | showQuantity = 100; |
| 21 | queMostrar = 'todos'; | 21 | queMostrar = 'todos'; |
| 22 | categoriaActive: number = null; | 22 | categoriaActive: number = null; |
| 23 | categorias: ICategoria[] = []; | 23 | categorias: ICategoria[] = []; |
| 24 | searchTerm = ''; | 24 | searchTerm = ''; |
| 25 | ordenandoByVendidos = true; | 25 | ordenandoByVendidos = true; |
| 26 | allActive = true; | 26 | allActive = true; |
| 27 | modalRef: BsModalRef; | 27 | modalRef: BsModalRef; |
| 28 | total: number = 0; | 28 | total: number = 0; |
| 29 | 29 | mpActive:boolean = false; | |
| 30 | constructor( | 30 | constructor( |
| 31 | public articuloService: ArticuloService, | 31 | public articuloService: ArticuloService, |
| 32 | private categoriaService: CategoriaService, | 32 | private categoriaService: CategoriaService, |
| 33 | ) { } | 33 | ) { } |
| 34 | 34 | ||
| 35 | |||
| 35 | ngOnInit() { | 36 | ngOnInit() { |
| 36 | this.getCategorias(); | 37 | this.getCategorias(); |
| 37 | if ($("body").hasClass("lash")) { | 38 | this.mediaPantalla(); |
| 38 | $("#catContent,#content,#headerPub,#headerPad,.cat-btn").addClass("lash"); | ||
| 39 | } | ||
| 40 | } | 39 | } |
| 41 | 40 | ||
| 42 | getCategorias() { | 41 | getCategorias() { |
| 43 | this.categoriaService.getCategorias() | 42 | this.categoriaService.getCategorias() |
| 44 | .subscribe((categorias: ICategoria[]) => { | 43 | .subscribe((categorias: ICategoria[]) => { |
| 45 | switch (this.queMostrar) { | 44 | switch (this.queMostrar) { |
| 46 | case 'todos': | 45 | case 'todos': |
| 47 | this.categorias = categorias; | 46 | this.categorias = categorias; |
| 48 | this.categoriaActive = 0; | 47 | this.categoriaActive = 0; |
| 49 | break; | 48 | break; |
| 50 | case 'promociones': | 49 | case 'promociones': |
| 51 | this.categorias = categorias; | 50 | this.categorias = categorias; |
| 52 | this.categoriaActive = 19; | 51 | this.categoriaActive = 19; |
| 53 | break; | 52 | break; |
| 54 | case 'ordenar': | 53 | case 'ordenar': |
| 55 | this.categorias = categorias.filter((categoria: ICategoria) => { | 54 | this.categorias = categorias.filter((categoria: ICategoria) => { |
| 56 | return categoria.ES_PEDIDO; | 55 | return categoria.ES_PEDIDO; |
| 57 | }); | 56 | }); |
| 58 | this.categoriaActive = 4; | 57 | this.categoriaActive = 4; |
| 59 | break; | 58 | break; |
| 60 | default: | 59 | default: |
| 61 | this.categorias = categorias; | 60 | this.categorias = categorias; |
| 62 | this.categoriaActive = 0; | 61 | this.categoriaActive = 0; |
| 63 | break; | 62 | break; |
| 64 | } | 63 | } |
| 65 | !localStorage.getItem('articulos') ? | 64 | !localStorage.getItem('articulos') ? |
| 66 | this.getProductos() : | 65 | this.getProductos() : |
| 67 | this.setProductos(); | 66 | this.setProductos(); |
| 68 | }); | 67 | }); |
| 69 | } | 68 | } |
| 70 | 69 | ||
| 71 | getProductos() { | 70 | getProductos() { |
| 72 | this.articuloService.getAll() | 71 | this.articuloService.getAll() |
| 73 | .subscribe((result: IArticulo[]) => { | 72 | .subscribe((result: IArticulo[]) => { |
| 74 | this.articuloService.setArticulosSinImagen(result); | 73 | this.articuloService.setArticulosSinImagen(result); |
| 75 | if (this.queMostrar === 'ordenar') { | 74 | if (this.queMostrar === 'ordenar') { |
| 76 | this.categorias.forEach((categoria: ICategoria) => { | 75 | this.categorias.forEach((categoria: ICategoria) => { |
| 77 | const tempArticulos = result.filter((articulo: IArticulo) => { | 76 | const tempArticulos = result.filter((articulo: IArticulo) => { |
| 78 | return articulo.categoria_selfservice === categoria.id; | 77 | return articulo.categoria_selfservice === categoria.id; |
| 79 | }); | 78 | }); |
| 80 | result = tempArticulos; | 79 | result = tempArticulos; |
| 81 | }); | 80 | }); |
| 82 | } | 81 | } |
| 83 | localStorage.setItem('articulos', JSON.stringify(result)); | 82 | localStorage.setItem('articulos', JSON.stringify(result)); |
| 84 | this.setProductos(); | 83 | this.setProductos(); |
| 85 | }, (error) => { | 84 | }, (error) => { |
| 86 | this.showSpinner = false; | 85 | this.showSpinner = false; |
| 87 | console.error(error); | 86 | console.error(error); |
| 88 | }); | 87 | }); |
| 89 | } | 88 | } |
| 90 | 89 | ||
| 91 | setProductos() { | 90 | setProductos() { |
| 92 | this.articulos = JSON.parse(localStorage.getItem('articulos')); | 91 | this.articulos = JSON.parse(localStorage.getItem('articulos')); |
| 93 | this.filterItems(); | 92 | this.filterItems(); |
| 94 | } | 93 | } |
| 95 | 94 | ||
| 96 | filterItems() { | 95 | filterItems() { |
| 97 | if (this.categoriaActive === 0) { | 96 | if (this.categoriaActive === 0) { |
| 98 | this.auxArticulos = this.articulos; | 97 | this.auxArticulos = this.articulos; |
| 99 | return; | 98 | return; |
| 100 | } | 99 | } |
| 101 | this.auxArticulos = this.articulos.filter(x => { | 100 | this.auxArticulos = this.articulos.filter(x => { |
| 102 | return x.categoria_selfservice === this.categoriaActive; | 101 | return x.categoria_selfservice === this.categoriaActive; |
| 103 | }); | 102 | }); |
| 104 | this.ordenar(); | 103 | this.ordenar(); |
| 105 | } | 104 | } |
| 106 | 105 | ||
| 107 | ordenar() { | 106 | ordenar() { |
| 108 | if (this.ordenandoByVendidos) { | 107 | if (this.ordenandoByVendidos) { |
| 109 | this.auxArticulos.sort((a, b) => { | 108 | this.auxArticulos.sort((a, b) => { |
| 110 | return b.cantidadVendida - a.cantidadVendida; | 109 | return b.cantidadVendida - a.cantidadVendida; |
| 111 | }); | 110 | }); |
| 112 | } | 111 | } |
| 113 | } | 112 | } |
| 114 | 113 | ||
| 115 | selectCategoria(index: number, idCategoria?: number) { | 114 | selectCategoria(index: number, idCategoria?: number) { |
| 116 | if (this.categoriaActive === idCategoria) return; | 115 | if (this.categoriaActive === idCategoria) return; |
| 117 | this.categoriaActive = idCategoria; | 116 | this.categoriaActive = idCategoria; |
| 118 | this.allActive = idCategoria === 0 ? true : false; | 117 | this.allActive = idCategoria === 0 ? true : false; |
| 119 | this.categorias.forEach((categoria, i) => { | 118 | this.categorias.forEach((categoria, i) => { |
| 120 | categoria.selected = index === i ? true : false; | 119 | categoria.selected = index === i ? true : false; |
| 121 | }); | 120 | }); |
| 122 | this.filterItems(); | 121 | this.filterItems(); |
| 123 | } | 122 | } |
| 124 | 123 | ||
| 125 | elegirArticulo(articulo: IArticulo) { | 124 | elegirArticulo(articulo: IArticulo) { |
| 126 | this.articuloService.getById(articulo.id) | 125 | this.articuloService.getById(articulo.id) |
| 127 | .subscribe((res: IArticulo) => { | 126 | .subscribe((res: IArticulo) => { |
| 128 | res.cantidad = 1; | 127 | res.cantidad = 1; |
| 129 | this.articuloService.setArticulo(res); | 128 | this.articuloService.setArticulo(res); |
| 130 | }, err => console.error(err)); | 129 | }, err => console.error(err)); |
| 131 | } | 130 | } |
| 132 | 131 | ||
| 133 | increaseShow() { | 132 | increaseShow() { |
| 134 | this.showQuantity += 100; | 133 | this.showQuantity += 100; |
| 135 | } | 134 | } |
| 136 | 135 | ||
| 137 | mouseup() { | 136 | mouseup() { |
| 138 | if (!this.timeoutHandler) return; | 137 | if (!this.timeoutHandler) return; |
| 139 | clearInterval(this.timeoutHandler); | 138 | clearInterval(this.timeoutHandler); |
| 140 | } | 139 | } |
| 141 | 140 | ||
| 142 | scrollY(el: HTMLElement, value) { | 141 | scrollY(el: HTMLElement, value) { |
| 143 | el.scroll({ behavior: 'smooth', top: value + el.scrollTop }); | 142 | el.scroll({ behavior: 'smooth', top: value + el.scrollTop }); |
| 144 | this.timeoutHandler = setInterval(() => { | 143 | this.timeoutHandler = setInterval(() => { |
| 145 | el.scroll({ behavior: 'smooth', top: value + el.scrollTop }); | 144 | el.scroll({ behavior: 'smooth', top: value + el.scrollTop }); |
| 146 | }, 500); | 145 | }, 500); |
| 147 | } | 146 | } |
| 148 | 147 | ||
| 149 | scrollX(el: HTMLElement, value) { | 148 | scrollX(el: HTMLElement, value) { |
| 150 | el.scroll({ behavior: 'smooth', left: value + el.scrollLeft }); | 149 | el.scroll({ behavior: 'smooth', left: value + el.scrollLeft }); |
| 151 | this.timeoutHandler = setInterval(() => { | 150 | this.timeoutHandler = setInterval(() => { |
| 152 | el.scroll({ behavior: 'smooth', left: value + el.scrollLeft }); | 151 | el.scroll({ behavior: 'smooth', left: value + el.scrollLeft }); |
| 153 | }, 500); | 152 | }, 500); |
| 154 | } | 153 | } |
| 154 | |||
| 155 | mediaPantalla(){ | ||
| 156 | if ($("body").hasClass("lash")) { | ||
| 157 | $(".catContent,#content,#headerPub,#headerPad,.cat-btn,#boxCarrito").addClass("lash"); | ||
| 158 | this.mpActive=true; | ||
| 159 | } | ||
| 160 | } | ||
| 161 | |||
| 155 | } | 162 | } |
src/app/shared/footer/footer.component.ts
| 1 | import { Component, OnInit } from '@angular/core'; | 1 | import { Component, OnInit } from '@angular/core'; |
| 2 | import { Location } from '@angular/common'; | 2 | import { Location } from '@angular/common'; |
| 3 | 3 | ||
| 4 | @Component({ | 4 | @Component({ |
| 5 | selector: 'app-footer', | 5 | selector: 'app-footer', |
| 6 | templateUrl: './footer.component.html', | 6 | templateUrl: './footer.component.html', |
| 7 | styleUrls: ['./footer.component.scss'] | 7 | styleUrls: ['./footer.component.scss'] |
| 8 | }) | 8 | }) |
| 9 | 9 | ||
| 10 | export class FooterComponent implements OnInit { | 10 | export class FooterComponent implements OnInit { |
| 11 | 11 | ||
| 12 | 12 | ||
| 13 | constructor(private location: Location) { | 13 | constructor(private location: Location) { |
| 14 | $(document).ready(function(){ | 14 | this.mediaPantalla(); |
| 15 | $("#test").click(function(){ | ||
| 16 | $("body,#card1,#card2,#content,#catContent,#headerPub,#headerPad,.cat-btn,#cancelImg,#cancelCard").toggleClass("lash"); | ||
| 17 | }); | ||
| 18 | }); | ||
| 19 | |||
| 20 | } | 15 | } |
| 21 | 16 | ||
| 22 | ngOnInit() {} | 17 | ngOnInit() {} |
| 23 | 18 | ||
| 24 | goBack() { | 19 | goBack() { |
| 25 | this.location.back(); | 20 | this.location.back(); |
| 26 | } | 21 | } |
| 22 | mediaPantalla(){ | ||
| 23 | $(document).ready(function(){ | ||
| 24 | $("#test").click(function(){ | ||
| 25 | $("body,#card1,#card2,#content,.catContent,#headerPub,#headerPad,.cat-btn,#boxCarrito,#cancelImg,#cancelCard,#carrito,#art-carrito").toggleClass("lash"); | ||
| 26 | $("#bagsCarrito").toggleClass(["col-auto","col-4"]); | ||
| 27 | $("#ver-car,#img-car").toggleClass("mt-4"); |