diff --git a/src/app/dashboard/account-edit.component.html b/src/app/dashboard/account-edit.component.html
index 97a0658..2fd3676 100644
--- a/src/app/dashboard/account-edit.component.html
+++ b/src/app/dashboard/account-edit.component.html
@@ -12,7 +12,7 @@
- This is a help text
+ Required for security purposes.
@@ -21,7 +21,7 @@
- This is a help text
+ Change this to alter your current account email.
@@ -30,7 +30,7 @@
- This is a help text
+ Enter a new password here if you wish to alter your current one.
@@ -39,16 +39,16 @@
- This is a help text
+ Change this if your location of residence has changed.
-
@@ -60,7 +60,7 @@
- This is a help text
+ Change this if your business name has changed.
@@ -69,16 +69,16 @@
- This is a help text
+ Change this if your located street has changed.
@@ -107,7 +107,7 @@
- This is a help text
+ Change this if your full name has changed.
@@ -116,7 +116,7 @@
- This is a help text
+ Change this if wish to alter your user display name.
diff --git a/src/app/dashboard/add-data.component.html b/src/app/dashboard/add-data.component.html
index 94ca01b..e44c77b 100644
--- a/src/app/dashboard/add-data.component.html
+++ b/src/app/dashboard/add-data.component.html
@@ -11,7 +11,7 @@
- This is a help text
+ Enter the date and time the transaction occurred.
@@ -21,14 +21,14 @@
- This is a help text
+ Enter the amount spent, such as 5.35 for £5.35.
@@ -37,21 +37,21 @@
- This is a help text
+ Enter the street name where the organisation is located at.
diff --git a/src/app/dashboard/dashboard-customer.component.html b/src/app/dashboard/dashboard-customer.component.html
index dc33b08..7b963f6 100644
--- a/src/app/dashboard/dashboard-customer.component.html
+++ b/src/app/dashboard/dashboard-customer.component.html
@@ -2,11 +2,11 @@
+
-
-
-
+
+
+
+
{{ basicStats.today_sum | currency:'GBP':true:'1.2-2' }}
+
Total Today
+
+
+
+
+
+
+
+
{{ basicStats.today_sum / (basicStats.today_count ? basicStats.today_count : 1) | currency:'GBP':true:'1.2-2' }}
+
Avg. Spend Today
+
+
+
+
+
+
+
+
{{ basicStats.week_sum | currency:'GBP':true:'1.2-2' }}
+
Last Week Total
+
+
+
+
+
+
+
+
{{ basicStats.week_sum / (basicStats.week_count ? basicStats.week_count : 1) | currency:'GBP':true:'1.2-2' }}
+
Last Week Avg. Spend
+
+
+
+
+
+
+
+
{{ basicStats.month_sum | currency:'GBP':true:'1.2-2' }}
+
Last Month Total
+
+
+
+
+
+
+
+
{{ basicStats.month_sum / (basicStats.month_count ? basicStats.month_count : 1) | currency:'GBP':true:'1.2-2' }}
+
Last Month Avg. Spend
+
+
+
+
+
+
+
+
{{ basicStats.user_sum | currency:'GBP':true:'1.2-2' }}
+
User Total
+
+
+
+
+
+
+
+
{{ basicStats.user_sum / (basicStats.user_count ? basicStats.user_count : 1) | currency:'GBP':true:'1.2-2' }}
+
User Avg. Spend
+
+
+
+
diff --git a/src/app/dashboard/dashboard-customer.component.ts b/src/app/dashboard/dashboard-customer.component.ts
index cbdef96..dc8c9c6 100644
--- a/src/app/dashboard/dashboard-customer.component.ts
+++ b/src/app/dashboard/dashboard-customer.component.ts
@@ -8,7 +8,6 @@ import { GraphWidget } from '../widgets/graph-widget.component';
templateUrl: 'dashboard-customer.component.html'
})
export class DashboardCustomerComponent implements OnInit {
- showSnippet: any;
customersThisMonth: any;
moneySpentThisMonth: any;
pointsTotal: any;
@@ -36,21 +35,6 @@ export class DashboardCustomerComponent implements OnInit {
user_position: 0,
};
- public widgetList = [
- {
- type: 'graph',
- name: 'customers_last_7_days',
- icon: 'icon-people',
- title: 'Customers Last 7 Days',
- },
- {
- type: 'graph',
- name: 'customers_last_30_days',
- icon: 'icon-people',
- title: 'Customers Last 30 Days',
- },
- ];
-
constructor(
private http: Http,
private api: ApiService,
diff --git a/src/app/dashboard/feedback.component.html b/src/app/dashboard/feedback.component.html
new file mode 100644
index 0000000..f03f9dd
--- /dev/null
+++ b/src/app/dashboard/feedback.component.html
@@ -0,0 +1,45 @@
+
diff --git a/src/app/dashboard/feedback.component.ts b/src/app/dashboard/feedback.component.ts
new file mode 100644
index 0000000..8b87596
--- /dev/null
+++ b/src/app/dashboard/feedback.component.ts
@@ -0,0 +1,88 @@
+import { Component, OnInit } from '@angular/core';
+import { Validators, FormBuilder, FormGroup } from '@angular/forms';
+import { Http, Response } from '@angular/http';
+import { ApiService } from '../providers/api-service';
+import 'rxjs/add/operator/map';
+
+@Component({
+ templateUrl: 'add-data.component.html',
+ providers: [ApiService]
+})
+export class FeedbackPage {
+ feedbackForm: FormGroup;
+ loggedIn: boolean;
+ loggedInEmail: any;
+ username: any;
+ feedbackFormStatus: any;
+ feedbackFormStatusError: string = 'Error received, please try again.';
+
+ constructor(
+ private http: Http,
+ private formBuilder: FormBuilder,
+ private api: ApiService,
+ ) {
+ this.getUserEmail();
+
+ this.feedbackForm = this.formBuilder.group({
+ email: ['', [Validators.required]],
+ feedbacktext: ['', [Validators.required]],
+ });
+ }
+
+ onSubmit() {
+ this.api
+ .feedback(this.feedbackForm.value)
+ .subscribe(
+ result => {
+ if ( result.success == true ) {
+ console.log('Successful Upload');
+ console.log(result);
+ this.feedbackFormStatus = "success";
+ console.log(this.feedbackFormStatus);
+ this.feedbackForm.patchValue({
+ feedbacktext: '',
+ });
+ } else {
+ console.log('Upload Error');
+ this.feedbackFormStatusError = JSON.stringify(result.status) + 'Error, ' + JSON.stringify(result.message);
+ this.feedbackFormStatus = "send_failed";
+ console.log(this.feedbackFormStatus);
+ }
+ },
+ error => {
+ console.log('Upload Error');
+ console.log(error);
+ try {
+ console.log(error.error);
+ let jsonError = error.json();
+ console.log("boop");
+ this.feedbackFormStatusError = '"' + jsonError.error + '" Error, ' + jsonError.message;
+ } catch(e) {
+ this.feedbackFormStatusError = 'There was a server error, please try again later.';
+ }
+ this.feedbackFormStatus = "send_failed";
+ console.log(this.feedbackFormStatus);
+ }
+ );
+ }
+
+ getUserEmail() {
+ this.api.getEmail().subscribe(
+ result => {
+ if (result) {
+ console.log('Email has been received');
+ this.loggedInEmail = result;
+ this.loggedIn = true;
+ } else {
+ console.log('Email is not available');
+ this.loggedIn = false;
+ }
+ },
+ err => {
+ console.log('Email could not be received');
+ this.loggedIn = false;
+ }
+ );
+ }
+
+}
diff --git a/src/app/providers/api-service.ts b/src/app/providers/api-service.ts
index ee925e1..8ac13d2 100644
--- a/src/app/providers/api-service.ts
+++ b/src/app/providers/api-service.ts
@@ -83,6 +83,20 @@ export class ApiService {
).map( response => { this.removeSessionKey(); return response.json() } );
}
+ // Submits feedback
+
+ public feedback(data) {
+ data.app_name = 'Foodloop Web';
+ data.package_name = 'Foodloop Web';
+ data.version_code = '';
+ data.version_number = '';
+ console.log(data);
+ return this.http.post(
+ this.apiUrl + '/feedback',
+ data
+ ).map( response => response.json() );
+ }
+
// Searches organisations used for transaction submission
public search(data) {