import { Component, OnInit } from '@angular/core';
import { NbDialogRef } from '@nebular/theme';
import { Contribution } from '../../../entity/contribution.model';
import { DropDownOption } from '../../../entity/dropDownOption';
import { AuthService } from '../../../services/auth.service';

@Component({
  selector: 'ngx-add-contribution-dlg',
  templateUrl: './add-contribution-dlg.component.html',
  styleUrls: ['./add-contribution-dlg.component.scss']
})
export class AddContributionDlgComponent implements OnInit {

  taskrOptions: DropDownOption[] = [];
  contribution: Contribution;
  constructor(
    private authService: AuthService,
    private dlgRef: NbDialogRef<AddContributionDlgComponent>
  ) { }

  ngOnInit(): void {
    this.contribution = { time: new Date() } as Contribution;
  }
  close() {
    this.dlgRef.close();
  }
  submit() {
    if (this.contribution.contributor && this.contribution.amount > 0) {
      this.dlgRef.close(this.contribution);
    }
  }

}
