Commit 136adf0401deb87176db9fcab10d40073738b6d4
Exists in
develop
Merge branch 'develop' of git.focasoftware.com:angular/autoservicio-axion
Showing
11 changed files
Show diff stats
src/app/modules/carrito/carrito.component.ts
... | ... | @@ -53,14 +53,6 @@ export class CarritoComponent implements OnInit, OnDestroy { |
53 | 53 | this.articuloService.deleteArticulo(index); |
54 | 54 | } |
55 | 55 | |
56 | - substractCant(articulo: IArticulo) { | |
57 | - this.articuloService.substractCant(articulo); | |
58 | - } | |
59 | - | |
60 | - addCant(articulo: IArticulo) { | |
61 | - this.articuloService.addCant(articulo); | |
62 | - } | |
63 | - | |
64 | 56 | goBack() { |
65 | 57 | this.location.back(); |
66 | 58 | } |
src/app/modules/info-formas-pago/info-formas-pago.component.html
... | ... | @@ -13,7 +13,7 @@ |
13 | 13 | <div class="row h-auto mt-6 mx-0 justify-content-center text-center"> |
14 | 14 | <div |
15 | 15 | [routerLink]="['/opcion-pedido']" |
16 | - class="col-11 col-sm-10 col-md-7 col-lg-4 p-5 m-5 h-auto | |
16 | + class="col-11 col-sm-10 col-md-7 p-5 m-5 h-auto | |
17 | 17 | btn-effect align-self-end border border-secondary rounded reduce-card-1"> |
18 | 18 | <img |
19 | 19 | draggable="false" |
... | ... | @@ -42,7 +42,7 @@ |
42 | 42 | </div> |
43 | 43 | </div> |
44 | 44 | <div |
45 | - class="col-11 col-sm-10 col-md-7 col-lg-4 p-5 m-5 h-auto align-self-center | |
45 | + class="col-11 col-sm-10 col-md-7 p-5 m-5 h-auto align-self-center | |
46 | 46 | btn-effect border border-primary rounded reduce-card-2" |
47 | 47 | (click)="openGoCaja(templateGoCaja)"> |
48 | 48 | <img |
src/app/modules/seleccion-articulos/filtro-categorias/filtro-categorias.component.html
... | ... | @@ -0,0 +1,59 @@ |
1 | +<!-- FILTRO CATEGORIAS --> | |
2 | + <p class="h6 h-6 m-0 text-center"><small>CATEGORÍAS</small></p> | |
3 | + <div class="row mx-0 h-94 justify-content-center align-items-center"> | |
4 | + <div class="col-auto btn-effect h-5 cat-btn"> | |
5 | + <img | |
6 | + draggable="false" | |
7 | + ondragstart="return false;" | |
8 | + (contextmenu)="false" | |
9 | + class="h-100 d-block mx-auto rotate-90-neg" | |
10 | + src="assets/img/ir-color.svg" | |
11 | + (mousedown)="scrollY(templateCategorias, -100)" | |
12 | + (mouseup)="mouseup()" | |
13 | + (mouseleave)="mouseup()"> | |
14 | + </div> | |
15 | + <!-- CATEGORIAS --> | |
16 | + <div | |
17 | + #templateCategorias | |
18 | + class="col-12 px-0 mx-0 box-categorias border border-primary py-1 | |
19 | + border-left-0 rounded-right scroll-y cat-box" | |
20 | + (scroll)="scrollEvent($event)"> | |
21 | + <div | |
22 | + class="row mx-2 mb-2 h-25 h-md-32 h-lg-45 justify-content-center tab cat-content" | |
23 | + [ngClass]="{ 'active rounded shadow px-2': allActive, 'border-bottom-effect': !allActive }" | |
24 | + (click)="selectCategoria(-1, 0)"> | |
25 | + <img | |
26 | + draggable="false" | |
27 | + ondragstart="return false;" | |
28 | + (contextmenu)="false" | |
29 | + class="col-12 img-fluid align-self-end d-none d-sm-block rounded-circle" | |
30 | + src="assets/img/logo-spot.svg"> | |
31 | + <small class="col-12 px-0 my-1 h-100 h-md-25 align-self-end text-center text-truncate">Todos</small> | |
32 | + </div> | |
33 | + <div | |
34 | + class="row mx-2 mb-2 h-25 h-md-32 h-lg-45 justify-content-center tab cat-content" | |
35 | + [ngClass]="{ 'active rounded shadow px-2': categoria.selected, 'border-bottom-effect': !categoria.selected }" | |
36 | + (click)="selectCategoria(i, categoria.id)" | |
37 | + *ngFor="let categoria of categorias; let i = index;"> | |
38 | + <img | |
39 | + draggable="false" | |
40 | + ondragstart="return false;" | |
41 | + (contextmenu)="false" | |
42 | + class="col-12 img-fluid align-self-end d-none d-sm-block rounded-circle" | |
43 | + src="{{urlImagenes}}{{categoria.path_imagen}}" | |
44 | + onerror="this.src='assets/img/image-not-found.jpg'"> | |
45 | + <small class="col-12 px-1 my-1 h-100 h-md-25 align-self-end text-center text-truncate">{{categoria.detalle}}</small> | |
46 | + </div> | |
47 | + </div> | |
48 | + <div class="col-auto btn-effect h-5 cat-btn"> | |
49 | + <img | |
50 | + draggable="false" | |
51 | + ondragstart="return false;" | |
52 | + (contextmenu)="false" | |
53 | + class="h-100 d-block mx-auto rotate-90" | |
54 | + src="assets/img/ir-color.svg" | |
55 | + (mousedown)="scrollY(templateCategorias, 100)" | |
56 | + (mouseup)="mouseup()" | |
57 | + (mouseleave)="mouseup()"> | |
58 | + </div> | |
59 | + </div> |
src/app/modules/seleccion-articulos/filtro-categorias/filtro-categorias.component.scss
... | ... | @@ -0,0 +1,54 @@ |
1 | +$primary: #aa006b; | |
2 | + | |
3 | +.box-categorias { | |
4 | + height: calc(100% - 100px) !important; | |
5 | +} | |
6 | + | |
7 | +.active { | |
8 | + transition: 0.3s; | |
9 | + background-color: white; | |
10 | + border-bottom: 3px solid $primary !important; | |
11 | + border-top: 3px solid $primary !important; | |
12 | + border-left: 3px solid $primary !important; | |
13 | + border-right: 3px solid $primary !important; | |
14 | +} | |
15 | + | |
16 | +.border-bottom-effect { | |
17 | + border: none; | |
18 | + position: relative; | |
19 | + &:hover { | |
20 | + border: none; | |
21 | + } | |
22 | + &::after { | |
23 | + content: ""; | |
24 | + position: absolute; | |
25 | + width: 0px; | |
26 | + height: 3px; | |
27 | + left: 50%; | |
28 | + bottom: 0; | |
29 | + background-color: $primary; | |
30 | + transition: all ease-in-out 0.2s; | |
31 | + } | |
32 | + &:hover::after { | |
33 | + width: 100%; | |
34 | + left: 0; | |
35 | + } | |
36 | +} | |
37 | + | |
38 | +.cat-content.media-pantalla { | |
39 | + margin: 0.5rem 0.7rem !important; | |
40 | + height: 76% !important; | |
41 | +} | |
42 | + | |
43 | +.cat-box.media-pantalla { | |
44 | + height: calc(100% - 85px) !important; | |
45 | +} | |
46 | + | |
47 | +.cat-btn.media-pantalla { | |
48 | + height: 7% !important; | |
49 | +} | |
50 | + | |
51 | +#content.media-pantalla, | |
52 | +#boxCarrito.media-pantalla { | |
53 | + max-height: 60% !important; | |
54 | +} |
src/app/modules/seleccion-articulos/filtro-categorias/filtro-categorias.component.spec.ts
... | ... | @@ -0,0 +1,25 @@ |
1 | +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | |
2 | + | |
3 | +import { FiltroCategoriasComponent } from './filtro-categorias.component'; | |
4 | + | |
5 | +describe('FiltroCategoriasComponent', () => { | |
6 | + let component: FiltroCategoriasComponent; | |
7 | + let fixture: ComponentFixture<FiltroCategoriasComponent>; | |
8 | + | |
9 | + beforeEach(async(() => { | |
10 | + TestBed.configureTestingModule({ | |
11 | + declarations: [ FiltroCategoriasComponent ] | |
12 | + }) | |
13 | + .compileComponents(); | |
14 | + })); | |
15 | + | |
16 | + beforeEach(() => { | |
17 | + fixture = TestBed.createComponent(FiltroCategoriasComponent); | |
18 | + component = fixture.componentInstance; | |
19 | + fixture.detectChanges(); | |
20 | + }); | |
21 | + | |
22 | + it('should create', () => { | |
23 | + expect(component).toBeTruthy(); | |
24 | + }); | |
25 | +}); |
src/app/modules/seleccion-articulos/filtro-categorias/filtro-categorias.component.ts
... | ... | @@ -0,0 +1,86 @@ |
1 | +import { Component, OnInit, Input, HostListener, Output, EventEmitter } from '@angular/core'; | |
2 | +import { ICategoria } from 'src/app/interfaces/ICategoria'; | |
3 | +import { InactiveScreenService } from 'src/app/services/inactive-screen/inactive-screen.service'; | |
4 | +import { CategoriaService } from 'src/app/services/categoria/categoria.service'; | |
5 | +import { APP_SETTINGS } from 'src/etc/AppSettings'; | |
6 | + | |
7 | +@Component({ | |
8 | + selector: 'app-filtro-categorias', | |
9 | + templateUrl: './filtro-categorias.component.html', | |
10 | + styleUrls: ['./filtro-categorias.component.scss'] | |
11 | +}) | |
12 | +export class FiltroCategoriasComponent implements OnInit { | |
13 | + @Output() getProductos = new EventEmitter<any>(); | |
14 | + @Output() setProductos = new EventEmitter<any>(); | |
15 | + @Output() filterItems = new EventEmitter<any>(); | |
16 | + categorias: ICategoria[] = []; | |
17 | + timeoutHandler: any; | |
18 | + categoriaActive = null; | |
19 | + allActive = true; | |
20 | + queMostrar = 'todos'; | |
21 | + urlImagenes = `${APP_SETTINGS.apiDeboSuite}/imagenes/`; | |
22 | + | |
23 | + constructor( | |
24 | + private categoriaService: CategoriaService, | |
25 | + private inactiveScreen: InactiveScreenService, | |
26 | + ) { } | |
27 | + | |
28 | + ngOnInit() { } | |
29 | + | |
30 | + getCategorias() { | |
31 | + this.categoriaService.getAll() | |
32 | + .subscribe((categorias: ICategoria[]) => { | |
33 | + switch (this.queMostrar) { | |
34 | + case 'todos': | |
35 | + this.categorias = categorias; | |
36 | + this.categoriaActive = 0; | |
37 | + break; | |
38 | + case 'promociones': | |
39 | + this.categorias = categorias; | |
40 | + this.categoriaActive = 19; | |
41 | + break; | |
42 | + case 'ordenar': | |
43 | + this.categorias = categorias.filter((categoria: ICategoria) => { | |
44 | + return categoria.ES_PEDIDO; | |
45 | + }); | |
46 | + this.categoriaActive = 4; | |
47 | + break; | |
48 | + default: | |
49 | + this.categorias = categorias; | |
50 | + this.categoriaActive = 0; | |
51 | + break; | |
52 | + } | |
53 | + !localStorage.getItem('articulos') ? | |
54 | + this.getProductos.emit() : | |
55 | + this.setProductos.emit(); | |
56 | + }); | |
57 | + } | |
58 | + | |
59 | + selectCategoria(index: number, idCategoria?: number) { | |
60 | + if (this.categoriaActive === idCategoria) return; | |
61 | + this.categoriaActive = idCategoria; | |
62 | + this.allActive = idCategoria === 0 ? true : false; | |
63 | + this.categorias.forEach((categoria, i) => { | |
64 | + categoria.selected = index === i ? true : false; | |
65 | + }); | |
66 | + this.filterItems.emit(); | |
67 | + } | |
68 | + | |
69 | + @HostListener('scroll', ['$event']) | |
70 | + scrollEvent(event: Event) { | |
71 | + clearTimeout(this.inactiveScreen.timerReposo); | |
72 | + this.inactiveScreen.startTimeOutInactividad(); | |
73 | + } | |
74 | + | |
75 | + mouseup() { | |
76 | + if (!this.timeoutHandler) return; | |
77 | + clearInterval(this.timeoutHandler); | |
78 | + } | |
79 | + | |
80 | + scrollY(el: HTMLElement, value) { | |
81 | + el.scroll({ behavior: 'smooth', top: value + el.scrollTop }); | |
82 | + this.timeoutHandler = setInterval(() => { | |
83 | + el.scroll({ behavior: 'smooth', top: value + el.scrollTop }); | |
84 | + }, 500); | |
85 | + } | |
86 | +} |
src/app/modules/seleccion-articulos/seleccion-articulos.component.html
... | ... | @@ -15,70 +15,13 @@ |
15 | 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 | - <!-- FILTRO CATEGORIAS --> | |
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> | |
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"> | |
23 | - <img | |
24 | - draggable="false" | |
25 | - ondragstart="return false;" | |
26 | - (contextmenu)="false" | |
27 | - class="h-100 d-block mx-auto rotate-90-neg" | |
28 | - src="assets/img/ir-color.svg" | |
29 | - (mousedown)="scrollY(templateCategorias, -100)" | |
30 | - (mouseup)="mouseup()" | |
31 | - (mouseleave)="mouseup()"> | |
32 | - </div> | |
33 | - <!-- CATEGORIAS --> | |
34 | - <div | |
35 | - #templateCategorias | |
36 | - class="col-12 px-0 mx-0 box-categorias border border-primary py-1 | |
37 | - border-left-0 rounded-right scroll-y cat-box" | |
38 | - (scroll)="scrollEvent($event)"> | |
39 | - <div | |
40 | - class="row mx-2 mb-2 h-25 h-md-32 h-lg-45 justify-content-center tab cat-content" | |
41 | - [ngClass]="{ 'active rounded shadow px-2': allActive, 'border-bottom-effect': !allActive, | |
42 | - 'media-pantalla' : boxCarrito.classList.contains('media-pantalla') }" | |
43 | - (click)="selectCategoria(-1, 0)"> | |
44 | - <img | |
45 | - draggable="false" | |
46 | - ondragstart="return false;" | |
47 | - (contextmenu)="false" | |
48 | - class="col-12 img-fluid align-self-end d-none d-sm-block rounded-circle" | |
49 | - src="assets/img/logo-spot.svg"> | |
50 | - <small class="col-12 px-0 my-1 h-100 h-md-25 align-self-end text-center text-truncate">Todos</small> | |
51 | - </div> | |
52 | - <div | |
53 | - class="row mx-2 mb-2 h-25 h-md-32 h-lg-45 justify-content-center tab cat-content" | |
54 | - [ngClass]="{ 'active rounded shadow px-2': categoria.selected, 'border-bottom-effect': !categoria.selected, | |
55 | - 'media-pantalla' : boxCarrito.classList.contains('media-pantalla') }" | |
56 | - (click)="selectCategoria(i, categoria.id)" | |
57 | - *ngFor="let categoria of categorias; let i = index;"> | |
58 | - <img | |
59 | - draggable="false" | |
60 | - ondragstart="return false;" | |
61 | - (contextmenu)="false" | |
62 | - class="col-12 img-fluid align-self-end d-none d-sm-block rounded-circle" | |
63 | - [ngClass]="{'media-pantalla' : boxCarrito.classList.contains('media-pantalla')}" | |
64 | - src="{{urlImagenes}}{{categoria.path_imagen}}" | |
65 | - onerror="this.src='assets/img/image-not-found.jpg'"> | |
66 | - <small class="col-12 px-1 my-1 h-100 h-md-25 align-self-end text-center text-truncate">{{categoria.detalle}}</small> | |
67 | - </div> | |
68 | - </div> | |
69 | - <div class="col-auto btn-effect h-5 cat-btn"> | |
70 | - <img | |
71 | - draggable="false" | |
72 | - ondragstart="return false;" | |
73 | - (contextmenu)="false" | |
74 | - class="h-100 d-block mx-auto rotate-90" | |
75 | - src="assets/img/ir-color.svg" | |
76 | - (mousedown)="scrollY(templateCategorias, 100)" | |
77 | - (mouseup)="mouseup()" | |
78 | - (mouseleave)="mouseup()"> | |
79 | - </div> | |
80 | - </div> | |
81 | - </div> | |
18 | + <app-filtro-categorias | |
19 | + class="col-5 col-sm-3 col-xl-2 h-100" | |
20 | + #filtroCategorias | |
21 | + (getProductos)="getProductos()" | |
22 | + (setProductos)="setProductos()" | |
23 | + (filterItems)="filterItems()"> | |
24 | + </app-filtro-categorias> | |
82 | 25 | <!-- LISTA DE ARTICULOS --> |
83 | 26 | <div |
84 | 27 | class="col-7 col-sm-9 col-xl-10 pb-3 h-100 align-self-center scroll-y-visible" |
src/app/modules/seleccion-articulos/seleccion-articulos.component.scss
1 | -$primary: #aa006b; | |
2 | - | |
3 | -.box-categorias { | |
4 | - height: calc(100% - 100px) !important; | |
5 | -} | |
6 | - | |
7 | -.active { | |
8 | - background-color: white; | |
9 | - border-bottom: 3px solid $primary !important; | |
10 | - border-top: 3px solid $primary !important; | |
11 | - border-left: 3px solid $primary !important; | |
12 | - border-right: 3px solid $primary !important; | |
13 | -} | |
14 | - | |
15 | -.border-bottom-effect { | |
16 | - border: none; | |
17 | - position: relative; | |
18 | - &:hover { | |
19 | - border: none; | |
20 | - } | |
21 | - &::after { | |
22 | - content: ""; | |
23 | - position: absolute; | |
24 | - width: 0px; | |
25 | - height: 3px; | |
26 | - left: 50%; | |
27 | - bottom: 0; | |
28 | - background-color: $primary; | |
29 | - transition: all ease-in-out 0.2s; | |
30 | - } | |
31 | - &:hover::after { | |
32 | - width: 100%; | |
33 | - left: 0; | |
34 | - } | |
35 | -} | |
36 | - | |
37 | -.card { | |
38 | - border: none; | |
39 | -} | |
40 | - | |
41 | -.line-height-sm { | |
42 | - line-height: 1.2; | |
43 | -} | |
44 | - | |
45 | -#content.media-pantalla,#boxCarrito.media-pantalla { | |
1 | +#content.media-pantalla, | |
2 | +#boxCarrito.media-pantalla { | |
46 | 3 | max-height: 60% !important; |
47 | 4 | } |
48 | - | |
49 | -.cat-content.media-pantalla { | |
50 | - margin: 0.5rem 0.7rem !important; | |
51 | - height: 76% !important; | |
52 | -} | |
53 | - | |
54 | -.cat-box.media-pantalla{ | |
55 | - height: calc(100% - 85px) !important; | |
56 | -} | |
57 | - | |
58 | -.cat-btn.media-pantalla { | |
59 | - height: 7% !important; | |
60 | -} |
src/app/modules/seleccion-articulos/seleccion-articulos.component.ts
1 | -import { Component, OnInit, OnDestroy, HostListener } from '@angular/core'; | |
1 | +import { Component, OnInit, OnDestroy, HostListener, ViewChild, ViewChildren, AfterViewInit } 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'; |
... | ... | @@ -11,6 +11,7 @@ import { InactiveScreenService } from 'src/app/services/inactive-screen/inactive |
11 | 11 | import { SinonimoService } from 'src/app/services/sinonimo/sinonimo.service'; |
12 | 12 | import { SinonimoComponent } from 'src/app/shared/sinonimo/sinonimo.component'; |
13 | 13 | import { trigger, state, style, transition, animate } from '@angular/animations'; |
14 | +import { FiltroCategoriasComponent } from './filtro-categorias/filtro-categorias.component'; | |
14 | 15 | |
15 | 16 | @Component({ |
16 | 17 | selector: 'app-seleccion-articulos', |
... | ... | @@ -29,21 +30,18 @@ import { trigger, state, style, transition, animate } from '@angular/animations' |
29 | 30 | ]) |
30 | 31 | ] |
31 | 32 | }) |
32 | -export class SeleccionArticulosComponent implements OnInit, OnDestroy { | |
33 | +export class SeleccionArticulosComponent implements OnInit, AfterViewInit, OnDestroy { | |
33 | 34 | showSpinner = true; |
34 | 35 | timeoutHandler: any; |
35 | 36 | urlImagenes = `${APP_SETTINGS.apiDeboSuite}/imagenes/`; |
36 | 37 | articulos: IArticulo[] = []; |
37 | 38 | auxArticulos: IArticulo[] = []; |
38 | 39 | showQuantity = 100; |
39 | - queMostrar = 'todos'; | |
40 | - categoriaActive = null; | |
41 | - categorias: ICategoria[] = []; | |
42 | 40 | searchTerm = ''; |
43 | 41 | ordenandoByVendidos = true; |
44 | - allActive = true; | |
45 | 42 | modalRef: BsModalRef; |
46 | 43 | total = 0; |
44 | + @ViewChild(FiltroCategoriasComponent, { static: false }) filtroCategorias: FiltroCategoriasComponent; | |
47 | 45 | |
48 | 46 | constructor( |
49 | 47 | public articuloService: ArticuloService, |
... | ... | @@ -53,8 +51,10 @@ export class SeleccionArticulosComponent implements OnInit, OnDestroy { |
53 | 51 | private inactiveScreen: InactiveScreenService, |
54 | 52 | ) { } |
55 | 53 | |
56 | - ngOnInit() { | |
57 | - this.getCategorias(); | |
54 | + ngOnInit() { } | |
55 | + | |
56 | + ngAfterViewInit(): void { | |
57 | + this.filtroCategorias.getCategorias(); | |
58 | 58 | this.mediaPantalla(); |
59 | 59 | } |
60 | 60 | |
... | ... | @@ -64,41 +64,12 @@ export class SeleccionArticulosComponent implements OnInit, OnDestroy { |
64 | 64 | } |
65 | 65 | } |
66 | 66 | |
67 | - getCategorias() { | |
68 | - this.categoriaService.getAll() | |
69 | - .subscribe((categorias: ICategoria[]) => { | |
70 | - switch (this.queMostrar) { | |
71 | - case 'todos': | |
72 | - this.categorias = categorias; | |
73 | - this.categoriaActive = 0; | |
74 | - break; | |
75 | - case 'promociones': | |
76 | - this.categorias = categorias; | |
77 | - this.categoriaActive = 19; | |
78 | - break; | |
79 | - case 'ordenar': | |
80 | - this.categorias = categorias.filter((categoria: ICategoria) => { | |
81 | - return categoria.ES_PEDIDO; | |
82 | - }); | |
83 | - this.categoriaActive = 4; | |
84 | - break; | |
85 | - default: | |
86 | - this.categorias = categorias; | |
87 | - this.categoriaActive = 0; | |
88 | - break; | |
89 | - } | |
90 | - !localStorage.getItem('articulos') ? | |
91 | - this.getProductos() : | |
92 | - this.setProductos(); | |
93 | - }); | |
94 | - } | |
95 | - | |
96 | 67 | getProductos() { |
97 | 68 | this.articuloService.getAll() |
98 | 69 | .subscribe((result: IArticulo[]) => { |
99 | 70 | this.articuloService.setArticulosSinImagen(result); |
100 | - if (this.queMostrar === 'ordenar') { | |
101 | - this.categorias.forEach((categoria: ICategoria) => { | |
71 | + if (this.filtroCategorias.queMostrar === 'ordenar') { | |
72 | + this.filtroCategorias.categorias.forEach((categoria: ICategoria) => { | |
102 | 73 | const tempArticulos = result.filter((articulo: IArticulo) => { |
103 | 74 | return articulo.categoria_selfservice === categoria.id; |
104 | 75 | }); |
... | ... | @@ -119,12 +90,12 @@ export class SeleccionArticulosComponent implements OnInit, OnDestroy { |
119 | 90 | } |
120 | 91 | |
121 | 92 | filterItems() { |
122 | - if (this.categoriaActive === 0) { | |
93 | + if (this.filtroCategorias.categoriaActive === 0) { | |
123 | 94 | this.auxArticulos = this.articulos; |
124 | 95 | return; |
125 | 96 | } |
126 | 97 | this.auxArticulos = this.articulos.filter(x => { |
127 | - return x.categoria_selfservice === this.categoriaActive; | |
98 | + return x.categoria_selfservice === this.filtroCategorias.categoriaActive; | |
128 | 99 | }); |
129 | 100 | this.ordenar(); |
130 | 101 | } |
... | ... | @@ -137,16 +108,6 @@ export class SeleccionArticulosComponent implements OnInit, OnDestroy { |
137 | 108 | } |
138 | 109 | } |
139 | 110 | |
140 | - selectCategoria(index: number, idCategoria?: number) { | |
141 | - if (this.categoriaActive === idCategoria) return; | |
142 | - this.categoriaActive = idCategoria; | |
143 | - this.allActive = idCategoria === 0 ? true : false; | |
144 | - this.categorias.forEach((categoria, i) => { | |
145 | - categoria.selected = index === i ? true : false; | |
146 | - }); | |
147 | - this.filterItems(); | |
148 | - } | |
149 | - | |
150 | 111 | selectArticulo(articulo: IArticulo) { |
151 | 112 | this.getByID(articulo.id); |
152 | 113 | } |
... | ... | @@ -208,14 +169,6 @@ export class SeleccionArticulosComponent implements OnInit, OnDestroy { |
208 | 169 | this.articuloService.deleteArticulo(index); |
209 | 170 | } |
210 | 171 | |
211 | - substractCant(articulo: IArticulo) { | |
212 | - this.articuloService.substractCant(articulo); | |
213 | - } | |
214 | - | |
215 | - addCant(articulo: IArticulo) { | |
216 | - this.articuloService.addCant(articulo); | |
217 | - } | |
218 | - | |
219 | 172 | increaseShow() { |
220 | 173 | this.showQuantity += 100; |
221 | 174 | } |
... | ... | @@ -247,7 +200,9 @@ export class SeleccionArticulosComponent implements OnInit, OnDestroy { |
247 | 200 | |
248 | 201 | mediaPantalla() { |
249 | 202 | if ($('body').hasClass('media-pantalla')) { |
250 | - $('.cat-content,#content,.cat-btn,#boxCarrito,.cat-box,.img-categoria').addClass('media-pantalla').addBack('media-pantalla'); | |
203 | + $('.cat-content,#content,.cat-btn,#boxCarrito,.cat-box,.img-categoria') | |
204 | + .addClass('media-pantalla') | |
205 | + .addBack('media-pantalla'); | |
251 | 206 | } |
252 | 207 | } |
253 | 208 | } |
src/app/modules/seleccion-articulos/seleccion-articulos.module.ts
... | ... | @@ -11,6 +11,7 @@ import { SinonimoComponent } from 'src/app/shared/sinonimo/sinonimo.component'; |
11 | 11 | import { FormsModule } from '@angular/forms'; |
12 | 12 | import { ConfirmacionComponent } from 'src/app/shared/confirmacion/confirmacion.component'; |
13 | 13 | import { ArticuloCantidadComponent } from 'src/app/shared/articulo-cantidad/articulo-cantidad.component'; |
14 | +import { FiltroCategoriasComponent } from './filtro-categorias/filtro-categorias.component'; | |
14 | 15 | |
15 | 16 | @NgModule({ |
16 | 17 | declarations: [ |
... | ... | @@ -20,6 +21,7 @@ import { ArticuloCantidadComponent } from 'src/app/shared/articulo-cantidad/arti |
20 | 21 | SinonimoComponent, |
21 | 22 | ConfirmacionComponent, |
22 | 23 | ArticuloCantidadComponent, |
24 | + FiltroCategoriasComponent, | |
23 | 25 | ], |
24 | 26 | imports: [ |
25 | 27 | CommonModule, |