import { Component, OnInit } from '@angular/core'; import { NbDialogRef } from '@nebular/theme'; import { DropDownOption } from '../../../entity/dropDownOption'; import { HappinessCost } from '../../../entity/happiness-cost.model'; import { AuthService } from '../../../services/auth.service'; @Component({ selector: 'ngx-add-new-cost-dlg', templateUrl: './add-new-cost-dlg.component.html', styleUrls: ['./add-new-cost-dlg.component.scss'] }) export class AddNewCostDlgComponent implements OnInit { taskrOptions: DropDownOption[] = []; task: HappinessCost; constructor( private authService: AuthService, private dlgRef: NbDialogRef ) { } ngOnInit(): void { this.task = new HappinessCost(); this.task.tasker = this.authService.userAccess.firstName; } close() { this.dlgRef.close(); } submit() { if (this.task.tasker && this.task.content && this.task.amount > 0) { this.dlgRef.close(this.task); } } }