import { Component, OnInit } from '@angular/core';
import {Observable} from 'rxjs';
import {TopBrokerModel} from '../models/top-broker.model';
import {HttpClient} from '@angular/common/http';
import {AuthService} from '../service/auth.service';

@Component({
  selector: 'app-chart-top-brokers',
  templateUrl: './chart-top-brokers.component.html',
  styleUrls: ['./chart-top-brokers.component.scss']
})
export class ChartTopBrokersComponent implements OnInit {

  gridData: Observable<TopBrokerModel[]>;
  constructor(private http: HttpClient, private auth: AuthService) { }

  ngOnInit(): void {
    this.gridData = this.http.get<TopBrokerModel[]>(this.auth.getUrl('chart/top-broker'));
  }

  private photoURL(peopleId: any): string {
    const url = this.auth.getUrl('avatar/') + peopleId;
    return 'url("' + url + '")';
  }
}
