From e64b6057e8aeb14da17d0e940e3448452242479e Mon Sep 17 00:00:00 2001 From: piratefinn Date: Mon, 15 Jan 2018 14:19:16 +0000 Subject: [PATCH 1/9] added category list endpoint --- src/app/providers/api-service.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/app/providers/api-service.ts b/src/app/providers/api-service.ts index 131eee3..25e9ce1 100644 --- a/src/app/providers/api-service.ts +++ b/src/app/providers/api-service.ts @@ -116,6 +116,17 @@ export class ApiService { ); } + // Basic Customer User stats API + public categoryList() { + const key = this.sessionKey; + return this.http.post( + this.apiUrl + '/search/category', + { + session_key : key, + } + ); + } + // Searches organisations used for transaction submission public search(data) { From 59efe7a65055aa005e12cd1be0a007e0813224c8 Mon Sep 17 00:00:00 2001 From: piratefinn Date: Mon, 15 Jan 2018 15:33:38 +0000 Subject: [PATCH 2/9] Retrieving categories from API --- src/app/dashboard/add-data.component.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/app/dashboard/add-data.component.ts b/src/app/dashboard/add-data.component.ts index ffa4ef8..7ca6cd1 100644 --- a/src/app/dashboard/add-data.component.ts +++ b/src/app/dashboard/add-data.component.ts @@ -37,6 +37,8 @@ export class AddDataComponent implements OnInit { transactionFormInvalid = true; myDate: any; minDate: any; + categoryIds: number[] = []; + categoryNames: string[] = []; constructor( private formBuilder: FormBuilder, @@ -64,6 +66,16 @@ export class AddDataComponent implements OnInit { }); this.myDate = moment().format('YYYY-MM-DD[T]HH:mm'); // this.myDate = new Date().toISOString().slice(0, 16); + this.api.categoryList().subscribe( + result => { + this.categories = result; + console.log(this.categories); + }, + error => { + console.log('Retrieval Error'); + console.log( error._body ); + } + ); } ngOnInit(): void { From d17a686490571a57c498b255928f058e73dd8414 Mon Sep 17 00:00:00 2001 From: piratefinn Date: Mon, 15 Jan 2018 16:20:51 +0000 Subject: [PATCH 3/9] functional receiving, choosing and upload of transaction category --- src/app/dashboard/add-data.component.html | 14 ++++++++++++++ src/app/dashboard/add-data.component.ts | 15 +++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/app/dashboard/add-data.component.html b/src/app/dashboard/add-data.component.html index 948f868..ebdea7a 100644 --- a/src/app/dashboard/add-data.component.html +++ b/src/app/dashboard/add-data.component.html @@ -24,6 +24,20 @@ Enter the amount spent, such as 5.35 for £5.35. +
+ +
+
+ +
+ Optional: Choose the relevant Category for the purchase. +
+
diff --git a/src/app/dashboard/add-data.component.ts b/src/app/dashboard/add-data.component.ts index 7ca6cd1..f970448 100644 --- a/src/app/dashboard/add-data.component.ts +++ b/src/app/dashboard/add-data.component.ts @@ -30,6 +30,7 @@ export class AddDataComponent implements OnInit { organisationTown: string; organisationPostcode: string; amount: number; + categoryId: number; transactionAdditionType = 1; storeList = []; showAddStore = false; @@ -37,8 +38,8 @@ export class AddDataComponent implements OnInit { transactionFormInvalid = true; myDate: any; minDate: any; - categoryIds: number[] = []; - categoryNames: string[] = []; + categoryIdList: number[] = []; + categoryNameList: string[] = []; constructor( private formBuilder: FormBuilder, @@ -70,6 +71,7 @@ export class AddDataComponent implements OnInit { result => { this.categories = result; console.log(this.categories); + this.setCategoryList(result.categories); }, error => { console.log('Retrieval Error'); @@ -83,6 +85,11 @@ export class AddDataComponent implements OnInit { this.accountType = localStorage.getItem('usertype'); } + private setCategoryList(data: any) { + this.categoryIdList = Object.keys(data.ids).map(key => data.ids[key]); + this.categoryNameList = Object.keys(data.names).map(key => data.names[key]); + } + getMinDate() { // gets the April 1st date of the current year const aprilDate = moment().month(3).date(1); @@ -182,6 +189,7 @@ export class AddDataComponent implements OnInit { transaction_value : this.amount, purchase_time : purchaseTime, organisation_id : this.organisationId, + category : this.categoryId, }; break; case 2: @@ -190,6 +198,7 @@ export class AddDataComponent implements OnInit { transaction_value : this.amount, purchase_time : purchaseTime, organisation_id : this.organisationId, + category : this.categoryId, }; break; case 3: @@ -201,6 +210,7 @@ export class AddDataComponent implements OnInit { street_name : this.submitOrg.street_name, town : this.submitOrg.town, postcode : this.submitOrg.postcode, + category : this.categoryId, }; break; } @@ -251,6 +261,7 @@ export class AddDataComponent implements OnInit { this.amount = null; this.transactionFormInvalid = true; this.showAddStore = false; + this.categoryId = null; } onSubmitPayroll() { From 511969656e6c74e4eac11657d8091d85b846c50e Mon Sep 17 00:00:00 2001 From: piratefinn Date: Tue, 16 Jan 2018 15:57:38 +0000 Subject: [PATCH 4/9] Fixed app, added ability for non category transaction changed reset form --- src/app/dashboard/add-data.component.html | 2 +- src/app/dashboard/add-data.component.ts | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/app/dashboard/add-data.component.html b/src/app/dashboard/add-data.component.html index ebdea7a..edcb5e2 100644 --- a/src/app/dashboard/add-data.component.html +++ b/src/app/dashboard/add-data.component.html @@ -29,7 +29,7 @@
Week - -
-
-
Date: Wed, 17 Jan 2018 15:02:53 +0000 Subject: [PATCH 7/9] added just in case for font loading file attribute --- .gitattributes | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitattributes b/.gitattributes index bdb0cab..60dd516 100644 --- a/.gitattributes +++ b/.gitattributes @@ -15,3 +15,9 @@ *.PDF diff=astextplain *.rtf diff=astextplain *.RTF diff=astextplain + +# ensures font files are loaded as binary not text +*.ttf binary +*.eot binary +*.woff binary +*.woff2 binary From a20d94d9cbf9c0fd6059dccc7aa673e05ae6e4c0 Mon Sep 17 00:00:00 2001 From: piratefinn Date: Thu, 18 Jan 2018 12:16:37 +0000 Subject: [PATCH 8/9] Changed transaction category input --- src/app/dashboard/add-data.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/dashboard/add-data.component.html b/src/app/dashboard/add-data.component.html index edcb5e2..f43870e 100644 --- a/src/app/dashboard/add-data.component.html +++ b/src/app/dashboard/add-data.component.html @@ -28,7 +28,7 @@
-