Merge pull request #17 from Pear-Trading/finn/RegisterViewFix

made register view fix
This commit is contained in:
Finn 2017-09-18 10:50:01 +01:00 committed by GitHub
commit d2f75af362
7 changed files with 70 additions and 27 deletions

View file

@ -2,6 +2,10 @@
# Next Release # Next Release
* 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 # v0.0.1
* Added Travis Testing * Added Travis Testing

View file

@ -37,7 +37,7 @@
</form> </form>
</div> </div>
</div> </div>
<div class="card card-inverse card-primary py-5 d-md-down-none" style="width:44%"> <div class="card card-inverse card-primary py-5">
<div class="card-block text-center"> <div class="card-block text-center">
<div> <div>
<h2>Sign up</h2> <h2>Sign up</h2>

View file

@ -137,7 +137,7 @@
Form validation failed, please ensure the form is filled correctly. Form validation failed, please ensure the form is filled correctly.
</div> </div>
<div *ngSwitchCase="'send_failed'" class="alert alert-danger" role="alert"> <div *ngSwitchCase="'send_failed'" class="alert alert-danger" role="alert">
Failed to send to server, please try again later. {{registerStatusError}}
</div> </div>
</div> </div>
</div> </div>

View file

@ -16,6 +16,7 @@ export class RegisterComponent {
organisationForm: ValidationManager; organisationForm: ValidationManager;
years: Object[]; years: Object[];
registerStatus: any; registerStatus: any;
registerStatusError: string = 'Error received, please try again.';
constructor( constructor(
private http: Http, private http: Http,
@ -85,9 +86,18 @@ export class RegisterComponent {
this.router.navigate(['/dashboard']); this.router.navigate(['/dashboard']);
}, },
error => { 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"; this.registerStatus = "send_failed";
console.log(this.registerStatus) console.log(this.registerStatus);
} }
); );
} }
@ -125,7 +135,16 @@ export class RegisterComponent {
this.router.navigate(['/dashboard']); this.router.navigate(['/dashboard']);
}, },
error => { 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"; this.registerStatus = "send_failed";
console.log(this.registerStatus); console.log(this.registerStatus);
} }

View file

@ -122,7 +122,7 @@
Form validation failed, please ensure the form is filled correctly. Form validation failed, please ensure the form is filled correctly.
</div> </div>
<div *ngSwitchCase="'send_failed'" class="alert alert-danger" role="alert"> <div *ngSwitchCase="'send_failed'" class="alert alert-danger" role="alert">
Failed to send to server, please try again later. {{submitStatusError}}
</div> </div>
</div> </div>
</div> </div>
@ -160,7 +160,7 @@
Form validation failed, please ensure the form is filled correctly. Form validation failed, please ensure the form is filled correctly.
</div> </div>
<div *ngSwitchCase="'send_failed'" class="alert alert-danger" role="alert"> <div *ngSwitchCase="'send_failed'" class="alert alert-danger" role="alert">
Failed to send to server, please try again later. {{submitStatusError}}
</div> </div>
</div> </div>
</div> </div>

View file

@ -14,6 +14,7 @@ export class AccountEditComponent implements OnInit {
accountType: any; accountType: any;
// @ViewChild('fileInput') fileInput; // @ViewChild('fileInput') fileInput;
submitStatus: any; submitStatus: any;
submitStatusError: string = 'Error received, please try again.';
constructor( constructor(
private http: Http, private http: Http,
@ -111,7 +112,16 @@ export class AccountEditComponent implements OnInit {
console.log(this.submitStatus); console.log(this.submitStatus);
}, },
error => { 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"; this.submitStatus = "send_failed";
console.log(this.submitStatus); console.log(this.submitStatus);
} }
@ -159,7 +169,16 @@ export class AccountEditComponent implements OnInit {
console.log(this.submitStatus); console.log(this.submitStatus);
}, },
error => { 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"; this.submitStatus = "send_failed";
console.log(this.submitStatus); console.log(this.submitStatus);
} }

View file

@ -239,6 +239,7 @@ export class AddDataComponent {
this.storeList = null; this.storeList = null;
this.amount = null; this.amount = null;
this.transactionFormInvalid = true; this.transactionFormInvalid = true;
this.showAddStore = false;
} }
onSubmitPayroll() { onSubmitPayroll() {