import {Component, EventEmitter, Input, OnInit, Output, ViewChild} from '@angular/core';
import {ListAllLoansComponent} from '../list-all-loans/list-all-loans.component';
import {LoanModel} from '../models/loan.model';
import {RewardModel} from '../models/reward.model';

@Component({
  selector: 'app-reward-select',
  templateUrl: './reward-select.component.html',
  styleUrls: ['./reward-select.component.scss']
})
export class RewardSelectComponent implements OnInit {
  // @ViewChild('list', {static: false} ) list: list-all;
  @Input() Max = 1; // we do not support multiple loan selection at the moment
  @Input() readOnly = false;
  @Output() valueChange: EventEmitter<RewardModel[]> = new EventEmitter<RewardModel[]>();
  public Rewards: RewardModel[];

  // popup
  public showPopup = false;
  public Offset = { left: 10, top: 48 };

  constructor() { }

  ngOnInit(): void {
  }

  public onToggle(): void {
    this.showPopup = !this.showPopup;
  }
}
