blob: 409cf6cb7bcb35662350b666db56df338d6dd420 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
import { Component, OnInit } from '@angular/core';
import { CupboardService } from '../../services/cupboard.service';
import { NeedListComponent } from '../need-list/need-list.component';
import { HttpClient } from '@angular/common/http';
import { FormsModule } from '@angular/forms';
import { Need, GoalType } from '../../models/Need';
@Component({
selector: 'app-cupboard',
standalone: false,
templateUrl: './cupboard.component.html',
styleUrl: './cupboard.component.css'
})
export class CupboardComponent implements
OnInit {
need: Need = {
id: 0,
name: '',
maxGoal: 0,
type: GoalType.MONETARY,
filterAttributes: [],
current: 0
};
constructor(private cupboardService: CupboardService, private http: HttpClient) { }
ngOnInit(): void {
console.log('CupboardComponent.ngOnInit');
}
submit(form: any) {
console.log(form);
this.need.name = form.name;
this.need.id = form.id;
this.need.maxGoal = form.maxGoal;
this.need.type = GoalType[form.type as keyof typeof GoalType];
console.log(this.cupboardService.createNeed(this.need));
}
}
|