import { Component, Input, OnInit } from '@angular/core';
import {LoanModel} from '../models/loan.model';
import {LoanSummaryService} from '../service/loan_summary.service';
import {AuthService} from '../service/auth.service';
import {Router} from '@angular/router';
import {NotificationService} from '@progress/kendo-angular-notification';

@Component({
  selector: 'app-loan-single-row',
  templateUrl: './loan-single-row.component.html',
  styleUrls: ['./loan-single-row.component.scss']
})
export class LoanSingleRowComponent implements OnInit {
  @Input() public Loan: LoanModel = new LoanModel({});
  @Input() public Loading: boolean = false;
  constructor(private service: LoanSummaryService,
              private auth: AuthService,
              private router: Router,
              private notificationService: NotificationService) { }

  ngOnInit(): void {
  }

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

  public gotoSteps() {
    this.router.navigate(['loan-steps/', this.Loan.Id]).then();
  }

  public editLoan() {
    this.router.navigate(['edit-loan/', this.Loan.Id]).then();
  }
}
