From 142aea4c2fee3e7fd2f521c25f71cff0175f069b Mon Sep 17 00:00:00 2001 From: Ferdinand Zickner Date: Sun, 10 Feb 2019 20:24:19 +0100 Subject: [PATCH] fix initial values for new events. --- order-web-ui/app/event/PartyEdit.html | 235 +++++++++---------- order-web-ui/app/event/PartyEditComponent.ts | 14 +- 2 files changed, 119 insertions(+), 130 deletions(-) diff --git a/order-web-ui/app/event/PartyEdit.html b/order-web-ui/app/event/PartyEdit.html index 90c17d6..e7ec14f 100644 --- a/order-web-ui/app/event/PartyEdit.html +++ b/order-web-ui/app/event/PartyEdit.html @@ -85,15 +85,9 @@

Allgemeinen

-
- - - -
+
@@ -107,123 +101,120 @@

Allgemeinen

-
- -
diff --git a/order-web-ui/app/event/PartyEditComponent.ts b/order-web-ui/app/event/PartyEditComponent.ts index 07fa73e..e2e30ce 100644 --- a/order-web-ui/app/event/PartyEditComponent.ts +++ b/order-web-ui/app/event/PartyEditComponent.ts @@ -37,16 +37,21 @@ export class PartyEditComponent { this.party = this.routeParams.snapshot.data["party"]; this.condimentsStatistic = >this.routeParams.snapshot.data["condimentsStatistic"]; this.orders = >this.routeParams.snapshot.data["orders"]; + let condiments = >this.routeParams.snapshot.data["condiments"]; if (this.party === undefined) { this.party = new Party(); + this.party.blendStatistics = 50; + this.party.estimatedNumberOfPizzas = 8; this.orders = []; + for (let condiment of condiments) { + this.availableCondiments[condiment.id.value] = true; + } } else { for (let condimentId of this.party.condiments) { this.availableCondiments[condimentId.value] = true; } } - let condiments = >this.routeParams.snapshot.data["condiments"]; this.categories = ]>>CondimentCategoryService.groupCondimentsByCategory(condiments); for (let condiment of condiments) { this.condimentSettings[condiment.id.value] = { @@ -63,13 +68,6 @@ export class PartyEditComponent { return this.availableCondiments[condimentId.value] === true; } - changeEstimatedNumberOfPizzas(factor: number): void { - this.party.estimatedNumberOfPizzas = this.party.estimatedNumberOfPizzas + factor; - if (this.party.estimatedNumberOfPizzas < 0) { - this.party.estimatedNumberOfPizzas = 0; - } - } - blendCondimentStatistic(condiment: Condiment): number { let numberOfOrdersWithCondiment = 0; for (let order of this.orders) {