import { Site } from 'src/app/core/interfaces/site/site'; import { Component, Input, OnInit, Output, EventEmitter } from '@angular/core'; import { OwlOptions } from 'ngx-owl-carousel-o'; @Component({ selector: 'app-list-sites', templateUrl: './list-sites.component.html', styleUrls: ['./list-sites.component.scss'], }) export class ListSitesComponent implements OnInit { @Input() sites!: Site[]; @Output() emitAllyId = new EventEmitter(); numberPages = [1, 2, 3, 4, 5, 6]; numberPages2 = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; pageSelect = 0; pageFin = 20; constructor() {} ngOnInit() {} handlePatternAllyId($event: number) { this.emitAllyId.emit($event); } avanzar() { if (this.pageSelect == 5 && this.numberPages[5] == 20) { return; } else { if (this.pageSelect == 5) { this.numberPages = this.numberPages.map(function (val) { return ++val; }); } else { this.pageSelect += 1; } } } retroceder() { if (this.pageSelect == 0 && this.numberPages[0] == 1) { return; } else { if (this.pageSelect == 0) { this.numberPages = this.numberPages.map(function (val) { return --val; }); } else { this.pageSelect -= 1; } } } newPage(index: number) { this.pageSelect = index; } }