From c3666978e0eef9eeb52d4e383a98d3ef075c37da Mon Sep 17 00:00:00 2001 From: Chris Undercoffer Date: Sat, 7 Dec 2019 16:42:26 -0500 Subject: Add base component for shopping cart --- .../src/app/shopping-cart/shopping-cart.component.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 recipeBuddy/src/app/shopping-cart/shopping-cart.component.ts (limited to 'recipeBuddy/src/app/shopping-cart/shopping-cart.component.ts') diff --git a/recipeBuddy/src/app/shopping-cart/shopping-cart.component.ts b/recipeBuddy/src/app/shopping-cart/shopping-cart.component.ts new file mode 100644 index 0000000..4430081 --- /dev/null +++ b/recipeBuddy/src/app/shopping-cart/shopping-cart.component.ts @@ -0,0 +1,18 @@ +import { Component, OnInit } from '@angular/core'; + + + + + +@Component({ + selector: 'shopping-cart.component', + templateUrl: './shopping-cart.component.html', + styleUrls: ['./shopping-cart.component.css'] +}) +export class ShoppingCartComponent implements OnInit { + + constructor() { } + + ngOnInit() { + } +} -- cgit v1.1 From ed1c7d95398c90263db74937a780e71f43475012 Mon Sep 17 00:00:00 2001 From: Chris Undercoffer Date: Wed, 11 Dec 2019 15:23:04 -0500 Subject: add shoppingcart base functionality can add items but not remove, not able to print list yet --- .../app/shopping-cart/shopping-cart.component.ts | 45 +++++++++++++++++++++- 1 file changed, 43 insertions(+), 2 deletions(-) (limited to 'recipeBuddy/src/app/shopping-cart/shopping-cart.component.ts') diff --git a/recipeBuddy/src/app/shopping-cart/shopping-cart.component.ts b/recipeBuddy/src/app/shopping-cart/shopping-cart.component.ts index 4430081..7c3f6fa 100644 --- a/recipeBuddy/src/app/shopping-cart/shopping-cart.component.ts +++ b/recipeBuddy/src/app/shopping-cart/shopping-cart.component.ts @@ -1,5 +1,8 @@ import { Component, OnInit } from '@angular/core'; - +import { MatSelectModule } from '@angular/material/select'; +import { MatDividerModule } from '@angular/material/divider'; +import { BackendService } from '../REST_service/backend.service'; +import { FormsModule } from '@angular/forms'; @@ -10,9 +13,47 @@ import { Component, OnInit } from '@angular/core'; styleUrls: ['./shopping-cart.component.css'] }) export class ShoppingCartComponent implements OnInit { + + recipes: Recipe[] = []; + ingredients : Ingredient[] = []; + units: string[] = []; + amounts: number[] = []; + types: string[] = []; + rIDs: number[] = []; + + - constructor() { } + constructor( private restService: BackendService) { + + this.restService.getRecipes().subscribe( + res => { + var i: number; + for(i = 0; i < res.length; i++) { + this.restService.getRecipe(res[i]).subscribe( + res2 => { + this.recipes.push(res2) + }); + } + }); + + } + + ngOnInit() { } + + addAll(): void { + + } + addRecipe(id: number): void { + + } + addIngredient(ing: Ingredient): void { + this.ingredients.push(ing); + + } + printList(): void { + + } } -- cgit v1.1 From ecda7b74d1e52edc29493dcc15dec85a5ad0ef8f Mon Sep 17 00:00:00 2001 From: Chris Undercoffer Date: Wed, 11 Dec 2019 17:16:18 -0500 Subject: Add routing and imports for shopping cart --- recipeBuddy/src/app/shopping-cart/shopping-cart.component.ts | 3 +++ 1 file changed, 3 insertions(+) (limited to 'recipeBuddy/src/app/shopping-cart/shopping-cart.component.ts') diff --git a/recipeBuddy/src/app/shopping-cart/shopping-cart.component.ts b/recipeBuddy/src/app/shopping-cart/shopping-cart.component.ts index 7c3f6fa..26808ee 100644 --- a/recipeBuddy/src/app/shopping-cart/shopping-cart.component.ts +++ b/recipeBuddy/src/app/shopping-cart/shopping-cart.component.ts @@ -3,6 +3,9 @@ import { MatSelectModule } from '@angular/material/select'; import { MatDividerModule } from '@angular/material/divider'; import { BackendService } from '../REST_service/backend.service'; import { FormsModule } from '@angular/forms'; +import { Recipe } from '../DataModels/recipe'; +import { Ingredient } from '../DataModels/ingredient'; + -- cgit v1.1