import { Component, OnInit } from '@angular/core';
import { ClientsApiService } from '@fleio-api/client-user/client/clients-api.service';

@Component({
  selector: 'app-clients-panel',
  templateUrl: './clients-panel.component.html',
  styleUrls: ['./clients-panel.component.scss']
})
export class ClientsPanelComponent implements OnInit {
  tableData: {
    description: string;
    number: number;
  }[] = [];
  displayedColumns: string[] = ['description', 'number'];
  constructor(private clientsService: ClientsApiService) { }

  ngOnInit() {
    this.clientsService.getSummary().subscribe(response => {
      this.tableData.push({
        description: $localize`Total clients`,
        number: response.count
      });
      this.tableData.push({
        description: $localize`New clients`,
        number: response.new
      });
    });
  }

}
