From 45d016c89728cd4c267739d8c21603df79491106 Mon Sep 17 00:00:00 2001 From: piratefinn Date: Mon, 5 Mar 2018 13:33:26 +0000 Subject: [PATCH 1/6] 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; } From f5c0a7603224ec37f43945951dea37cbdf3a6f9f Mon Sep 17 00:00:00 2001 From: piratefinn Date: Mon, 5 Mar 2018 13:42:28 +0000 Subject: [PATCH 2/6] amended if code and validation --- src/app/dashboard/add-data.component.html | 12 ++++++------ src/app/dashboard/add-data.component.ts | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/app/dashboard/add-data.component.html b/src/app/dashboard/add-data.component.html index 46396fb..01789d7 100644 --- a/src/app/dashboard/add-data.component.html +++ b/src/app/dashboard/add-data.component.html @@ -48,29 +48,29 @@
- +
- +
- +
- +
- +
- +
diff --git a/src/app/dashboard/add-data.component.ts b/src/app/dashboard/add-data.component.ts index caf91e7..0bedfb4 100644 --- a/src/app/dashboard/add-data.component.ts +++ b/src/app/dashboard/add-data.component.ts @@ -178,7 +178,7 @@ export class AddDataComponent implements OnInit { this.submitOrg.town.length === 0 || this.amount === 0 || this.recurringPurchase && - this.recurringType === 0) { + !this.recurringType) { this.transactionFormInvalid = true; } else { this.transactionFormInvalid = false; From 6e9f4133d25e7dc82dd35b017035b2144e7736b8 Mon Sep 17 00:00:00 2001 From: piratefinn Date: Mon, 5 Mar 2018 15:35:26 +0000 Subject: [PATCH 3/6] amended upload for recurring --- src/app/dashboard/add-data.component.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/dashboard/add-data.component.ts b/src/app/dashboard/add-data.component.ts index 0bedfb4..2d9f7f7 100644 --- a/src/app/dashboard/add-data.component.ts +++ b/src/app/dashboard/add-data.component.ts @@ -199,7 +199,7 @@ export class AddDataComponent implements OnInit { organisation_id : this.organisationId, category : this.categoryId, essential : this.essentialPurchase, - recurring : this.recurringPurchase, + recurring : this.recurringType, }; break; case 2: @@ -209,7 +209,7 @@ export class AddDataComponent implements OnInit { purchase_time : purchaseTime, organisation_id : this.organisationId, essential : this.essentialPurchase, - recurring : this.recurringPurchase, + recurring : this.recurringType, }; break; case 3: @@ -222,7 +222,7 @@ export class AddDataComponent implements OnInit { town : this.submitOrg.town, postcode : this.submitOrg.postcode, essential : this.essentialPurchase, - recurring : this.recurringPurchase, + recurring : this.recurringType, }; break; } From 450b63620f5fecbe0d27353b0853430d2ae62eba Mon Sep 17 00:00:00 2001 From: piratefinn Date: Tue, 6 Mar 2018 15:19:35 +0000 Subject: [PATCH 4/6] added fixes for input --- src/app/dashboard/add-data.component.html | 4 ---- src/app/dashboard/add-data.component.ts | 3 +++ 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/app/dashboard/add-data.component.html b/src/app/dashboard/add-data.component.html index 01789d7..a756040 100644 --- a/src/app/dashboard/add-data.component.html +++ b/src/app/dashboard/add-data.component.html @@ -65,10 +65,6 @@
-
- - -
diff --git a/src/app/dashboard/add-data.component.ts b/src/app/dashboard/add-data.component.ts index 2d9f7f7..ae01d75 100644 --- a/src/app/dashboard/add-data.component.ts +++ b/src/app/dashboard/add-data.component.ts @@ -273,6 +273,9 @@ export class AddDataComponent implements OnInit { this.amount = null; this.transactionFormInvalid = true; this.showAddStore = false; + this.essentialPurchase = false; + this.recurringPurchase = false; + this.recurringType = null; } onSubmitPayroll() { From f6ef50f6866b785ca3be8a7d6d1710ba7b8054eb Mon Sep 17 00:00:00 2001 From: piratefinn Date: Wed, 7 Mar 2018 12:58:01 +0000 Subject: [PATCH 5/6] added fixes to category viewing --- .../dashboard/category-month.component.html | 24 +++++++++---------- src/app/dashboard/category-month.component.ts | 1 - 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/app/dashboard/category-month.component.html b/src/app/dashboard/category-month.component.html index 42a3d7a..7bb83db 100644 --- a/src/app/dashboard/category-month.component.html +++ b/src/app/dashboard/category-month.component.html @@ -9,8 +9,8 @@
-
    -
  • +
      +
    • Essential Purchases {{ ( weekEssential1.value || 0 ) | currency:'GBP':'symbol':'1.2-2' }} ({{ (weekEssential1.value || 0 ) / weekListValueSum1 | percent:'1.0-0' }}) @@ -32,7 +32,7 @@
-
+
  • @@ -51,8 +51,8 @@
    -
    -
    +
  • @@ -93,8 +93,8 @@
    -
    -
    +
  • @@ -135,8 +135,8 @@
    -
    -
    +
  • diff --git a/src/app/dashboard/category-month.component.ts b/src/app/dashboard/category-month.component.ts index 4c9fbc4..809e71f 100644 --- a/src/app/dashboard/category-month.component.ts +++ b/src/app/dashboard/category-month.component.ts @@ -94,7 +94,6 @@ export class CategoryMonthComponent implements OnInit { this.weekList4 = prop(data.data.categories, this.myWeek4); this.getMaxValue(this.weekList1, this.weekList2, this.weekList3, this.weekList4); this.weekEssential1 = prop(data.data.essentials, this.myWeek1); - console.log(this.weekEssential1); this.weekEssential2 = prop(data.data.essentials, this.myWeek2); this.weekEssential3 = prop(data.data.essentials, this.myWeek3); this.weekEssential4 = prop(data.data.essentials, this.myWeek4); From d97c21caf82963645abb66913098b85ced0a0d2a Mon Sep 17 00:00:00 2001 From: piratefinn Date: Wed, 7 Mar 2018 13:02:42 +0000 Subject: [PATCH 6/6] updated moment to fix known vulnerability --- package-lock.json | 17 +++++++++-------- package.json | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3ea83eb..c259ed9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -498,7 +498,7 @@ "resolved": "https://registry.npmjs.org/@types/moment/-/moment-2.13.0.tgz", "integrity": "sha1-YE69GJvDvDShVIaJQE5hoqSqyJY=", "requires": { - "moment": "2.19.2" + "moment": "2.21.0" } }, "@types/node": { @@ -1020,11 +1020,11 @@ }, "block-stream": { "version": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz", - "integrity": "sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo=", + "integrity": "sha512-OorbnJVPII4DuUKbjARAe8u8EfqOmkEEaSFIyoQ7OjTHn6kafxWl0wLgoZ2rXaYd7MyLcDaU4TmhfxtwgcccMQ==", "dev": true, "optional": true, "requires": { - "inherits": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz" + "inherits": "2.0.3" } }, "blocking-proxy": { @@ -4837,7 +4837,8 @@ } }, "inherits": { - "version": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", "dev": true, "optional": true @@ -6113,9 +6114,9 @@ } }, "moment": { - "version": "2.19.2", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.19.2.tgz", - "integrity": "sha512-Rf6jiHPEfxp9+dlzxPTmRHbvoFXsh2L/U8hOupUMpnuecHQmI6cF6lUbJl3QqKPko1u6ujO+FxtcajLVfLpAtA==" + "version": "2.21.0", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.21.0.tgz", + "integrity": "sha512-TCZ36BjURTeFTM/CwRcViQlfkMvL1/vFISuNLO5GkcVm1+QHfbSiNqZuWeMFjj1/3+uAjXswgRk30j1kkLYJBQ==" }, "move-concurrently": { "version": "1.0.1", @@ -6184,7 +6185,7 @@ "integrity": "sha1-MI+aSwv+1aFUwU9d6x2UcNIqvnE=", "requires": { "chartjs-color": "2.1.0", - "moment": "2.19.2" + "moment": "2.21.0" } } } diff --git a/package.json b/package.json index c0f2c8b..b64cc1d 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "chart.js": "2.7.1", "core-js": "2.5.1", "js-marker-clusterer": "1.0.0", - "moment": "^2.19.2", + "moment": "^2.21.0", "ng2-charts": "1.6.0", "ng2-validation-manager": "0.5.3", "ngx-bootstrap": "2.0.0-beta.8",