From 32b6dc810f179644b156cc718a26217159eabae3 Mon Sep 17 00:00:00 2001 From: piratefinn Date: Mon, 21 May 2018 15:39:43 +0100 Subject: [PATCH 1/8] extraneous login console logs removed --- src/app/_guards/auth.guard.ts | 2 -- src/app/_guards/customer.guard.ts | 2 -- src/app/_guards/org.guard.ts | 2 -- 3 files changed, 6 deletions(-) diff --git a/src/app/_guards/auth.guard.ts b/src/app/_guards/auth.guard.ts index d267cf4..6b8cd27 100644 --- a/src/app/_guards/auth.guard.ts +++ b/src/app/_guards/auth.guard.ts @@ -8,13 +8,11 @@ export class AuthGuard implements CanActivate { canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) { if (localStorage.getItem('sessionKey')) { - console.log('session key found'); // logged in so return true return true; } // not logged in so redirect to login page with the return url - console.log('no session key found'); this.router.navigate(['/login'], { queryParams: { returnUrl: state.url }}); return false; } diff --git a/src/app/_guards/customer.guard.ts b/src/app/_guards/customer.guard.ts index 93687c1..1e34c5f 100644 --- a/src/app/_guards/customer.guard.ts +++ b/src/app/_guards/customer.guard.ts @@ -8,11 +8,9 @@ export class CustomerGuard implements CanActivate { canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) { if (localStorage.getItem('usertype') === 'customer') { - console.log('Customer logged in'); // customer logged in so return true return true; } else if (localStorage.getItem('usertype') === 'organisation') { - console.log('not an customer'); this.router.navigate(['/dashboard']); return false; } diff --git a/src/app/_guards/org.guard.ts b/src/app/_guards/org.guard.ts index 0205b47..9954c93 100644 --- a/src/app/_guards/org.guard.ts +++ b/src/app/_guards/org.guard.ts @@ -8,11 +8,9 @@ export class OrgGuard implements CanActivate { canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) { if (localStorage.getItem('usertype') === 'organisation') { - console.log('Organisation logged in'); // org logged in so return true return true; } else if (localStorage.getItem('usertype') === 'customer') { - console.log('not an organisation'); this.router.navigate(['/dashboard-customer']); return false; } From a388e2629d4be64541c8a72c9d26a5c85191fde4 Mon Sep 17 00:00:00 2001 From: piratefinn Date: Mon, 4 Jun 2018 15:25:24 +0100 Subject: [PATCH 2/8] extraneous console logs removed --- src/app/providers/api-service.ts | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/app/providers/api-service.ts b/src/app/providers/api-service.ts index a77a68c..78a5485 100644 --- a/src/app/providers/api-service.ts +++ b/src/app/providers/api-service.ts @@ -29,18 +29,15 @@ export class ApiService { // Login API public getSessionKey() { - console.log('get key'); return this.sessionKey; } public setSessionKey(key) { - console.log('set key'); this.sessionKey = key; localStorage.setItem('sessionKey', this.sessionKey); } public removeSessionKey() { - console.log('remove key'); this.sessionKey = null; localStorage.removeItem('sessionKey'); } @@ -73,7 +70,6 @@ export class ApiService { } public logout() { - console.log(this.sessionKey); const key = this.sessionKey; return this.http .post( @@ -96,7 +92,6 @@ export class ApiService { data.package_name = 'Foodloop Web'; data.version_code = 'dev'; data.version_number = 'dev'; - console.log(data); return this.http.post( this.apiUrl + '/feedback', data @@ -230,7 +225,6 @@ export class ApiService { public setUserInfo( email: string, display_name: string) { - console.log('set UserInfo'); localStorage.setItem('email', email); localStorage.setItem('displayname', display_name); } @@ -238,7 +232,6 @@ export class ApiService { // Sets usertype public setUserType(user_type: string) { - console.log('set UserType'); localStorage.setItem('usertype', user_type); } @@ -263,33 +256,27 @@ export class ApiService { // Deletes account details on logout public removeUserInfo() { - console.log('remove UserInfo'); localStorage.removeItem('email'); localStorage.removeItem('displayname'); } public getFullName() { - console.log('get Full Name'); localStorage.getItem('fullname'); } public getDisplayName() { - console.log('get Display Name'); localStorage.getItem('displayname'); } public getPostcode() { - console.log('get Postcode'); localStorage.getItem('postcode'); } public getYearOfBirth() { - console.log('get Year of Birth'); localStorage.getItem('yearofbirth'); } public getEmail() { - console.log('get email'); localStorage.getItem('email'); } From fa2180f60304e406ebdd32ed88d9e9643a28d4de Mon Sep 17 00:00:00 2001 From: piratefinn Date: Mon, 4 Jun 2018 15:25:54 +0100 Subject: [PATCH 3/8] made submit message on add more logical --- src/app/dashboard/add-data.component.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/dashboard/add-data.component.ts b/src/app/dashboard/add-data.component.ts index 34b0ca3..d0cc88f 100644 --- a/src/app/dashboard/add-data.component.ts +++ b/src/app/dashboard/add-data.component.ts @@ -174,6 +174,7 @@ export class AddDataComponent implements OnInit { } transactionFormValidate() { + this.transactionFormStatus = null; if (this.submitOrg.name.length && this.amount && (this.recurringPurchase && From ca95f8d10d4b25ca97e3048e8495882e7fb80846 Mon Sep 17 00:00:00 2001 From: piratefinn Date: Tue, 1 May 2018 13:23:47 +0100 Subject: [PATCH 4/8] layout fixes --- .../dashboard/dashboard-customer.component.html | 14 +++++++------- src/app/dashboard/dashboard-customer.component.ts | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/app/dashboard/dashboard-customer.component.html b/src/app/dashboard/dashboard-customer.component.html index b0c8895..2ce4fa4 100644 --- a/src/app/dashboard/dashboard-customer.component.html +++ b/src/app/dashboard/dashboard-customer.component.html @@ -11,10 +11,10 @@
-
+
-
+
@@ -26,7 +26,7 @@
-
+
@@ -55,7 +55,7 @@
-
+
@@ -76,7 +76,7 @@
-
+
@@ -135,7 +135,7 @@
-
+
diff --git a/src/app/dashboard/dashboard-customer.component.ts b/src/app/dashboard/dashboard-customer.component.ts index cebb1f8..4317bd2 100644 --- a/src/app/dashboard/dashboard-customer.component.ts +++ b/src/app/dashboard/dashboard-customer.component.ts @@ -30,7 +30,7 @@ export class DashboardCustomerComponent implements OnInit { public doughnutChartDataCategory: any[] = []; public doughnutChartLabelsCategory: string[] = []; - public doughtnutChartOptionsCategory:any = { + public doughnutChartOptionsCategory:any = { tooltips: { callbacks: { label: (tooltip, data) => { From adc0a1a7db506b59e13ba8dfdebba4676eb1514c Mon Sep 17 00:00:00 2001 From: piratefinn Date: Tue, 22 May 2018 12:28:09 +0100 Subject: [PATCH 5/8] Added category all time purchase list --- .../dashboard-customer.component.html | 33 +++++++++++++++++-- .../dashboard/dashboard-customer.component.ts | 13 ++++++-- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/src/app/dashboard/dashboard-customer.component.html b/src/app/dashboard/dashboard-customer.component.html index 2ce4fa4..133719e 100644 --- a/src/app/dashboard/dashboard-customer.component.html +++ b/src/app/dashboard/dashboard-customer.component.html @@ -140,7 +140,36 @@
-

Purchases by Sector

+

All Purchases by Category

+
+
+
+
    + +
  • + +
    +
    {{ category.category || 'N/A' }}
    +
    +
    +
    Bought
    + {{ category.value || 'N/A' }} +
    +
  • +
  • + +
  • +
+
+
+
+
+
+
+
+
+
+

All Purchases by Sector

@@ -157,7 +186,7 @@
  • - +
  • diff --git a/src/app/dashboard/dashboard-customer.component.ts b/src/app/dashboard/dashboard-customer.component.ts index 4317bd2..f6abd47 100644 --- a/src/app/dashboard/dashboard-customer.component.ts +++ b/src/app/dashboard/dashboard-customer.component.ts @@ -24,6 +24,7 @@ export class DashboardCustomerComponent implements OnInit { maxPurchase: number = 0; disableSectorButton: boolean = false; + disableCategoryButton: boolean = false; public chartType = 'doughnut'; public chartLegend = true; @@ -175,7 +176,8 @@ export class DashboardCustomerComponent implements OnInit { sectorLetters: string[] = []; sectorPurchases: number[] = []; sectorLimit: number = 10; - + totalCategoryLimit: number = 10; + totalCategoryList: any; sectorList: any; // Graph widgets @@ -219,6 +221,8 @@ export class DashboardCustomerComponent implements OnInit { this.setSectorList(result.sectors); this.setWeekData(result); this.setChartData(result.data.cat_total); + this.totalCategoryList = result.data.cat_list; + console.log(this.totalCategoryList); this.purchaseEssential = result.data.essentials.purchase_no_essential_total; this.purchaseNotEssential = result.data.essentials.purchase_no_total - this.purchaseEssential; this.barChartDataEssential = [ @@ -278,11 +282,16 @@ export class DashboardCustomerComponent implements OnInit { this.sectorPurchases = Object.keys(data.purchases).map(key => data.purchases[key]); } - private loadMore () { + private sectorLoadMore () { this.disableSectorButton = true; this.sectorLimit = 22; } + private categoryLoadMore () { + this.disableCategoryButton = true; + this.totalCategoryLimit = 30; + } + public convertHex(hex: string, opacity: number) { hex = hex.replace('#', ''); const r = parseInt(hex.substring(0, 2), 16); From e9b659a4bb8f5b00a0f1cb2b7cc602255bffaa68 Mon Sep 17 00:00:00 2001 From: piratefinn Date: Tue, 22 May 2018 12:57:25 +0100 Subject: [PATCH 6/8] Removed sector stuff on dashboard To be moved to organisation dashboard at later time --- .../dashboard-customer.component.html | 29 ------------------- .../dashboard/dashboard-customer.component.ts | 19 ++---------- 2 files changed, 2 insertions(+), 46 deletions(-) diff --git a/src/app/dashboard/dashboard-customer.component.html b/src/app/dashboard/dashboard-customer.component.html index 133719e..7f650f0 100644 --- a/src/app/dashboard/dashboard-customer.component.html +++ b/src/app/dashboard/dashboard-customer.component.html @@ -164,34 +164,5 @@
    -
    -
    -
    -
    -
    -

    All Purchases by Sector

    -
    -
    -
    -
      - -
    • - -
      -
      {{ sectorNames [sector] || 'N/A' }}
      -
      -
      -
      Bought
      - {{ sectorPurchases[i] || 'N/A' }} -
      -
    • -
    • - -
    • -
    -
    -
    -
    -
    diff --git a/src/app/dashboard/dashboard-customer.component.ts b/src/app/dashboard/dashboard-customer.component.ts index f6abd47..ab40f2b 100644 --- a/src/app/dashboard/dashboard-customer.component.ts +++ b/src/app/dashboard/dashboard-customer.component.ts @@ -23,7 +23,6 @@ export class DashboardCustomerComponent implements OnInit { username: any; maxPurchase: number = 0; - disableSectorButton: boolean = false; disableCategoryButton: boolean = false; public chartType = 'doughnut'; @@ -173,12 +172,9 @@ export class DashboardCustomerComponent implements OnInit { U: 'bg-primary', } - sectorLetters: string[] = []; - sectorPurchases: number[] = []; - sectorLimit: number = 10; + showTotalCategoryList: boolean = false; totalCategoryLimit: number = 10; totalCategoryList: any; - sectorList: any; // Graph widgets public widgetList = [ @@ -218,11 +214,10 @@ export class DashboardCustomerComponent implements OnInit { this.api.customerStats().subscribe( result => { this.setWeekPurchaseList(result.weeks); - this.setSectorList(result.sectors); this.setWeekData(result); this.setChartData(result.data.cat_total); this.totalCategoryList = result.data.cat_list; - console.log(this.totalCategoryList); + this.showTotalCategoryList = true; this.purchaseEssential = result.data.essentials.purchase_no_essential_total; this.purchaseNotEssential = result.data.essentials.purchase_no_total - this.purchaseEssential; this.barChartDataEssential = [ @@ -277,16 +272,6 @@ export class DashboardCustomerComponent implements OnInit { }; } - public setSectorList (data: any) { - this.sectorLetters = Object.keys(data.sectors).map(key => data.sectors[key]); - this.sectorPurchases = Object.keys(data.purchases).map(key => data.purchases[key]); - } - - private sectorLoadMore () { - this.disableSectorButton = true; - this.sectorLimit = 22; - } - private categoryLoadMore () { this.disableCategoryButton = true; this.totalCategoryLimit = 30; From c9f786eaeee94708d86b237dc962ca688313c3f2 Mon Sep 17 00:00:00 2001 From: piratefinn Date: Tue, 22 May 2018 13:00:49 +0100 Subject: [PATCH 7/8] removed icon list for sectors --- .../dashboard/dashboard-customer.component.ts | 72 ------------------- 1 file changed, 72 deletions(-) diff --git a/src/app/dashboard/dashboard-customer.component.ts b/src/app/dashboard/dashboard-customer.component.ts index ab40f2b..4bfa98d 100644 --- a/src/app/dashboard/dashboard-customer.component.ts +++ b/src/app/dashboard/dashboard-customer.component.ts @@ -100,78 +100,6 @@ export class DashboardCustomerComponent implements OnInit { count: 0, }; - sectorNames = { - A: 'Agriculture, Forestry & Fishing', - B: 'Mining & Quarrying', - C: 'Manufacturing', - D: 'Electricity, Gas, Steam & Air Conditioning', - E: 'Water & Waste Management', - F: 'Construction', - G: 'Wholesale & Retail Trade', - H: 'Transportation & Storage', - I: 'Accomodation & Food Services', - J: 'Information & Communication', - K: 'Financial & Insurance Activities', - L: 'Real Estate', - M: 'Professional, Scientfic & Technical', - N: 'Administrative & Support Services', - O: 'Public Administration, Defence & Social Security', - P: 'Education', - Q: 'Human Health & Social Work', - R: 'Arts, Entertainment & Recreation', - S: 'Other Service Activities', - T: 'Household Domestic Business', - U: 'Extraterritorial Organisations and Bodies' - } - - sectorIcons = { - A: 'icon-drop', - B: 'icon-diamond', - C: 'icon-settings', - D: 'icon-energy', - E: 'icon-trash', - F: 'icon-wrench', - G: 'icon-tag', - H: 'icon-speedometer', - I: 'icon-cup', - J: 'icon-feed', - K: 'icon-credit-card', - L: 'icon-graph', - M: 'icon-chemistry', - N: 'icon-drawer', - O: 'icon-pie-chart', - P: 'icon-graduation', - Q: 'icon-support', - R: 'icon-film', - S: 'icon-calendar', - T: 'icon-home', - U: 'icon-globe', - } - - sectorClasses = { - A: 'bg-primary', - B: 'bg-success', - C: 'bg-danger', - D: 'bg-warning', - E: 'bg-info', - F: 'bg-primary', - G: 'bg-success', - H: 'bg-danger', - I: 'bg-warning', - J: 'bg-info', - K: 'bg-primary', - L: 'bg-success', - M: 'bg-danger', - N: 'bg-warning', - O: 'bg-info', - P: 'bg-primary', - Q: 'bg-success', - R: 'bg-danger', - S: 'bg-warning', - T: 'bg-info', - U: 'bg-primary', - } - showTotalCategoryList: boolean = false; totalCategoryLimit: number = 10; totalCategoryList: any; From 10622204b79924159b3491c49be99902944515d7 Mon Sep 17 00:00:00 2001 From: piratefinn Date: Tue, 22 May 2018 13:25:21 +0100 Subject: [PATCH 8/8] fixed icon errors --- src/app/dashboard/dashboard-customer.component.html | 2 +- src/app/dashboard/dashboard-customer.component.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/dashboard/dashboard-customer.component.html b/src/app/dashboard/dashboard-customer.component.html index 7f650f0..f2067cc 100644 --- a/src/app/dashboard/dashboard-customer.component.html +++ b/src/app/dashboard/dashboard-customer.component.html @@ -147,7 +147,7 @@
    • - +
      {{ category.category || 'N/A' }}
      diff --git a/src/app/dashboard/dashboard-customer.component.ts b/src/app/dashboard/dashboard-customer.component.ts index 4bfa98d..b53f468 100644 --- a/src/app/dashboard/dashboard-customer.component.ts +++ b/src/app/dashboard/dashboard-customer.component.ts @@ -102,7 +102,7 @@ export class DashboardCustomerComponent implements OnInit { showTotalCategoryList: boolean = false; totalCategoryLimit: number = 10; - totalCategoryList: any; + totalCategoryList: any[]=[]; // Graph widgets public widgetList = [