seleccion-articulos.component.ts
1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import { Component, OnInit } from "@angular/core";
import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';
import { PromocionComponent } from 'src/app/shared/promocion/promocion.component';
@Component({
selector: "app-seleccion-articulos",
templateUrl: "./seleccion-articulos.component.html",
styleUrls: ["./seleccion-articulos.component.scss"]
})
export class SeleccionArticulosComponent implements OnInit {
timeoutHandler: any;
categorias = [
{ id: 1, selected: false },
{ id: 2, selected: false },
{ id: 3, selected: false },
{ id: 4, selected: false },
{ id: 5, selected: false },
{ id: 6, selected: false }
];
modalRef: BsModalRef;
constructor(
private modalService: BsModalService,
) { }
ngOnInit() { }
selectCategoria(index: number) {
this.categorias.forEach((categoria, i) => {
categoria.selected = index === i ? true : false;
});
}
elegirArticulo(articulo: any) {
if (articulo.promo) {
this.modalRef = this.modalService.show(PromocionComponent, {
class: 'custom-modal modal-dialog-centered',
ignoreBackdropClick: true,
})
}
}
mouseup() {
if (!this.timeoutHandler) return;
clearInterval(this.timeoutHandler);
}
scrollY(el: HTMLElement, value) {
el.scroll({ behavior: "smooth", top: value + el.scrollTop });
this.timeoutHandler = setInterval(() => {
el.scroll({ behavior: "smooth", top: value + el.scrollTop });
}, 500);
}
scrollX(el: HTMLElement, value) {
el.scroll({ behavior: "smooth", left: value + el.scrollLeft });
this.timeoutHandler = setInterval(() => {
el.scroll({ behavior: "smooth", left: value + el.scrollLeft });
}, 500);
}
}