Commit 748da0200c253a2db365e46e4795fcc8301f0028
Exists in
develop
merge conflicts
Showing
44 changed files
Show diff stats
package-lock.json
| ... | ... | @@ -1973,6 +1973,14 @@ |
| 1973 | 1973 | "@types/jasmine": "*" |
| 1974 | 1974 | } |
| 1975 | 1975 | }, |
| 1976 | + "@types/jquery": { | |
| 1977 | + "version": "3.3.31", | |
| 1978 | + "resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.3.31.tgz", | |
| 1979 | + "integrity": "sha512-Lz4BAJihoFw5nRzKvg4nawXPzutkv7wmfQ5121avptaSIXlDNJCUuxZxX/G+9EVidZGuO0UBlk+YjKbwRKJigg==", | |
| 1980 | + "requires": { | |
| 1981 | + "@types/sizzle": "*" | |
| 1982 | + } | |
| 1983 | + }, | |
| 1976 | 1984 | "@types/minimatch": { |
| 1977 | 1985 | "version": "3.0.3", |
| 1978 | 1986 | "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", |
| ... | ... | @@ -1997,6 +2005,11 @@ |
| 1997 | 2005 | "integrity": "sha512-lMC2G0ItF2xv4UCiwbJGbnJlIuUixHrioOhNGHSCsYCJ8l4t9hMCUimCytvFv7qy6AfSzRxhRHoGa+UqaqwyeA==", |
| 1998 | 2006 | "dev": true |
| 1999 | 2007 | }, |
| 2008 | + "@types/sizzle": { | |
| 2009 | + "version": "2.3.2", | |
| 2010 | + "resolved": "https://registry.npmjs.org/@types/sizzle/-/sizzle-2.3.2.tgz", | |
| 2011 | + "integrity": "sha512-7EJYyKTL7tFR8+gDbB6Wwz/arpGa0Mywk1TJbNzKzHtzbwVmY4HR9WqS5VV7dsBUKQmPNr192jHr/VpBluj/hg==" | |
| 2012 | + }, | |
| 2000 | 2013 | "@types/source-list-map": { |
| 2001 | 2014 | "version": "0.1.2", |
| 2002 | 2015 | "resolved": "https://registry.npmjs.org/@types/source-list-map/-/source-list-map-0.1.2.tgz", |
package.json
src/app/interfaces/IArticulo.ts
| ... | ... | @@ -14,6 +14,7 @@ export interface IArticulo { |
| 14 | 14 | FPP?: boolean; |
| 15 | 15 | id: number; |
| 16 | 16 | idSinonimo?: number; |
| 17 | + ID_SIN?: number; | |
| 17 | 18 | imagenes?: any[]; |
| 18 | 19 | ImpInt: number; |
| 19 | 20 | ImpInt2: number; |
| ... | ... | @@ -25,7 +26,10 @@ export interface IArticulo { |
| 25 | 26 | seleccionado?: boolean; |
| 26 | 27 | tieneSinonimo?: boolean; |
| 27 | 28 | tipo_articulo?: number; |
| 28 | - comentario?: string; | |
| 29 | + CODA?: number; | |
| 30 | + CODP?: number; | |
| 31 | + SECA?: number; | |
| 32 | + SECP?: number; | |
| 29 | 33 | } |
| 30 | 34 | |
| 31 | 35 | export interface ICodigoBarra { |
src/app/interfaces/ISinonimo.ts
src/app/modules/carrito/carrito.component.html
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | <!-- PUBLICIDADES --> |
| 3 | 3 | <app-header-publicidad></app-header-publicidad> |
| 4 | 4 | |
| 5 | - <div class="h-75"> | |
| 5 | + <div class="h-75 carrito-content"> | |
| 6 | 6 | <!-- CABECERA --> |
| 7 | 7 | <div class="row mx-3 h-auto border border-primary rounded-sm"> |
| 8 | 8 | <div class="col-12 px-0 py-2 align-self-center"> |
| ... | ... | @@ -22,7 +22,7 @@ |
| 22 | 22 | </div> |
| 23 | 23 | <!-- ARTICULOS --> |
| 24 | 24 | <div |
| 25 | - class="col-12 col-xl-6 p-2 h-50 h-md-25 h-xl-40 text-center text-truncate" | |
| 25 | + class="col-12 col-xl-6 p-2 h-50 h-md-25 h-xl-40 text-center text-truncate carrito-articulo" | |
| 26 | 26 | *ngFor="let articulo of articuloService.carrito; let i = index;" |
| 27 | 27 | @EnterLeave> |
| 28 | 28 | <!-- ARTICULO --> |
src/app/modules/carrito/carrito.component.scss
src/app/modules/carrito/carrito.component.ts
| ... | ... | @@ -42,6 +42,7 @@ export class CarritoComponent implements OnInit, OnDestroy { |
| 42 | 42 | this.router.navigate(['']); |
| 43 | 43 | return; |
| 44 | 44 | } |
| 45 | + this.mediaPantallaP(); | |
| 45 | 46 | } |
| 46 | 47 | |
| 47 | 48 | ngOnDestroy() { |
| ... | ... | @@ -49,8 +50,7 @@ export class CarritoComponent implements OnInit, OnDestroy { |
| 49 | 50 | } |
| 50 | 51 | |
| 51 | 52 | deleteArticulo(index: number) { |
| 52 | - this.articuloService.carrito.splice(index, 1); | |
| 53 | - this.articuloService.calcularTotal(); | |
| 53 | + this.articuloService.deleteArticulo(index); | |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | substractCant(articulo: IArticulo) { |
| ... | ... | @@ -75,4 +75,15 @@ export class CarritoComponent implements OnInit, OnDestroy { |
| 75 | 75 | this.inactiveScreen.startTimeOutInactividad(); |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | + @HostListener('scroll', ['$event']) | |
| 79 | + scrollEvent(event: Event) { | |
| 80 | + clearTimeout(this.inactiveScreen.timerReposo); | |
| 81 | + this.inactiveScreen.startTimeOutInactividad(); | |
| 82 | + } | |
| 83 | + | |
| 84 | + mediaPantallaP() { | |
| 85 | + if ($('body').hasClass('media-pantalla')) { | |
| 86 | + $('.carrito-content,.carrito-articulo').addClass('media-pantalla'); | |
| 87 | + } | |
| 88 | + } | |
| 78 | 89 | } |
src/app/modules/forma-pago/forma-pago.component.html
| ... | ... | @@ -18,7 +18,7 @@ |
| 18 | 18 | </div> |
| 19 | 19 | </div> |
| 20 | 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 reduce-card-1"> | |
| 22 | 22 | <div class="col-auto px-0 h-auto align-self-start"> |
| 23 | 23 | <div |
| 24 | 24 | class="btn-effect col-auto align-self-center px-0 bg-white" |
| ... | ... | @@ -46,7 +46,7 @@ |
| 46 | 46 | </div> |
| 47 | 47 | </div> |
| 48 | 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 reduce-card-2"> | |
| 50 | 50 | <div class="col-auto px-0 h-auto align-self-start"> |
| 51 | 51 | <div |
| 52 | 52 | class="btn-effect col-auto align-self-center px-0 bg-white" |
src/app/modules/forma-pago/forma-pago.component.scss
| ... | ... | @@ -0,0 +1,19 @@ |
| 1 | +.reduce-card-1.media-pantalla { | |
| 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 | +.reduce-card-2.media-pantalla { | |
| 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
| ... | ... | @@ -8,17 +8,17 @@ import { Router } from '@angular/router'; |
| 8 | 8 | styleUrls: ['./forma-pago.component.scss'] |
| 9 | 9 | }) |
| 10 | 10 | export class FormaPagoComponent implements OnInit { |
| 11 | - | |
| 12 | 11 | constructor( |
| 13 | 12 | private articuloService: ArticuloService, |
| 14 | - private router: Router, | |
| 15 | - ) { } | |
| 13 | + private router: Router | |
| 14 | + ) {} | |
| 16 | 15 | |
| 17 | 16 | ngOnInit() { |
| 18 | 17 | if (!this.articuloService.carrito.length) { |
| 19 | 18 | this.router.navigate(['']); |
| 20 | 19 | return; |
| 21 | 20 | } |
| 21 | + this.mediaPantalla(); | |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | medioPago(medioPago: number) { |
| ... | ... | @@ -33,4 +33,9 @@ export class FormaPagoComponent implements OnInit { |
| 33 | 33 | } |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | + mediaPantalla() { | |
| 37 | + if ($('body').hasClass('media-pantalla')) { | |
| 38 | + $('.reduce-card-1,.reduce-card-2').addClass('media-pantalla'); | |
| 39 | + } | |
| 40 | + } | |
| 36 | 41 | } |
src/app/modules/info-formas-pago/info-formas-pago.component.html
| ... | ... | @@ -11,7 +11,8 @@ |
| 11 | 11 | </div> |
| 12 | 12 | <div class="h-85"> |
| 13 | 13 | <div class="row h-auto mt-6 mx-0 justify-content-center text-center"> |
| 14 | - <div class="col-7 col-xl-4 p-5 m-5 h-auto align-self-end border border-secondary rounded"> | |
| 14 | + <div class="col-7 col-lg-4 p-5 m-5 h-auto align-self-end border | |
| 15 | + border-secondary rounded reduce-card-1"> | |
| 15 | 16 | <img |
| 16 | 17 | draggable="false" |
| 17 | 18 | ondragstart="return false;" |
| ... | ... | @@ -40,7 +41,8 @@ |
| 40 | 41 | src="assets/img/ir.svg"> |
| 41 | 42 | </div> |
| 42 | 43 | </div> |
| 43 | - <div class="col-7 col-xl-4 p-5 m-5 h-auto align-self-center border border-primary rounded"> | |
| 44 | + <div class="col-7 col-lg-4 p-5 m-5 h-auto align-self-center border | |
| 45 | + border-primary rounded reduce-card-2"> | |
| 44 | 46 | <img |
| 45 | 47 | draggable="false" |
| 46 | 48 | ondragstart="return false;" |
src/app/modules/info-formas-pago/info-formas-pago.component.scss
| 1 | 1 | .mt-6 { |
| 2 | 2 | margin-top: 4.5rem; |
| 3 | 3 | } |
| 4 | + | |
| 5 | +.reduce-card-1.media-pantalla { | |
| 6 | + position: absolute; | |
| 7 | + bottom: 0; | |
| 8 | + -webkit-box-flex: 0; | |
| 9 | + flex: 0 0 41.6666666667%; | |
| 10 | + max-width: 41.6666666667%; | |
| 11 | + left: 5%; | |
| 12 | + margin-left: 0 !important; | |
| 13 | +} | |
| 14 | + | |
| 15 | +.reduce-card-2.media-pantalla { | |
| 16 | + position: absolute; | |
| 17 | + bottom: 0; | |
| 18 | + -webkit-box-flex: 0; | |
| 19 | + flex: 0 0 41.6666666667%; | |
| 20 | + max-width: 41.6666666667%; | |
| 21 | + right: 5%; | |
| 22 | + margin-right: 0 !important; | |
| 23 | + height: 202px !important; | |
| 24 | +} |
src/app/modules/info-formas-pago/info-formas-pago.component.ts
| ... | ... | @@ -6,7 +6,17 @@ import { Component, OnInit } from '@angular/core'; |
| 6 | 6 | styleUrls: ['./info-formas-pago.component.scss'] |
| 7 | 7 | }) |
| 8 | 8 | export class InfoFormasPagoComponent implements OnInit { |
| 9 | - constructor() {} | |
| 9 | + mediaPantalla = false; | |
| 10 | 10 | |
| 11 | - ngOnInit() {} | |
| 11 | + constructor() { } | |
| 12 | + | |
| 13 | + ngOnInit() { | |
| 14 | + this.reducirPantalla(); | |
| 15 | + } | |
| 16 | + | |
| 17 | + reducirPantalla() { | |
| 18 | + if ($('body').hasClass('media-pantalla')) { | |
| 19 | + $('.reduce-card-1,.reduce-card-2').addClass('media-pantalla'); | |
| 20 | + } | |
| 21 | + } | |
| 12 | 22 | } |
src/app/modules/mensaje-final/mensaje-final.component.ts
| ... | ... | @@ -19,6 +19,7 @@ export class MensajeFinalComponent implements OnInit { |
| 19 | 19 | this.timer = setTimeout(() => { |
| 20 | 20 | this.goToSplash(); |
| 21 | 21 | }, 10000); |
| 22 | + this.mediaPantalla(); | |
| 22 | 23 | } |
| 23 | 24 | |
| 24 | 25 | OnDestroy() { |
| ... | ... | @@ -30,4 +31,9 @@ export class MensajeFinalComponent implements OnInit { |
| 30 | 31 | this.router.navigate(['']); |
| 31 | 32 | } |
| 32 | 33 | |
| 34 | + mediaPantalla() { | |
| 35 | + if ($('body').hasClass('media-pantalla')) { | |
| 36 | + $('body').removeClass('media-pantalla'); | |
| 37 | + } | |
| 38 | + } | |
| 33 | 39 | } |
src/app/modules/opcion-pedido/opcion-pedido.component.html
| ... | ... | @@ -16,7 +16,7 @@ |
| 16 | 16 | </div> |
| 17 | 17 | </div> |
| 18 | 18 | <div class="row mt-5 h-auto justify-content-center mx-0"> |
| 19 | - <div class="col-auto px-0 h-auto align-self-start"> | |
| 19 | + <div class="col-auto px-0 h-auto align-self-start reduce-card-1"> | |
| 20 | 20 | <div |
| 21 | 21 | class="btn-effect col-auto align-self-center px-0 bg-white" |
| 22 | 22 | (click)="goTo('/seleccion-articulos'); seleccionPedido('comer aca')"> |
| ... | ... | @@ -43,7 +43,7 @@ |
| 43 | 43 | </div> |
| 44 | 44 | </div> |
| 45 | 45 | <div class="row mt-4 h-auto justify-content-center mx-0"> |
| 46 | - <div class="col-auto px-0 h-auto align-self-start"> | |
| 46 | + <div class="col-auto px-0 h-auto align-self-start reduce-card-2"> | |
| 47 | 47 | <div |
| 48 | 48 | class="btn-effect col-auto align-self-center px-0 bg-white" |
| 49 | 49 | (click)="goTo('/seleccion-articulos'); seleccionPedido('para llevar')"> |
src/app/modules/opcion-pedido/opcion-pedido.component.scss
| ... | ... | @@ -0,0 +1,19 @@ |
| 1 | +.reduce-card-1.media-pantalla { | |
| 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 | +.reduce-card-2.media-pantalla { | |
| 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/opcion-pedido/opcion-pedido.component.ts
| ... | ... | @@ -13,6 +13,7 @@ export class OpcionPedidoComponent implements OnInit { |
| 13 | 13 | ) { } |
| 14 | 14 | |
| 15 | 15 | ngOnInit() { |
| 16 | + this.reducirPantalla(); | |
| 16 | 17 | } |
| 17 | 18 | |
| 18 | 19 | goTo(path) { |
| ... | ... | @@ -22,4 +23,10 @@ export class OpcionPedidoComponent implements OnInit { |
| 22 | 23 | seleccionPedido(lugar) { |
| 23 | 24 | localStorage.setItem('pedidoPara', lugar); |
| 24 | 25 | } |
| 26 | + | |
| 27 | + reducirPantalla() { | |
| 28 | + if ($('body').hasClass('media-pantalla')) { | |
| 29 | + $('.reduce-card-1,.reduce-card-2').addClass('media-pantalla'); | |
| 30 | + } | |
| 31 | + } | |
| 25 | 32 | } |
src/app/modules/pago-tarjeta/pago-tarjeta.component.html
| ... | ... | @@ -9,7 +9,7 @@ |
| 9 | 9 | src="assets/img/logo-spot.svg"> |
| 10 | 10 | </div> |
| 11 | 11 | </div> |
| 12 | - <div class="h-85"> | |
| 12 | + <div class="h-85 pago-tarjeta"> | |
| 13 | 13 | <div class="row h-50 mx-0 justify-content-center text-center"> |
| 14 | 14 | <div class="col-7 p-5 h-auto align-self-end border border-secondary rounded"> |
| 15 | 15 | <img |
src/app/modules/pago-tarjeta/pago-tarjeta.component.scss
src/app/modules/pago-tarjeta/pago-tarjeta.component.ts
| ... | ... | @@ -27,6 +27,12 @@ export class PagoTarjetaComponent implements OnInit { |
| 27 | 27 | this.articuloService.idComanda = res.data; |
| 28 | 28 | this.router.navigate(['mensaje-final']); |
| 29 | 29 | }, err => console.error(err)); |
| 30 | + this.mediaPantalla(); | |
| 30 | 31 | } |
| 31 | 32 | |
| 33 | + mediaPantalla() { | |
| 34 | + if ($('body').hasClass('media-pantalla')) { | |
| 35 | + $('.pago-tarjeta').addClass('media-pantalla'); | |
| 36 | + } | |
| 37 | + } | |
| 32 | 38 | } |
src/app/modules/seleccion-articulos/seleccion-articulos.component.html
| ... | ... | @@ -12,14 +12,14 @@ |
| 12 | 12 | </div> |
| 13 | 13 | </div> |
| 14 | 14 | <!-- CUERPO --> |
| 15 | - <div class="row w-100 mr-4 h-50 h-md-70"> | |
| 15 | + <div class="row w-100 mr-4 h-50 h-md-70" id="content"> | |
| 16 | 16 | <div class="col-12 h-100 px-0 py-3"> |
| 17 | 17 | <div class="row mx-0 h-100"> |
| 18 | 18 | <!-- FILTRO CATEGORIAS --> |
| 19 | 19 | <div class="col-5 col-sm-3 col-xl-2 h-100"> |
| 20 | 20 | <p class="h6 h-6 m-0 text-center"><small>CATEGORรAS</small></p> |
| 21 | 21 | <div class="row mx-0 h-94 justify-content-center align-items-center"> |
| 22 | - <div class="col-auto btn-effect h-5"> | |
| 22 | + <div class="col-auto btn-effect h-5 cat-btn"> | |
| 23 | 23 | <img |
| 24 | 24 | draggable="false" |
| 25 | 25 | ondragstart="return false;" |
| ... | ... | @@ -33,11 +33,13 @@ |
| 33 | 33 | <!-- CATEGORIAS --> |
| 34 | 34 | <div |
| 35 | 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 | |
| 37 | + border-left-0 rounded-right scroll-y cat-box" | |
| 37 | 38 | (scroll)="scrollEvent($event)"> |
| 38 | 39 | <div |
| 39 | - class="row mx-4 mb-2 h-25 h-md-32 h-lg-45 justify-content-center tab" | |
| 40 | - [ngClass]="{ 'active': allActive, 'border-bottom-effect': !allActive }" | |
| 40 | + class="row mx-4 mb-2 h-25 h-md-32 h-lg-45 justify-content-center tab cat-content" | |
| 41 | + [ngClass]="{ 'active': allActive, 'border-bottom-effect': !allActive, | |
| 42 | + 'media-pantalla' : boxCarrito.classList.contains('media-pantalla') }" | |
| 41 | 43 | (click)="selectCategoria(-1, 0)"> |
| 42 | 44 | <img |
| 43 | 45 | draggable="false" |
| ... | ... | @@ -48,21 +50,23 @@ |
| 48 | 50 | <small class="col-12 px-0 my-1 h-100 h-md-25 align-self-end text-center text-truncate">Todos</small> |
| 49 | 51 | </div> |
| 50 | 52 | <div |
| 51 | - class="row mx-4 mb-2 h-25 h-md-32 h-lg-45 justify-content-center tab" | |
| 52 | - [ngClass]="{ 'active': categoria.selected, 'border-bottom-effect': !categoria.selected }" | |
| 53 | + class="row mx-4 mb-2 h-25 h-md-32 h-lg-45 justify-content-center tab cat-content" | |
| 54 | + [ngClass]="{ 'active': categoria.selected, 'border-bottom-effect': !categoria.selected, | |
| 55 | + 'media-pantalla' : boxCarrito.classList.contains('media-pantalla') }" | |
| 53 | 56 | (click)="selectCategoria(i, categoria.id)" |
| 54 | 57 | *ngFor="let categoria of categorias; let i = index;"> |
| 55 | 58 | <img |
| 56 | 59 | draggable="false" |
| 57 | 60 | ondragstart="return false;" |
| 58 | 61 | (contextmenu)="false" |
| 59 | - class="col-12 h-50 align-self-end d-none d-sm-block rounded-circle" | |
| 62 | + class="col-12 h-50 align-self-end d-none d-sm-block rounded-circle img-categoria" | |
| 63 | + [ngClass]="{'media-pantalla' : boxCarrito.classList.contains('media-pantalla')}" | |
| 60 | 64 | src="{{urlImagenes}}{{categoria.path_imagen}}" |
| 61 | 65 | onerror="this.src='assets/img/image-not-found.jpg'"> |
| 62 | 66 | <small class="col-12 px-0 my-1 h-100 h-md-25 align-self-end text-center text-truncate">{{categoria.detalle}}</small> |
| 63 | 67 | </div> |
| 64 | 68 | </div> |
| 65 | - <div class="col-auto btn-effect h-5"> | |
| 69 | + <div class="col-auto btn-effect h-5 cat-btn"> | |
| 66 | 70 | <img |
| 67 | 71 | draggable="false" |
| 68 | 72 | ondragstart="return false;" |
| ... | ... | @@ -86,7 +90,7 @@ |
| 86 | 90 | *ngFor="let articulo of auxArticulos | slice:0:showQuantity;"> |
| 87 | 91 | <div |
| 88 | 92 | class="swing-in-top-fwd btn-effect card h-auto" |
| 89 | - (click)="elegirArticulo(articulo)"> | |
| 93 | + (click)="selectArticulo(articulo)"> | |
| 90 | 94 | <img |
| 91 | 95 | draggable="false" |
| 92 | 96 | ondragstart="return false;" |
| ... | ... | @@ -142,7 +146,9 @@ |
| 142 | 146 | </div> |
| 143 | 147 | <!-- FOOTER CARRITO DE COMPRAS --> |
| 144 | 148 | <div class="row w-90 mx-auto h-auto justify-content-center"> |
| 145 | - <div class="col-12 h-75 px-0 border border-primary rounded"> | |
| 149 | + <div class="h-75 px-0 border border-primary rounded" #boxCarrito | |
| 150 | + [ngClass]="boxCarrito.classList.contains('media-pantalla') | |
| 151 | + ? 'col-8' : 'col-12'" id="boxCarrito"> | |
| 146 | 152 | <!-- CABECERA --> |
| 147 | 153 | <div class="row mx-0 h-15 border-bottom border-primary"> |
| 148 | 154 | <p class="col align-self-center text-truncate"><small>ARTรCULOS EN Tร CARRITO DE COMPRAS</small></p> |
| ... | ... | @@ -222,7 +228,8 @@ |
| 222 | 228 | <!-- VER CARRITO --> |
| 223 | 229 | <div |
| 224 | 230 | class="col-auto px-0 mt-2 h-20" |
| 225 | - *ngIf="articuloService.carrito.length"> | |
| 231 | + *ngIf="articuloService.carrito.length" | |
| 232 | + [ngClass]="{'ml-auto pb-3' : boxCarrito.classList.contains('media-pantalla')}"> | |
| 226 | 233 | <div |
| 227 | 234 | class="btn-effect col-auto px-0 align-self-center bg-white" |
| 228 | 235 | [routerLink]="['/carrito']"> |
src/app/modules/seleccion-articulos/seleccion-articulos.component.scss
| ... | ... | @@ -38,3 +38,24 @@ $primary: #aa006b; |
| 38 | 38 | .line-height-sm { |
| 39 | 39 | line-height: 1.2; |
| 40 | 40 | } |
| 41 | + | |
| 42 | +#content.media-pantalla,#boxCarrito.media-pantalla { | |
| 43 | + max-height: 60% !important; | |
| 44 | +} | |
| 45 | + | |
| 46 | +.cat-content.media-pantalla { | |
| 47 | + margin: 0.5rem 0.7rem !important; | |
| 48 | + height: 76% !important; | |
| 49 | +} | |
| 50 | + | |
| 51 | +.cat-box.media-pantalla{ | |
| 52 | + height: calc(100% - 85px) !important; | |
| 53 | +} | |
| 54 | + | |
| 55 | +.cat-btn.media-pantalla { | |
| 56 | + height: 7% !important; | |
| 57 | +} | |
| 58 | + | |
| 59 | +.img-categoria.media-pantalla{ | |
| 60 | + min-height: 40px !important; | |
| 61 | +} | |
| 41 | 62 | \ No newline at end of file |
src/app/modules/seleccion-articulos/seleccion-articulos.component.ts
| 1 | -import { Component, OnInit, TemplateRef, OnDestroy, HostListener } from '@angular/core'; | |
| 1 | +import { Component, OnInit, OnDestroy, HostListener } from '@angular/core'; | |
| 2 | 2 | import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal'; |
| 3 | 3 | import { ArticuloService } from 'src/app/services/articulo/articulo.service'; |
| 4 | 4 | import { IArticulo } from 'src/app/interfaces/IArticulo'; |
| 5 | 5 | import { APP_SETTINGS } from 'src/etc/AppSettings'; |
| 6 | 6 | import { ICategoria } from 'src/app/interfaces/ICategoria'; |
| 7 | +import { ISinonimo } from 'src/app/interfaces/ISinonimo'; | |
| 7 | 8 | import { CategoriaService } from 'src/app/services/categoria/categoria.service'; |
| 8 | -import { PromocionService } from 'src/app/services/promocion/promocion.service'; | |
| 9 | 9 | import { PromocionComponent } from 'src/app/shared/promocion/promocion.component'; |
| 10 | 10 | import { InactiveScreenService } from 'src/app/services/inactive-screen/inactive-screen.service'; |
| 11 | +import { SinonimoService } from 'src/app/services/sinonimo/sinonimo.service'; | |
| 12 | +import { SinonimoComponent } from 'src/app/shared/sinonimo/sinonimo.component'; | |
| 11 | 13 | |
| 12 | 14 | @Component({ |
| 13 | 15 | selector: 'app-seleccion-articulos', |
| ... | ... | @@ -33,12 +35,14 @@ export class SeleccionArticulosComponent implements OnInit, OnDestroy { |
| 33 | 35 | constructor( |
| 34 | 36 | public articuloService: ArticuloService, |
| 35 | 37 | private categoriaService: CategoriaService, |
| 38 | + private sinonimoService: SinonimoService, | |
| 36 | 39 | private modalService: BsModalService, |
| 37 | 40 | private inactiveScreen: InactiveScreenService, |
| 38 | 41 | ) { } |
| 39 | 42 | |
| 40 | 43 | ngOnInit() { |
| 41 | 44 | this.getCategorias(); |
| 45 | + this.mediaPantalla(); | |
| 42 | 46 | } |
| 43 | 47 | |
| 44 | 48 | ngOnDestroy() { |
| ... | ... | @@ -128,35 +132,65 @@ export class SeleccionArticulosComponent implements OnInit, OnDestroy { |
| 128 | 132 | this.filterItems(); |
| 129 | 133 | } |
| 130 | 134 | |
| 131 | - elegirArticulo(articulo: IArticulo) { | |
| 132 | - if (!articulo.FPP) { | |
| 133 | - this.getByID(articulo.id); | |
| 134 | - } else { | |
| 135 | - this.openModalPromos(articulo); | |
| 136 | - } | |
| 135 | + selectArticulo(articulo: IArticulo) { | |
| 136 | + this.getByID(articulo.id); | |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | getByID(id: number) { |
| 140 | 140 | this.articuloService.getById(id) |
| 141 | 141 | .subscribe((res: IArticulo) => { |
| 142 | - res.cantidad = 1; | |
| 143 | - this.articuloService.setArticulo(res); | |
| 142 | + if (res.FPP) { | |
| 143 | + this.openModalPromos(res); | |
| 144 | + } else { | |
| 145 | + this.getSinonimos(res); | |
| 146 | + } | |
| 144 | 147 | }, err => console.error(err)); |
| 145 | 148 | } |
| 146 | 149 | |
| 150 | + getSinonimos(articulo: IArticulo) { | |
| 151 | + this.sinonimoService.getSinonimos(articulo.CodSec, articulo.CodArt) | |
| 152 | + .subscribe((res: ISinonimo[]) => { | |
| 153 | + if (res.length) { | |
| 154 | + this.openModalSinonimos(res, articulo); | |
| 155 | + } else { | |
| 156 | + this.articuloService.setArticulo(articulo); | |
| 157 | + } | |
| 158 | + }); | |
| 159 | + } | |
| 160 | + | |
| 147 | 161 | openModalPromos(articulo: IArticulo) { |
| 148 | - this.modalRef = this.modalService.show(PromocionComponent, | |
| 149 | - { | |
| 150 | - initialState: { | |
| 151 | - idArticulo: articulo.id | |
| 152 | - }, | |
| 153 | - class: 'modal-promo modal-dialog-centered' | |
| 162 | + this.modalRef = this.modalService.show(PromocionComponent, { | |
| 163 | + initialState: { articulosPromo: [articulo] }, | |
| 164 | + class: 'modal-promo modal-dialog-centered' | |
| 165 | + }); | |
| 166 | + } | |
| 167 | + | |
| 168 | + openModalSinonimos(sinonimosData: ISinonimo[], articulo: IArticulo) { | |
| 169 | + this.modalRef = this.modalService.show(SinonimoComponent, { | |
| 170 | + initialState: { sinonimos: sinonimosData }, | |
| 171 | + class: 'modal-promo modal-dialog-centered' | |
| 172 | + }); | |
| 173 | + | |
| 174 | + this.modalRef.content.onClose | |
| 175 | + .subscribe((res: any) => { | |
| 176 | + for (const a of articulo.productos) { | |
| 177 | + if (a.idSinonimo === res.ID_SIN) { | |
| 178 | + a.CODA = res.articulo.CodArt; | |
| 179 | + a.CodArt = res.articulo.CodArt; | |
| 180 | + a.SECA = res.articulo.CodSec; | |
| 181 | + a.CodSec = res.articulo.CodSec; | |
| 182 | + a.PreVen = res.articulo.PreVen; | |
| 183 | + a.id = res.articulo.id; | |
| 184 | + a.DET_LAR = res.articulo.DET_LAR; | |
| 185 | + a.DetArt = res.articulo.DetArt; | |
| 186 | + } | |
| 187 | + } | |
| 188 | + this.articuloService.setArticulo(articulo); | |
| 154 | 189 | }); |
| 155 | 190 | } |
| 156 | 191 | |
| 157 | 192 | deleteArticulo(index: number) { |
| 158 | - this.articuloService.carrito.splice(index, 1); | |
| 159 | - this.articuloService.calcularTotal(); | |
| 193 | + this.articuloService.deleteArticulo(index); | |
| 160 | 194 | } |
| 161 | 195 | |
| 162 | 196 | increaseShow() { |
| ... | ... | @@ -187,4 +221,10 @@ export class SeleccionArticulosComponent implements OnInit, OnDestroy { |
| 187 | 221 | el.scroll({ behavior: 'smooth', left: value + el.scrollLeft }); |
| 188 | 222 | }, 500); |
| 189 | 223 | } |
| 224 | + | |
| 225 | + mediaPantalla() { | |
| 226 | + if ($('body').hasClass('media-pantalla')) { | |
| 227 | + $('.cat-content,#content,.cat-btn,#boxCarrito,.cat-box,.img-categoria').addClass('media-pantalla').addBack('media-pantalla'); | |
| 228 | + } | |
| 229 | + } | |
| 190 | 230 | } |
src/app/modules/seleccion-articulos/seleccion-articulos.module.ts
| ... | ... | @@ -7,6 +7,8 @@ import { ModalModule } from 'ngx-bootstrap/modal'; |
| 7 | 7 | import { CarouselModule } from 'ngx-bootstrap/carousel'; |
| 8 | 8 | import { PromocionComponent } from 'src/app/shared/promocion/promocion.component'; |
| 9 | 9 | import { SharedModule } from '../shared/shared.module'; |
| 10 | +import { SinonimoComponent } from 'src/app/shared/sinonimo/sinonimo.component'; | |
| 11 | +import { FormsModule } from '@angular/forms'; | |
| 10 | 12 | import { ConfirmacionComponent } from 'src/app/shared/confirmacion/confirmacion.component'; |
| 11 | 13 | |
| 12 | 14 | @NgModule({ |
| ... | ... | @@ -14,16 +16,18 @@ import { ConfirmacionComponent } from 'src/app/shared/confirmacion/confirmacion. |
| 14 | 16 | SeleccionArticulosComponent, |
| 15 | 17 | HeaderPublicidadComponent, |
| 16 | 18 | PromocionComponent, |
| 19 | + SinonimoComponent, | |
| 17 | 20 | ConfirmacionComponent |
| 18 | 21 | ], |
| 19 | 22 | imports: [ |
| 20 | 23 | CommonModule, |
| 21 | 24 | SeleccionArticulosRoutingModule, |
| 25 | + FormsModule, | |
| 22 | 26 | ModalModule.forRoot(), |
| 23 | 27 | CarouselModule.forRoot(), |
| 24 | 28 | SharedModule |
| 25 | 29 | ], |
| 26 | 30 | exports: [HeaderPublicidadComponent], |
| 27 | - entryComponents: [PromocionComponent, ConfirmacionComponent] | |
| 31 | + entryComponents: [PromocionComponent, ConfirmacionComponent, SinonimoComponent] | |
| 28 | 32 | }) |
| 29 | 33 | export class SeleccionArticulosModule { } |
src/app/modules/shared/shared.module.ts
| 1 | 1 | import { NgModule, ModuleWithProviders } from '@angular/core'; |
| 2 | 2 | import { ArticuloService } from 'src/app/services/articulo/articulo.service'; |
| 3 | 3 | import { CategoriaService } from 'src/app/services/categoria/categoria.service'; |
| 4 | +import { SinonimoService } from 'src/app/services/sinonimo/sinonimo.service'; | |
| 4 | 5 | |
| 5 | 6 | @NgModule({}) |
| 6 | 7 | export class SharedModule { |
| ... | ... | @@ -9,7 +10,8 @@ export class SharedModule { |
| 9 | 10 | ngModule: SharedModule, |
| 10 | 11 | providers: [ |
| 11 | 12 | ArticuloService, |
| 12 | - CategoriaService | |
| 13 | + CategoriaService, | |
| 14 | + SinonimoService | |
| 13 | 15 | ] |
| 14 | 16 | }; |
| 15 | 17 | } |
src/app/modules/splash-screen/splash-screen.component.ts
| ... | ... | @@ -13,13 +13,13 @@ export class SplashScreenComponent implements OnInit { |
| 13 | 13 | textInvitamos = 'TE INVITAMOS A HACER'; |
| 14 | 14 | textTuPedido = 'tu pedido acรก'; |
| 15 | 15 | |
| 16 | - constructor() { } | |
| 16 | + constructor() {} | |
| 17 | 17 | |
| 18 | 18 | ngOnInit() { |
| 19 | 19 | localStorage.clear(); |
| 20 | 20 | setTimeout(() => { |
| 21 | 21 | this.showSplashScreen = false; |
| 22 | 22 | }, this.timerSplashScreen); |
| 23 | + $('body').removeClass('media-pantalla'); | |
| 23 | 24 | } |
| 24 | - | |
| 25 | 25 | } |
src/app/services/articulo/articulo.service.ts
| ... | ... | @@ -42,8 +42,9 @@ export class ArticuloService { |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | setArticulo(articulo: IArticulo) { |
| 45 | + articulo.cantidad = 1; | |
| 45 | 46 | for (const articuloCarrito of this.carrito) { |
| 46 | - if (articuloCarrito.id === articulo.id) { | |
| 47 | + if (articuloCarrito.id === articulo.id && !articulo.productos.length) { | |
| 47 | 48 | articuloCarrito.cantidad++; |
| 48 | 49 | this.calcularTotal(); |
| 49 | 50 | return; |
| ... | ... | @@ -54,6 +55,11 @@ export class ArticuloService { |
| 54 | 55 | this.calcularTotal(); |
| 55 | 56 | } |
| 56 | 57 | |
| 58 | + deleteArticulo(index: number) { | |
| 59 | + this.carrito.splice(index, 1); | |
| 60 | + this.calcularTotal(); | |
| 61 | + } | |
| 62 | + | |
| 57 | 63 | pay(dataPago: any) { |
| 58 | 64 | return new Observable((observer) => { |
| 59 | 65 | this.clienteService.getById(-1) |
src/app/services/sinonimo/sinonimo.service.ts
src/app/shared/confirmacion/confirmacion.component.ts
| 1 | 1 | import { Component, OnInit, HostListener } from '@angular/core'; |
| 2 | -import { ArticuloService } from 'src/app/services/articulo/articulo.service'; | |
| 3 | -import { IArticulo } from 'src/app/interfaces/IArticulo'; | |
| 4 | 2 | import { BsModalRef } from 'ngx-bootstrap/modal'; |
| 5 | 3 | import { InactiveScreenService } from 'src/app/services/inactive-screen/inactive-screen.service'; |
| 6 | 4 | import { Subject } from 'rxjs'; |
| 5 | +import { APP_SETTINGS } from 'src/etc/AppSettings'; | |
| 7 | 6 | |
| 8 | 7 | @Component({ |
| 9 | 8 | selector: 'app-confirmacion', |
| ... | ... | @@ -11,11 +10,14 @@ import { Subject } from 'rxjs'; |
| 11 | 10 | styleUrls: ['./confirmacion.component.scss'] |
| 12 | 11 | }) |
| 13 | 12 | export class ConfirmacionComponent implements OnInit { |
| 14 | - idArticulo: number; | |
| 15 | - imagenArticulo: any; | |
| 16 | - detLarArticulo: string; | |
| 17 | - preVenArticulo: any; | |
| 13 | + titleMessage: string; | |
| 14 | + imagenPath: any; | |
| 15 | + footerMessageFirst: string; | |
| 16 | + footerMessageSecond: string; | |
| 17 | + footerConfirmation: number; | |
| 18 | + footerClose: string; | |
| 18 | 19 | onClose: Subject<any>; |
| 20 | + urlImagenes = `${APP_SETTINGS.apiDeboSuite}/imagenes/`; | |
| 19 | 21 | |
| 20 | 22 | constructor( |
| 21 | 23 | public modalRef: BsModalRef, |
src/app/shared/footer/footer.component.html
| 1 | 1 | <div class="row w-90 mx-auto h-100 justify-content-between bg-white"> |
| 2 | 2 | <div class="col-auto align-self-center px-0 bg-white"> |
| 3 | - <div class="btn-effect row mx-0 bg-light"> | |
| 4 | - <div class="col-auto align-self-center text-primary">ESTAMOS PARA AYUDARTE</div> | |
| 3 | + <div class="btn-effect row mx-0 bg-light" (click)="reducirPantalla()"> | |
| 4 | + <div class="col-auto align-self-center text-primary">REDUCIR PANTALLA</div> | |
| 5 | 5 | <div class="col-auto p-0 bg-primary d-none d-sm-block"> |
| 6 | 6 | <img |
| 7 | 7 | draggable="false" |
src/app/shared/footer/footer.component.ts
| ... | ... | @@ -7,11 +7,31 @@ import { Location } from '@angular/common'; |
| 7 | 7 | styleUrls: ['./footer.component.scss'] |
| 8 | 8 | }) |
| 9 | 9 | export class FooterComponent implements OnInit { |
| 10 | - constructor(private location: Location) {} | |
| 10 | + constructor(private location: Location) { } | |
| 11 | 11 | |
| 12 | - ngOnInit() {} | |
| 12 | + ngOnInit() { } | |
| 13 | 13 | |
| 14 | 14 | goBack() { |
| 15 | 15 | this.location.back(); |
| 16 | 16 | } |
| 17 | + | |
| 18 | + reducirPantalla() { | |
| 19 | + $(` | |
| 20 | + body, | |
| 21 | + .reduce-card-1, | |
| 22 | + .reduce-card-2, | |
| 23 | + #content, | |
| 24 | + .cat-content, | |
| 25 | + .cat-btn, | |
| 26 | + .cat-box, | |
| 27 | + #boxCarrito, | |
| 28 | + #headerPublicidad, | |
| 29 | + #headerPad, | |
| 30 | + .img-categoria, | |
| 31 | + .carrito-articulo, | |
| 32 | + .carrito-content, | |
| 33 | + .pago-tarjeta, | |
| 34 | + .modal-promo`) | |
| 35 | + .toggleClass('media-pantalla'); | |
| 36 | + } | |
| 17 | 37 | } |
src/app/shared/header-publicidad/header-publicidad.component.html
src/app/shared/header-publicidad/header-publicidad.component.scss
src/app/shared/header-publicidad/header-publicidad.component.ts
| ... | ... | @@ -26,6 +26,7 @@ export class HeaderPublicidadComponent implements OnInit { |
| 26 | 26 | |
| 27 | 27 | ngOnInit() { |
| 28 | 28 | this.getPublicidades(); |
| 29 | + this.mediaPantalla(); | |
| 29 | 30 | } |
| 30 | 31 | |
| 31 | 32 | getPublicidades() { |
| ... | ... | @@ -67,7 +68,7 @@ export class HeaderPublicidadComponent implements OnInit { |
| 67 | 68 | { |
| 68 | 69 | initialState: { |
| 69 | 70 | titleMessage: articulo.DET_LAR, |
| 70 | - imagenPath: articulo.imagenes, | |
| 71 | + imagenPath: articulo.imagenes.length ? articulo.imagenes[0].imagen : '', | |
| 71 | 72 | footerMessageFirst: `ยฟDESEA AGREGAR ESTE ARTรCULO`, |
| 72 | 73 | footerMessageSecond: `a su carrito?`, |
| 73 | 74 | footerConfirmation: articulo.PreVen, |
| ... | ... | @@ -76,9 +77,13 @@ export class HeaderPublicidadComponent implements OnInit { |
| 76 | 77 | class: 'modal-promo modal-dialog-centered' |
| 77 | 78 | }); |
| 78 | 79 | this.modalRef.content.onClose.subscribe(() => { |
| 79 | - articulo.cantidad = 1; | |
| 80 | 80 | this.articuloService.setArticulo(articulo); |
| 81 | 81 | }); |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | + mediaPantalla() { | |
| 85 | + if ($('body').hasClass('media-pantalla')) { | |
| 86 | + $('#headerPublicidad,#headerPad').addClass('media-pantalla'); | |
| 87 | + } | |
| 88 | + } | |
| 84 | 89 | } |
src/app/shared/promocion/promocion.component.html
| ... | ... | @@ -6,7 +6,7 @@ |
| 6 | 6 | <div class="col-4 align-self-center"> |
| 7 | 7 | <div |
| 8 | 8 | class="row mx-0 justify-content-between bg-white badge-pill" |
| 9 | - (click)="elegirPromo(articulosPromo[0])"> | |
| 9 | + (click)="selectPromo(articulosPromo[0])"> | |
| 10 | 10 | <div class="col px-0 align-self-center text-primary"> |
| 11 | 11 | <p class="font-weight-bold">{{articulosPromo[0].PreVen | currency}}</p> |
| 12 | 12 | </div> |
| ... | ... | @@ -43,7 +43,7 @@ |
| 43 | 43 | (scroll)="scrollEvent($event)"> |
| 44 | 44 | <div class="col-12"> |
| 45 | 45 | <div *ngFor="let promo of promociones"> |
| 46 | - <div class="mx-0 mb-2 bg-white badge-pill text-primary" (click)="elegirPromo(promo)"> | |
| 46 | + <div class="mx-0 mb-2 bg-white badge-pill text-primary" (click)="selectPromo(promo)"> | |
| 47 | 47 | <div class="d-flex"> |
| 48 | 48 | <p class="text-truncate mr-auto my-auto"><small>{{promo.DetArt}}</small></p> |
| 49 | 49 | <p class="font-weight-bold my-auto pr-2"> |
src/app/shared/promocion/promocion.component.ts
| 1 | 1 | import { Component, OnInit, HostListener } from '@angular/core'; |
| 2 | -import { BsModalRef } from 'ngx-bootstrap/modal'; | |
| 2 | +import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal'; | |
| 3 | 3 | import { IArticulo } from 'src/app/interfaces/IArticulo'; |
| 4 | 4 | import { ArticuloService } from 'src/app/services/articulo/articulo.service'; |
| 5 | 5 | import { PromocionService } from 'src/app/services/promocion/promocion.service'; |
| 6 | 6 | import { Subject } from 'rxjs'; |
| 7 | 7 | import { APP_SETTINGS } from 'src/etc/AppSettings'; |
| 8 | 8 | import { InactiveScreenService } from 'src/app/services/inactive-screen/inactive-screen.service'; |
| 9 | +import { SinonimoService } from 'src/app/services/sinonimo/sinonimo.service'; | |
| 10 | +import { ISinonimo } from 'src/app/interfaces/ISinonimo'; | |
| 11 | +import { SinonimoComponent } from '../sinonimo/sinonimo.component'; | |
| 9 | 12 | |
| 10 | 13 | @Component({ |
| 11 | 14 | selector: 'app-promocion', |
| ... | ... | @@ -13,33 +16,63 @@ import { InactiveScreenService } from 'src/app/services/inactive-screen/inactive |
| 13 | 16 | styleUrls: ['./promocion.component.scss'] |
| 14 | 17 | }) |
| 15 | 18 | export class PromocionComponent implements OnInit { |
| 16 | - idArticulo: number; | |
| 17 | 19 | articulosPromo: IArticulo[] = []; |
| 18 | 20 | promociones: IArticulo[] = []; |
| 19 | 21 | onClose: Subject<any>; |
| 20 | 22 | urlImagenes = `${APP_SETTINGS.apiDeboSuite}/imagenes/`; |
| 21 | 23 | |
| 22 | 24 | constructor( |
| 23 | - public modalRef: BsModalRef, | |
| 25 | + public modalPromocion: BsModalRef, | |
| 26 | + private modalService: BsModalService, | |
| 24 | 27 | private articuloService: ArticuloService, |
| 25 | 28 | private promocionService: PromocionService, |
| 29 | + private sinonimoService: SinonimoService, | |
| 26 | 30 | private inactiveScreen: InactiveScreenService, |
| 27 | 31 | ) { |
| 28 | 32 | this.onClose = new Subject(); |
| 29 | 33 | } |
| 30 | 34 | |
| 31 | 35 | ngOnInit() { |
| 32 | - this.articuloService.getById(this.idArticulo) | |
| 33 | - .subscribe((res: IArticulo) => { | |
| 34 | - this.articulosPromo[0] = res; | |
| 35 | - this.getPromociones(); | |
| 36 | + this.getPromociones(); | |
| 37 | + } | |
| 38 | + | |
| 39 | + selectPromo(promo: IArticulo) { | |
| 40 | + this.sinonimoService.getSinonimos(promo.CodSec, promo.CodArt) | |
| 41 | + .subscribe((res: ISinonimo[]) => { | |
| 42 | + if (res.length) { | |
| 43 | + this.openModalSinonimos(res, promo); | |
| 44 | + } else { | |
| 45 | + promo.cantidad = 1; | |
| 46 | + this.articuloService.setArticulo(promo); | |
| 47 | + this.modalPromocion.hide(); | |
| 48 | + } | |
| 36 | 49 | }, err => console.error(err)); |
| 50 | + this.mediaPantalla(); | |
| 37 | 51 | } |
| 38 | 52 | |
| 39 | - elegirPromo(promo: IArticulo) { | |
| 40 | - promo.cantidad = 1; | |
| 41 | - this.articuloService.setArticulo(promo); | |
| 42 | - this.modalRef.hide(); | |
| 53 | + openModalSinonimos(sinonimosData: ISinonimo[], articulo: IArticulo) { | |
| 54 | + const modalSinonimo = this.modalService.show(SinonimoComponent, { | |
| 55 | + initialState: { sinonimos: sinonimosData }, | |
| 56 | + class: 'modal-promo modal-dialog-centered' | |
| 57 | + }); | |
| 58 | + | |
| 59 | + modalSinonimo.content.onClose | |
| 60 | + .subscribe((res: any) => { | |
| 61 | + for (const a of articulo.productos) { | |
| 62 | + if (a.idSinonimo === res.ID_SIN) { | |
| 63 | + a.CODA = res.articulo.CodArt; | |
| 64 | + a.CodArt = res.articulo.CodArt; | |
| 65 | + a.SECA = res.articulo.CodSec; | |
| 66 | + a.CodSec = res.articulo.CodSec; | |
| 67 | + a.PreVen = res.articulo.PreVen; | |
| 68 | + a.id = res.articulo.id; | |
| 69 | + a.DET_LAR = res.articulo.DET_LAR; | |
| 70 | + a.DetArt = res.articulo.DetArt; | |
| 71 | + } | |
| 72 | + } | |
| 73 | + this.articuloService.setArticulo(articulo); | |
| 74 | + this.modalPromocion.hide(); | |
| 75 | + }); | |
| 43 | 76 | } |
| 44 | 77 | |
| 45 | 78 | getPromociones() { |
| ... | ... | @@ -57,4 +90,15 @@ export class PromocionComponent implements OnInit { |
| 57 | 90 | this.inactiveScreen.startTimeOutInactividad(); |
| 58 | 91 | } |
| 59 | 92 | |
| 93 | + @HostListener('scroll', ['$event']) | |
| 94 | + scrollEvent(event: Event) { | |
| 95 | + clearTimeout(this.inactiveScreen.timerReposo); | |
| 96 | + this.inactiveScreen.startTimeOutInactividad(); | |
| 97 | + } | |
| 98 | + | |
| 99 | + mediaPantalla() { | |
| 100 | + if ($('body').hasClass('media-pantalla')) { | |
| 101 | + $('.modal-content').addClass('media-pantalla'); | |
| 102 | + } | |
| 103 | + } | |
| 60 | 104 | } |
src/app/shared/sinonimo/sinonimo.component.html
| ... | ... | @@ -0,0 +1,42 @@ |
| 1 | +<div class="bg-primary rounded text-white"> | |
| 2 | + <div class="modal-header"> | |
| 3 | + <p class="h4">Seleccione sinonimos</p> | |
| 4 | + </div> | |
| 5 | + | |
| 6 | + <div class="modal-body"> | |
| 7 | + <div | |
| 8 | + class="lista-sinonimos scroll-y-visible" | |
| 9 | + *ngFor="let s of sinonimos"> | |
| 10 | + <div *ngFor="let articulo of s.productos"> | |
| 11 | + <div class="custom-control custom-checkbox"> | |
| 12 | + <input | |
| 13 | + type="checkbox" | |
| 14 | + class="custom-control-input" | |
| 15 | + [(ngModel)]="articulo.seleccionado" | |
| 16 | + (click)="selectArticulo(articulo)" | |
| 17 | + [id]="articulo.id"> | |
| 18 | + <label | |
| 19 | + class="custom-control-label" | |
| 20 | + [for]="articulo.id"> | |
| 21 | + {{articulo.DET_LAR}} | |
| 22 | + </label> | |
| 23 | + </div> | |
| 24 | + </div> | |
| 25 | + </div> | |
| 26 | + </div> | |
| 27 | + | |
| 28 | + <div class="modal-footer"> | |
| 29 | + <div | |
| 30 | + [ngClass]="validate()" | |
| 31 | + class="d-inline-block py-1 btn-effect bg-white badge-pill text-primary" | |
| 32 | + (click)="continue()"> | |
| 33 | + CONTINUAR | |
| 34 | + <img | |
| 35 | + draggable="false" | |
| 36 | + ondragstart="return false;" | |
| 37 | + (contextmenu)="false" | |
| 38 | + class="icon-30" | |
| 39 | + src="assets/img/ir-color.svg"> | |
| 40 | + </div> | |
| 41 | + </div> | |
| 42 | +</div> |
src/app/shared/sinonimo/sinonimo.component.scss
src/app/shared/sinonimo/sinonimo.component.spec.ts
| ... | ... | @@ -0,0 +1,25 @@ |
| 1 | +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | |
| 2 | + | |
| 3 | +import { SinonimoComponent } from './sinonimo.component'; | |
| 4 | + | |
| 5 | +describe('SinonimoComponent', () => { | |
| 6 | + let component: SinonimoComponent; | |
| 7 | + let fixture: ComponentFixture<SinonimoComponent>; | |
| 8 | + | |
| 9 | + beforeEach(async(() => { | |
| 10 | + TestBed.configureTestingModule({ | |
| 11 | + declarations: [ SinonimoComponent ] | |
| 12 | + }) | |
| 13 | + .compileComponents(); | |
| 14 | + })); | |
| 15 | + | |
| 16 | + beforeEach(() => { | |
| 17 | + fixture = TestBed.createComponent(SinonimoComponent); | |
| 18 | + component = fixture.componentInstance; | |
| 19 | + fixture.detectChanges(); | |
| 20 | + }); | |
| 21 | + | |
| 22 | + it('should create', () => { | |
| 23 | + expect(component).toBeTruthy(); | |
| 24 | + }); | |
| 25 | +}); |
src/app/shared/sinonimo/sinonimo.component.ts
| ... | ... | @@ -0,0 +1,64 @@ |
| 1 | +import { Component, OnInit } from '@angular/core'; | |
| 2 | +import { ISinonimo } from 'src/app/interfaces/ISinonimo'; | |
| 3 | +import { IArticulo } from 'src/app/interfaces/IArticulo'; | |
| 4 | +import { BsModalRef } from 'ngx-bootstrap/modal'; | |
| 5 | +import { Subject } from 'rxjs'; | |
| 6 | +import { ArticuloService } from 'src/app/services/articulo/articulo.service'; | |
| 7 | + | |
| 8 | +@Component({ | |
| 9 | + selector: 'app-sinonimo', | |
| 10 | + templateUrl: './sinonimo.component.html', | |
| 11 | + styleUrls: ['./sinonimo.component.scss'] | |
| 12 | +}) | |
| 13 | +export class SinonimoComponent implements OnInit { | |
| 14 | + sinonimos: ISinonimo[] = []; | |
| 15 | + isValid: boolean; | |
| 16 | + onClose: Subject<any>; | |
| 17 | + articuloSelected: IArticulo; | |
| 18 | + | |
| 19 | + constructor( | |
| 20 | + private modalRef: BsModalRef, | |
| 21 | + private articuloService: ArticuloService, | |
| 22 | + ) { | |
| 23 | + this.onClose = new Subject(); | |
| 24 | + } | |
| 25 | + | |
| 26 | + ngOnInit() { | |
| 27 | + } | |
| 28 | + | |
| 29 | + selectArticulo(articulo: IArticulo) { | |
| 30 | + for (const s of this.sinonimos) { | |
| 31 | + for (const a of s.productos) { | |
| 32 | + a.seleccionado = false; | |
| 33 | + } | |
| 34 | + } | |
| 35 | + articulo.seleccionado = true; | |
| 36 | + this.articuloSelected = articulo; | |
| 37 | + } | |
| 38 | + | |
| 39 | + validate() { | |
| 40 | + this.isValid = false; | |
| 41 | + for (const s of this.sinonimos) { | |
| 42 | + for (const articulo of s.productos) { | |
| 43 | + if (articulo.seleccionado) { | |
| 44 | + this.isValid = true; | |
| 45 | + } | |
| 46 | + } | |
| 47 | + } | |
| 48 | + return !this.isValid ? 'disabled' : ''; | |
| 49 | + } | |
| 50 | + | |
| 51 | + continue() { | |
| 52 | + if (!this.isValid) return; | |
| 53 | + const ID_SIN = this.articuloSelected.ID_SIN; | |
| 54 | + this.articuloService.getById(this.articuloSelected.id) | |
| 55 | + .subscribe((res: IArticulo) => { | |
| 56 | + this.modalRef.hide(); | |
| 57 | + this.onClose.next({ | |
| 58 | + articulo: res, | |
| 59 | + ID_SIN | |
| 60 | + }); | |
| 61 | + }, err => console.error(err)); | |
| 62 | + } | |
| 63 | + | |
| 64 | +} |
src/etc/AppSettings.ejemplo.ts
src/scss/styles-bootstrap.scss
| ... | ... | @@ -40,9 +40,24 @@ $border-radius-sm: 0.5rem; |
| 40 | 40 | height: 100% !important; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | +.custom-checkbox .custom-control-input:checked ~ .custom-control-label::before { | |
| 44 | + background-color: $primary !important; | |
| 45 | +} | |
| 46 | + | |
| 47 | +.custom-control-input:checked ~ .custom-control-label::before { | |
| 48 | + border-color: $primary !important; | |
| 49 | + background-color: $primary !important; | |
| 50 | +} | |
| 51 | + | |
| 52 | +.custom-control-input:checked ~ .custom-control-label::before { | |
| 53 | + color: #fff; | |
| 54 | + border-color: $primary !important; | |
| 55 | + background-color: $primary !important; | |
| 56 | +} | |
| 57 | + | |
| 43 | 58 | .modal-promo > div { |
| 44 | 59 | border: none !important; |
| 45 | - border-radius: 10rem; | |
| 60 | + border-radius: $border-radius; | |
| 46 | 61 | margin-left: 10px !important; |
| 47 | 62 | } |
| 48 | 63 |
src/styles.scss
| ... | ... | @@ -73,3 +73,19 @@ p { |
| 73 | 73 | .rotate-180-neg { |
| 74 | 74 | transform: rotate(-180deg); |
| 75 | 75 | } |
| 76 | + | |
| 77 | +.disabled { | |
| 78 | + opacity: 0.5; | |
| 79 | +} | |
| 80 | + | |
| 81 | +body.media-pantalla { | |
| 82 | + height: 50% !important; | |
| 83 | + position: absolute; | |
| 84 | + bottom: 0; | |
| 85 | + width: 100%; | |
| 86 | +} | |
| 87 | + | |
| 88 | +.modal-content.media-pantalla { | |
| 89 | + margin-top: auto !important; | |
| 90 | + margin-bottom: 50px !important; | |
| 91 | +} |