From 45d016c89728cd4c267739d8c21603df79491106 Mon Sep 17 00:00:00 2001 From: piratefinn Date: Mon, 5 Mar 2018 13:33:26 +0000 Subject: [PATCH] added recurring purchase inputs --- src/app/dashboard/add-data.component.html | 63 ++++++++++++++++++----- src/app/dashboard/add-data.component.ts | 9 +++- 2 files changed, 59 insertions(+), 13 deletions(-) diff --git a/src/app/dashboard/add-data.component.html b/src/app/dashboard/add-data.component.html index dea50d2..46396fb 100644 --- a/src/app/dashboard/add-data.component.html +++ b/src/app/dashboard/add-data.component.html @@ -33,30 +33,69 @@ Tick if the purchase is deemed an essential purchase for budgeting purposes. +
+ +
+
+ +
+ Tick if the purchase frequently recurs, such as monthly. +
+
+
+ +
+
+
+
+ + +
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+ + +
+
+
+ Please give the period of time the purchase will recur from "Time of Transaction". +
+
- + +
- + +
- + +
diff --git a/src/app/dashboard/add-data.component.ts b/src/app/dashboard/add-data.component.ts index 94a0274..caf91e7 100644 --- a/src/app/dashboard/add-data.component.ts +++ b/src/app/dashboard/add-data.component.ts @@ -33,6 +33,8 @@ export class AddDataComponent implements OnInit { // Assumes Groceries is 1st category categoryId: number = 1; essentialPurchase = false; + recurringPurchase = false; + recurringType: string; transactionAdditionType = 1; storeList = []; showAddStore = false; @@ -174,7 +176,9 @@ export class AddDataComponent implements OnInit { transactionFormValidate() { if (this.submitOrg.name.length === 0 || this.submitOrg.town.length === 0 || - this.amount === 0 ) { + this.amount === 0 || + this.recurringPurchase && + this.recurringType === 0) { this.transactionFormInvalid = true; } else { this.transactionFormInvalid = false; @@ -195,6 +199,7 @@ export class AddDataComponent implements OnInit { organisation_id : this.organisationId, category : this.categoryId, essential : this.essentialPurchase, + recurring : this.recurringPurchase, }; break; case 2: @@ -204,6 +209,7 @@ export class AddDataComponent implements OnInit { purchase_time : purchaseTime, organisation_id : this.organisationId, essential : this.essentialPurchase, + recurring : this.recurringPurchase, }; break; case 3: @@ -216,6 +222,7 @@ export class AddDataComponent implements OnInit { town : this.submitOrg.town, postcode : this.submitOrg.postcode, essential : this.essentialPurchase, + recurring : this.recurringPurchase, }; break; }