From 7b1771b45ffb6038b503502fac7fb157715cafd7 Mon Sep 17 00:00:00 2001 From: piratefinn Date: Fri, 15 Sep 2017 16:35:04 +0100 Subject: [PATCH 1/4] Fixed Register View on mobile --- src/app/auth/login.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/auth/login.component.html b/src/app/auth/login.component.html index 41095ff..5c02b96 100644 --- a/src/app/auth/login.component.html +++ b/src/app/auth/login.component.html @@ -37,7 +37,7 @@ -
+

Sign up

From 70be2cbc2b57aa3c4592dc71b4f21937eaab0cdf Mon Sep 17 00:00:00 2001 From: piratefinn Date: Fri, 15 Sep 2017 16:36:37 +0100 Subject: [PATCH 2/4] Amended changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1849098..e9124fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ # Next Release +* Fixed register box view on login page + # v0.0.1 * Added Travis Testing From f34c558d415aa80fb4f7aafa41877ecf63cf8c0a Mon Sep 17 00:00:00 2001 From: piratefinn Date: Fri, 15 Sep 2017 16:50:53 +0100 Subject: [PATCH 3/4] Fixes to receipt form --- CHANGELOG.md | 1 + src/app/dashboard/add-data.component.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e9124fb..275665b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ # Next Release * Fixed register box view on login page +* Made the form reset properly if adding a new one # v0.0.1 diff --git a/src/app/dashboard/add-data.component.ts b/src/app/dashboard/add-data.component.ts index c121d0a..75b9a28 100644 --- a/src/app/dashboard/add-data.component.ts +++ b/src/app/dashboard/add-data.component.ts @@ -239,6 +239,7 @@ export class AddDataComponent { this.storeList = null; this.amount = null; this.transactionFormInvalid = true; + this.showAddStore = false; } onSubmitPayroll() { From 7f3e9f4fd0a6f1614734f827e0915ddbbb82ffb5 Mon Sep 17 00:00:00 2001 From: piratefinn Date: Fri, 15 Sep 2017 17:33:34 +0100 Subject: [PATCH 4/4] Added better error messaging --- CHANGELOG.md | 1 + src/app/auth/register.component.html | 26 ++++++------- src/app/auth/register.component.ts | 37 ++++++++++++++----- src/app/dashboard/account-edit.component.html | 4 +- src/app/dashboard/account-edit.component.ts | 23 +++++++++++- 5 files changed, 65 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 275665b..84ec5f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * Fixed register box view on login page * Made the form reset properly if adding a new one +* Added better error messages on register and account edit # v0.0.1 diff --git a/src/app/auth/register.component.html b/src/app/auth/register.component.html index dbe0c82..1a0c868 100644 --- a/src/app/auth/register.component.html +++ b/src/app/auth/register.component.html @@ -6,7 +6,7 @@

Register

Create your account

- + - +
- +
- +
- +
@@ -137,7 +137,7 @@ Form validation failed, please ensure the form is filled correctly.
diff --git a/src/app/auth/register.component.ts b/src/app/auth/register.component.ts index ebc69d2..bdb9815 100644 --- a/src/app/auth/register.component.ts +++ b/src/app/auth/register.component.ts @@ -16,7 +16,8 @@ export class RegisterComponent { organisationForm: ValidationManager; years: Object[]; registerStatus: any; - + registerStatusError: string = 'Error received, please try again.'; + constructor( private http: Http, private formBuilder: FormBuilder, @@ -51,9 +52,9 @@ export class RegisterComponent { postcode: 'required', }); } - + onSubmitCustomer() { - + console.log(this.signupForm.isValid()); if (!this.signupForm.isValid() && !this.customerForm.isValid()) { console.log("Not Valid!"); @@ -63,7 +64,7 @@ export class RegisterComponent { } let signupForm = this.signupForm.getForm().value; let customerForm = this.customerForm.getForm().value; - + let data = { token: signupForm.token, usertype: signupForm.usertype, @@ -85,14 +86,23 @@ export class RegisterComponent { this.router.navigate(['/dashboard']); }, error => { - console.log( error._body ); + console.log('Register Error'); + console.log(error); + try { + console.log(error.error); + let jsonError = error.json(); + console.log("boop"); + this.registerStatusError = '"' + jsonError.error + '" Error, ' + jsonError.message; + } catch(e) { + this.registerStatusError = 'There was a server error, please try again later.'; + } this.registerStatus = "send_failed"; - console.log(this.registerStatus) + console.log(this.registerStatus); } ); } onSubmitOrganisation() { - + console.log(this.signupForm.isValid()); if (!this.signupForm.isValid() || !this.organisationForm.isValid()) { console.log("Not Valid!"); @@ -102,7 +112,7 @@ export class RegisterComponent { } let signupForm = this.signupForm.getForm().value; let organisationForm = this.organisationForm.getForm().value; - + let data = { token: signupForm.token, usertype: signupForm.usertype, @@ -125,7 +135,16 @@ export class RegisterComponent { this.router.navigate(['/dashboard']); }, error => { - console.log( error._body ); + console.log('Register Error'); + console.log(error); + try { + console.log(error.error); + let jsonError = error.json(); + console.log("boop"); + this.registerStatusError = '"' + jsonError.error + '" Error, ' + jsonError.message; + } catch(e) { + this.registerStatusError = 'There was a server error, please try again later.'; + } this.registerStatus = "send_failed"; console.log(this.registerStatus); } diff --git a/src/app/dashboard/account-edit.component.html b/src/app/dashboard/account-edit.component.html index f46aca7..5d4e7b4 100644 --- a/src/app/dashboard/account-edit.component.html +++ b/src/app/dashboard/account-edit.component.html @@ -122,7 +122,7 @@ Form validation failed, please ensure the form is filled correctly.
@@ -160,7 +160,7 @@ Form validation failed, please ensure the form is filled correctly. diff --git a/src/app/dashboard/account-edit.component.ts b/src/app/dashboard/account-edit.component.ts index eedd3ad..0cc6a51 100644 --- a/src/app/dashboard/account-edit.component.ts +++ b/src/app/dashboard/account-edit.component.ts @@ -14,6 +14,7 @@ export class AccountEditComponent implements OnInit { accountType: any; // @ViewChild('fileInput') fileInput; submitStatus: any; + submitStatusError: string = 'Error received, please try again.'; constructor( private http: Http, @@ -111,7 +112,16 @@ export class AccountEditComponent implements OnInit { console.log(this.submitStatus); }, error => { - console.log( error._body ); + console.log('Edit Error'); + console.log(error); + try { + console.log(error.error); + let jsonError = error.json(); + console.log("boop"); + this.submitStatusError = '"' + jsonError.error + '" Error, ' + jsonError.message; + } catch(e) { + this.submitStatusError = 'There was a server error, please try again later.'; + } this.submitStatus = "send_failed"; console.log(this.submitStatus); } @@ -159,7 +169,16 @@ export class AccountEditComponent implements OnInit { console.log(this.submitStatus); }, error => { - console.log( error._body ); + console.log('Edit Error'); + console.log(error); + try { + console.log(error.error); + let jsonError = error.json(); + console.log("boop"); + this.submitStatusError = '"' + jsonError.error + '" Error, ' + jsonError.message; + } catch(e) { + this.submitStatusError = 'There was a server error, please try again later.'; + } this.submitStatus = "send_failed"; console.log(this.submitStatus); }