import { Component, OnInit } from '@angular/core';
import { PersonService } from '../../service/person.service';

@Component({
  selector: 'app-draw',
  templateUrl: './draw.component.html',
  styleUrls: ['./draw.component.scss'],
  providers: [
    PersonService
  ]
})
export class DrawComponent implements OnInit {
  public mrecord;

  public itemsPerPage: number = 12;
  public totalRecords: number = 10;
  public currentPage: number = 1;
  public offset: number = 0;
  public end: number = 0;

  constructor(
    public getPerson: PersonService

  ngOnInit() {
    this.getCommission(this.currentPage, this.itemsPerPage )
  }

  getCommission(page, pagesize) {
    this.getPerson.myIncomeDetail(page, pagesize, 2).subscribe(data => {
      this.mrecord = data.d;
      this.totalRecords = data.d.total;
    })
  }

  pageChanged(event) {
    this.getCommission(event.page + 1 ,this.itemsPerPage)
  } 
}
  ) { }