From 10664f0da9203772e982b56ebb9ad3db145fc21b Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Tue, 19 Sep 2017 10:59:08 +0100 Subject: [PATCH 01/13] Added script for automating prod and dev builds --- bin/build-releases | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 bin/build-releases diff --git a/bin/build-releases b/bin/build-releases new file mode 100755 index 0000000..0a840d2 --- /dev/null +++ b/bin/build-releases @@ -0,0 +1,23 @@ +#! /bin/bash + +VERSION=`git describe --tags` + +echo "Building releases for $VERSION" + +echo "Building Prod Release..." + +ng build --prod + +tar -czf ../LocalLoop-Web-prod-$VERSION.tar.gz dist + +echo "Building Dev Release..." + +ng build --dev + +tar -cvzf ../LocalLoop-Web-dev-$VERSION.tar.gz dist + +echo "Cleaning up build artefacts..." + +rm -rf dist + +echo "Done" From 49be004bbc1e3e821927fc244be9aa9ff79dc217 Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Tue, 19 Sep 2017 11:04:59 +0100 Subject: [PATCH 02/13] whitespace changes for pages 404 --- src/app/pages/404.component.html | 6 +++--- src/app/pages/404.component.ts | 11 +++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/app/pages/404.component.html b/src/app/pages/404.component.html index e76245d..cd46b4d 100644 --- a/src/app/pages/404.component.html +++ b/src/app/pages/404.component.html @@ -7,9 +7,9 @@

Oops! You're lost.

The page you are looking for was not found.

- - - + + + diff --git a/src/app/pages/404.component.ts b/src/app/pages/404.component.ts index 0e91023..b309577 100644 --- a/src/app/pages/404.component.ts +++ b/src/app/pages/404.component.ts @@ -7,11 +7,10 @@ import { Location } from '@angular/common'; export class P404Component { constructor( - private location: Location - ) { - } + private location: Location, + ) { } - goBack(): void { - this.location.back(); -} + goBack(): void { + this.location.back(); + } } From baf64ff4b7ee1f4f561ee76b6747eaeec6ca3443 Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Tue, 19 Sep 2017 11:06:41 +0100 Subject: [PATCH 03/13] whitespace changes for linter in pages 500 --- src/app/pages/500.component.html | 4 ++-- src/app/pages/500.component.ts | 13 ++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/app/pages/500.component.html b/src/app/pages/500.component.html index c08396f..e09fae4 100644 --- a/src/app/pages/500.component.html +++ b/src/app/pages/500.component.html @@ -8,8 +8,8 @@

The page you are looking for is temporarily unavailable.

- - + + diff --git a/src/app/pages/500.component.ts b/src/app/pages/500.component.ts index fa459e6..a80ff31 100644 --- a/src/app/pages/500.component.ts +++ b/src/app/pages/500.component.ts @@ -7,11 +7,10 @@ import { Location } from '@angular/common'; export class P500Component { constructor( - private location: Location - ) { - } + private location: Location, + ) { } - goBack(): void { - this.location.back(); -} -} \ No newline at end of file + goBack(): void { + this.location.back(); + } +} From 8807ba6cc9c63da3bbec706b4a705496a83db691 Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Tue, 19 Sep 2017 11:09:30 +0100 Subject: [PATCH 04/13] linter errors in auth.guard.ts --- src/app/_guards/auth.guard.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/_guards/auth.guard.ts b/src/app/_guards/auth.guard.ts index 3e7a9fc..d267cf4 100644 --- a/src/app/_guards/auth.guard.ts +++ b/src/app/_guards/auth.guard.ts @@ -8,13 +8,13 @@ export class AuthGuard implements CanActivate { canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) { if (localStorage.getItem('sessionKey')) { - console.log('session key found') + 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') + console.log('no session key found'); this.router.navigate(['/login'], { queryParams: { returnUrl: state.url }}); return false; } From dec53b4630a1d81fed969f2cabd9bd20d6128671 Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Tue, 19 Sep 2017 11:10:56 +0100 Subject: [PATCH 05/13] Fix linter errors in full-layout --- src/app/layouts/full-layout.component.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/app/layouts/full-layout.component.ts b/src/app/layouts/full-layout.component.ts index 7007e35..af6b9bf 100644 --- a/src/app/layouts/full-layout.component.ts +++ b/src/app/layouts/full-layout.component.ts @@ -7,16 +7,15 @@ import { Router } from '@angular/router'; templateUrl: './full-layout.component.html', }) export class FullLayoutComponent implements OnInit { - displayName: any; + public displayName: string; + public disabled = false; + public status: {isopen: boolean} = {isopen: false}; constructor( private api: ApiService, private router: Router, ) {} - public disabled = false; - public status: {isopen: boolean} = {isopen: false}; - public toggled(open: boolean): void { console.log('Dropdown is now: ', open); } From 61ac856cc238dc838961a9969443b234032db189 Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Tue, 19 Sep 2017 14:48:22 +0100 Subject: [PATCH 06/13] fix linter errors on register component --- src/app/auth/register.component.ts | 162 ++++++++++++++--------------- 1 file changed, 81 insertions(+), 81 deletions(-) diff --git a/src/app/auth/register.component.ts b/src/app/auth/register.component.ts index bdb9815..d716340 100644 --- a/src/app/auth/register.component.ts +++ b/src/app/auth/register.component.ts @@ -1,6 +1,6 @@ import { Component } from '@angular/core'; import { Validators, FormBuilder, FormGroup } from '@angular/forms'; -import { ValidationManager } from "ng2-validation-manager"; +import { ValidationManager } from 'ng2-validation-manager'; import { Http, Response } from '@angular/http'; import { ApiService } from '../providers/api-service'; import {Router } from '@angular/router'; @@ -16,87 +16,87 @@ export class RegisterComponent { organisationForm: ValidationManager; years: Object[]; registerStatus: any; - registerStatusError: string = 'Error received, please try again.'; + registerStatusError = 'Error received, please try again.'; constructor( - private http: Http, - private formBuilder: FormBuilder, - private router: Router, - private api: ApiService, - ) { - this.years = []; - let max = new Date().getFullYear() - 10, - min = max - 140; + private http: Http, + private formBuilder: FormBuilder, + private router: Router, + private api: ApiService, + ) { + this.years = []; + const max = new Date().getFullYear() - 10, + min = max - 140; - for (let i = max; i>=min; i--){ - this.years.push(i); - } - this.signupForm = new ValidationManager({ - token: 'required', - usertype: 'required', - email: 'required|email', - password: 'required', - confirmpassword: 'required|equalTo:password' - }); - this.customerForm = new ValidationManager({ - display_name: 'required', - full_name: 'required', - postcode: 'required', - year_of_birth:'required', - }); - this.organisationForm = new ValidationManager({ - name: 'required', + for (let i = max; i >= min; i--) { + this.years.push(i); + } + this.signupForm = new ValidationManager({ + token: 'required', + usertype: 'required', + email: 'required|email', + password: 'required', + confirmpassword: 'required|equalTo:password' + }); + this.customerForm = new ValidationManager({ + display_name: 'required', + full_name: 'required', + postcode: 'required', + year_of_birth: 'required', + }); + this.organisationForm = new ValidationManager({ + name: 'required', sector: 'required', - street_name: 'required', - town: 'required', - postcode: 'required', - }); + street_name: 'required', + town: 'required', + postcode: 'required', + }); } onSubmitCustomer() { console.log(this.signupForm.isValid()); - if (!this.signupForm.isValid() && !this.customerForm.isValid()) { - console.log("Not Valid!"); - this.registerStatus = "validation_failed"; + if (!this.signupForm.isValid() && !this.customerForm.isValid()) { + console.log('Not Valid!'); + this.registerStatus = 'validation_failed'; console.log(this.registerStatus); - return; - } - let signupForm = this.signupForm.getForm().value; - let customerForm = this.customerForm.getForm().value; + return; + } + const signupForm = this.signupForm.getForm().value; + const customerForm = this.customerForm.getForm().value; - let data = { - token: signupForm.token, - usertype: signupForm.usertype, - email: signupForm.email, - password: signupForm.password, - display_name: customerForm.display_name, - full_name: customerForm.full_name, - postcode: customerForm.postcode, - year_of_birth:customerForm.year_of_birth, - }; - console.log(data); - this.api + const data = { + token: signupForm.token, + usertype: signupForm.usertype, + email: signupForm.email, + password: signupForm.password, + display_name: customerForm.display_name, + full_name: customerForm.full_name, + postcode: customerForm.postcode, + year_of_birth: customerForm.year_of_birth, + }; + console.log(data); + this.api .register(data) .subscribe( result => { console.log('registered!'); - this.registerStatus = "success"; + this.registerStatus = 'success'; console.log(this.registerStatus); - this.router.navigate(['/dashboard']); + this.router.navigate(['/dashboard']); }, error => { console.log('Register Error'); console.log(error); try { console.log(error.error); - let jsonError = error.json(); - console.log("boop"); + const jsonError = error.json(); + console.log('boop'); this.registerStatusError = '"' + jsonError.error + '" Error, ' + jsonError.message; - } catch(e) { + } 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); } ); @@ -104,33 +104,33 @@ export class RegisterComponent { onSubmitOrganisation() { console.log(this.signupForm.isValid()); - if (!this.signupForm.isValid() || !this.organisationForm.isValid()) { - console.log("Not Valid!"); - this.registerStatus = "validation_failed"; + if (!this.signupForm.isValid() || !this.organisationForm.isValid()) { + console.log('Not Valid!'); + this.registerStatus = 'validation_failed'; console.log(this.registerStatus); - return; - } - let signupForm = this.signupForm.getForm().value; - let organisationForm = this.organisationForm.getForm().value; + return; + } + const signupForm = this.signupForm.getForm().value; + const organisationForm = this.organisationForm.getForm().value; - let data = { - token: signupForm.token, - usertype: signupForm.usertype, - email: signupForm.email, - password: signupForm.password, - name: organisationForm.name, + const data = { + token: signupForm.token, + usertype: signupForm.usertype, + email: signupForm.email, + password: signupForm.password, + name: organisationForm.name, sector: organisationForm.sector, - street_name: organisationForm.street_name, - town: organisationForm.town, - postcode: organisationForm.postcode, - }; - console.log(data); - this.api + street_name: organisationForm.street_name, + town: organisationForm.town, + postcode: organisationForm.postcode, + }; + console.log(data); + this.api .register(data) .subscribe( result => { console.log('registered!'); - this.registerStatus = "success"; + this.registerStatus = 'success'; console.log(this.registerStatus); this.router.navigate(['/dashboard']); }, @@ -139,13 +139,13 @@ export class RegisterComponent { console.log(error); try { console.log(error.error); - let jsonError = error.json(); - console.log("boop"); + const jsonError = error.json(); + console.log('boop'); this.registerStatusError = '"' + jsonError.error + '" Error, ' + jsonError.message; - } catch(e) { + } 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); } ); From f6c058348132274a7e1706c86fd6d0cef5900e52 Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Tue, 19 Sep 2017 14:53:25 +0100 Subject: [PATCH 07/13] Fix linter errors in add-data component --- src/app/dashboard/add-data.component.ts | 100 ++++++++++++------------ 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/src/app/dashboard/add-data.component.ts b/src/app/dashboard/add-data.component.ts index f8c31e6..359c294 100644 --- a/src/app/dashboard/add-data.component.ts +++ b/src/app/dashboard/add-data.component.ts @@ -9,7 +9,7 @@ import 'rxjs/add/operator/map'; @Component({ templateUrl: 'add-data.component.html', }) -export class AddDataComponent { +export class AddDataComponent implements OnInit { payrollForm: FormGroup; singleSupplierForm: FormGroup; employeeForm: FormGroup; @@ -18,7 +18,7 @@ export class AddDataComponent { singleSupplierFormStatus: any; employeeFormStatus: any; transactionFormStatus: any; - transactionFormStatusError: string = 'Error received, please try again.'; + transactionFormStatusError = 'Error received, please try again.'; accountType: any; submitOrg = { @@ -41,20 +41,20 @@ export class AddDataComponent { constructor( private http: Http, - private formBuilder: FormBuilder, - private api: ApiService, - ) { + private formBuilder: FormBuilder, + private api: ApiService, + ) { this.payrollForm = this.formBuilder.group({ - entry_period: ['', [Validators.required]], - employee_amount: ['', [Validators.required]], - local_employee_amount: ['', [Validators.required]], - gross_payroll: ['', [Validators.required]], + entry_period: ['', [Validators.required]], + employee_amount: ['', [Validators.required]], + local_employee_amount: ['', [Validators.required]], + gross_payroll: ['', [Validators.required]], payroll_income_tax: ['', [Validators.required]], payroll_employee_ni: ['', [Validators.required]], payroll_employer_ni: ['', [Validators.required]], payroll_total_pension: ['', [Validators.required]], payroll_other_benefit: ['', [Validators.required]], - }); + }); this.employeeForm = this.formBuilder.group({ entry_period: ['', [Validators.required]], employee_no: ['', [Validators.required]], @@ -63,7 +63,7 @@ export class AddDataComponent { employee_ni: ['', [Validators.required]], employee_pension: ['', [Validators.required]], employee_other_benefit: ['', [Validators.required]], - }); + }); this.myDate = moment().format('YYYY-MM-DD[T]HH:mm'); // this.myDate = new Date().toISOString().slice(0, 16); } @@ -73,13 +73,13 @@ export class AddDataComponent { this.accountType = localStorage.getItem('usertype'); } - getMinDate(){ + getMinDate() { // gets the April 1st date of the current year - let aprilDate = moment().month(3).date(1); - let now = moment(); + const aprilDate = moment().month(3).date(1); + const now = moment(); // Checks if current time is before April 1st, if so returns true - let beforeApril = now.isBefore(aprilDate); - if ( beforeApril == true ) { + const beforeApril = now.isBefore(aprilDate); + if ( beforeApril === true ) { this.minDate = aprilDate.subtract(2, 'years').format('YYYY-MM-DD'); } else { this.minDate = aprilDate.subtract(1, 'years').format('YYYY-MM-DD'); @@ -88,16 +88,16 @@ export class AddDataComponent { initializeItems() { // Dont bother searching for an empty or undefined string - if ( this.submitOrg.name == '' ) { + if ( this.submitOrg.name === '' ) { return; } - var searchData = { + const searchData = { search_name: this.submitOrg.name, }; this.api.search(searchData).subscribe( data => { - if(data.validated.length > 0) { + if (data.validated.length > 0) { this.storeList = data.validated; this.showAddStore = false; this.transactionAdditionType = 1; @@ -107,7 +107,7 @@ export class AddDataComponent { this.transactionAdditionType = 2; } // handle the case when the storelist is empty - if(this.storeList.length < 1 ) { + if (this.storeList.length < 1) { this.storeList = null; this.showAddStore = true; this.transactionAdditionType = 3; @@ -120,7 +120,7 @@ export class AddDataComponent { } // if user select a item from the list - addStore(store){ + addStore(store) { this.submitOrg = store; this.transactionFormValidate(); this.organisationId = store.id; @@ -132,40 +132,40 @@ export class AddDataComponent { this.initializeItems(); // set val to the value of the searchbar - let val = ev.target.value; + const val = ev.target.value; // Filter the store list so search seems quicker - if (val && val.trim() != '' && this.storeList != null) { + if (val && val.trim() !== '' && this.storeList !== null) { this.storeList = this.storeList.filter( (item) => { return ( item.name.toLowerCase().indexOf( val.toLowerCase() ) > -1 ); } - ) + ); } // if nothing is found - if(!this.storeList === null){ + if (!this.storeList === null) { // display add new store button this.showAddStore = true; } } transactionFormValidate() { - if( this.submitOrg.name.length == 0 || - this.submitOrg.town.length == 0 || - this.amount == 0 ) { + if (this.submitOrg.name.length === 0 || + this.submitOrg.town.length === 0 || + this.amount === 0 ) { this.transactionFormInvalid = true; - }else{ + } else { this.transactionFormInvalid = false; } } public postTransaction() { - var myParams: any; + let myParams: any; let purchaseTime: string; purchaseTime = moment(this.myDate, 'YYYY-MM-DD[T]HH:mm').local().format('YYYY-MM-DD[T]HH:mm:ss.SSSZ'); - switch(this.transactionAdditionType){ + switch (this.transactionAdditionType) { case 1: myParams = { transaction_type : this.transactionAdditionType, @@ -200,16 +200,16 @@ export class AddDataComponent { .upload(myParams) .subscribe( result => { - if ( result.success == true ) { + if ( result.success === true ) { console.log('Successful Upload'); console.log(result); - this.transactionFormStatus = "success"; + this.transactionFormStatus = 'success'; console.log(this.transactionFormStatus); this.resetForm(); } else { console.log('Upload Error'); this.transactionFormStatusError = JSON.stringify(result.status) + 'Error, ' + JSON.stringify(result.message); - this.transactionFormStatus = "send_failed"; + this.transactionFormStatus = 'send_failed'; console.log(this.transactionFormStatus); } }, @@ -218,13 +218,13 @@ export class AddDataComponent { console.log(error); try { console.log(error.error); - let jsonError = error.json(); - console.log("boop"); + const jsonError = error.json(); + console.log('boop'); this.transactionFormStatusError = '"' + jsonError.error + '" Error, ' + jsonError.message; - } catch(e) { + } catch (e) { this.transactionFormStatusError = 'There was a server error, please try again later.'; } - this.transactionFormStatus = "send_failed"; + this.transactionFormStatus = 'send_failed'; console.log(this.transactionFormStatus); } ); @@ -244,57 +244,57 @@ export class AddDataComponent { } onSubmitPayroll() { - console.log(this.payrollForm.value); + console.log(this.payrollForm.value); - this.api + this.api .orgPayroll(this.payrollForm.value) .subscribe( result => { console.log('data submitted!'); - this.payrollFormStatus = "success"; + this.payrollFormStatus = 'success'; console.log(this.payrollFormStatus); }, error => { console.log( error._body ); - this.payrollFormStatus = "send_failed"; + this.payrollFormStatus = 'send_failed'; console.log(this.payrollFormStatus); } ); } onSubmitSingleSupplier() { - console.log(this.singleSupplierForm.value); + console.log(this.singleSupplierForm.value); - this.api + this.api .orgSupplier(this.singleSupplierForm.value) .subscribe( result => { console.log('data submitted!'); - this.singleSupplierFormStatus = "success"; + this.singleSupplierFormStatus = 'success'; console.log(this.singleSupplierFormStatus); }, error => { console.log( error._body ); - this.singleSupplierFormStatus = "send_failed"; + this.singleSupplierFormStatus = 'send_failed'; console.log(this.singleSupplierFormStatus); } ); } onSubmitEmployee() { - console.log(this.employeeForm.value); + console.log(this.employeeForm.value); - this.api + this.api .orgEmployee(this.employeeForm.value) .subscribe( result => { console.log('data submitted!'); - this.employeeFormStatus = "success"; + this.employeeFormStatus = 'success'; console.log(this.employeeFormStatus); }, error => { console.log( error._body ); - this.employeeFormStatus = "send_failed"; + this.employeeFormStatus = 'send_failed'; console.log(this.employeeFormStatus); } ); From 921b25718d7905f8c0b6560737bf80203d9d8ea4 Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Tue, 19 Sep 2017 14:56:07 +0100 Subject: [PATCH 08/13] Linter error fixes for account-edit component --- src/app/dashboard/account-edit.component.ts | 26 ++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/app/dashboard/account-edit.component.ts b/src/app/dashboard/account-edit.component.ts index 0cc6a51..cf5b14c 100644 --- a/src/app/dashboard/account-edit.component.ts +++ b/src/app/dashboard/account-edit.component.ts @@ -14,7 +14,7 @@ export class AccountEditComponent implements OnInit { accountType: any; // @ViewChild('fileInput') fileInput; submitStatus: any; - submitStatusError: string = 'Error received, please try again.'; + submitStatusError = 'Error received, please try again.'; constructor( private http: Http, @@ -72,7 +72,7 @@ export class AccountEditComponent implements OnInit { console.log(this.settingForm.valid); if (!this.settingForm.valid && !this.settingOrganisationForm.valid) { console.log('Not Valid!'); - this.submitStatus = "validation_failed"; + this.submitStatus = 'validation_failed'; console.log(this.submitStatus); return; } @@ -108,7 +108,7 @@ export class AccountEditComponent implements OnInit { .subscribe( result => { console.log('data submitted!'); - this.submitStatus = "success"; + this.submitStatus = 'success'; console.log(this.submitStatus); }, error => { @@ -116,13 +116,13 @@ export class AccountEditComponent implements OnInit { console.log(error); try { console.log(error.error); - let jsonError = error.json(); - console.log("boop"); + const jsonError = error.json(); + console.log('boop'); this.submitStatusError = '"' + jsonError.error + '" Error, ' + jsonError.message; - } catch(e) { + } 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); } ); @@ -132,7 +132,7 @@ export class AccountEditComponent implements OnInit { console.log(this.settingForm.valid); if (!this.settingForm.valid && !this.settingCustomerForm.valid) { console.log('Not Valid!'); - this.submitStatus = "validation_failed"; + this.submitStatus = 'validation_failed'; console.log(this.submitStatus); return; } @@ -165,7 +165,7 @@ export class AccountEditComponent implements OnInit { .subscribe( result => { console.log('data submitted!'); - this.submitStatus = "success"; + this.submitStatus = 'success'; console.log(this.submitStatus); }, error => { @@ -173,13 +173,13 @@ export class AccountEditComponent implements OnInit { console.log(error); try { console.log(error.error); - let jsonError = error.json(); - console.log("boop"); + const jsonError = error.json(); + console.log('boop'); this.submitStatusError = '"' + jsonError.error + '" Error, ' + jsonError.message; - } catch(e) { + } 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); } ); From 662d6be5c95b89c24fd966499ef6dcb5c9756ac3 Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Tue, 19 Sep 2017 14:59:19 +0100 Subject: [PATCH 09/13] Linter error fixes for feedback component --- src/app/dashboard/feedback.component.ts | 26 ++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/app/dashboard/feedback.component.ts b/src/app/dashboard/feedback.component.ts index 11d56d4..91ef375 100644 --- a/src/app/dashboard/feedback.component.ts +++ b/src/app/dashboard/feedback.component.ts @@ -7,18 +7,18 @@ import 'rxjs/add/operator/map'; @Component({ templateUrl: 'feedback.component.html', }) -export class FeedbackComponent { +export class FeedbackComponent implements OnInit { feedbackForm: FormGroup; loggedInEmail: string; - noEmail: boolean = false; + noEmail = false; username: any; feedbackFormStatus: any; - feedbackFormStatusError: string = 'Error received, please try again.'; + feedbackFormStatusError = 'Error received, please try again.'; constructor( private http: Http, - private formBuilder: FormBuilder, - private api: ApiService, + private formBuilder: FormBuilder, + private api: ApiService, ) { this.feedbackForm = this.formBuilder.group({ email: ['', [Validators.required]], @@ -28,7 +28,7 @@ export class FeedbackComponent { ngOnInit(): void { - if(localStorage.getItem('email')) { + if (localStorage.getItem('email')) { this.loggedInEmail = localStorage.getItem('email'); } console.log('loggedInEmail: ' + this.loggedInEmail); @@ -55,10 +55,10 @@ export class FeedbackComponent { .feedback(this.feedbackForm.value) .subscribe( result => { - if ( result.success == true ) { + if ( result.success === true ) { console.log('Successful Upload'); console.log(result); - this.feedbackFormStatus = "success"; + this.feedbackFormStatus = 'success'; console.log(this.feedbackFormStatus); this.feedbackForm.patchValue({ feedbacktext: '', @@ -66,7 +66,7 @@ export class FeedbackComponent { } else { console.log('Upload Error'); this.feedbackFormStatusError = JSON.stringify(result.status) + 'Error, ' + JSON.stringify(result.message); - this.feedbackFormStatus = "send_failed"; + this.feedbackFormStatus = 'send_failed'; console.log(this.feedbackFormStatus); } }, @@ -75,13 +75,13 @@ export class FeedbackComponent { console.log(error); try { console.log(error.error); - let jsonError = error.json(); - console.log("boop"); + const jsonError = error.json(); + console.log('boop'); this.feedbackFormStatusError = '"' + jsonError.error + '" Error, ' + jsonError.message; - } catch(e) { + } catch (e) { this.feedbackFormStatusError = 'There was a server error, please try again later.'; } - this.feedbackFormStatus = "send_failed"; + this.feedbackFormStatus = 'send_failed'; console.log(this.feedbackFormStatus); } ); From 0907134ff7c339141a2f68eb31d68a301ff96153 Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Tue, 19 Sep 2017 15:02:48 +0100 Subject: [PATCH 10/13] Fix linter errors for transaction-log component --- .../dashboard/transaction-log.component.ts | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/app/dashboard/transaction-log.component.ts b/src/app/dashboard/transaction-log.component.ts index f707e83..60c4e6f 100644 --- a/src/app/dashboard/transaction-log.component.ts +++ b/src/app/dashboard/transaction-log.component.ts @@ -12,12 +12,13 @@ import 'rxjs/add/operator/map'; @Component({ templateUrl: 'transaction-log.component.html', }) -export class TransactionLogComponent { +export class TransactionLogComponent implements OnInit { transactionList; noTransactionList = true; myDate: any; minDate: any; + public p: any; public paginateConfig: PaginationInstance = { id: 'transpaginate', @@ -28,8 +29,8 @@ export class TransactionLogComponent { constructor( private http: Http, - private api: ApiService, - ) { + private api: ApiService, + ) { this.myDate = moment().format('YYYY-MM-DD[T]HH:mm'); // this.myDate = new Date().toISOString().slice(0, 16); } @@ -39,13 +40,13 @@ export class TransactionLogComponent { this.loadTransactions(1); } - getMinDate(){ + getMinDate() { // gets the April 1st date of the current year - let aprilDate = moment().month(3).date(1); - let now = moment(); + const aprilDate = moment().month(3).date(1); + const now = moment(); // Checks if current time is before April 1st, if so returns true - let beforeApril = now.isBefore(aprilDate); - if ( beforeApril == true ) { + const beforeApril = now.isBefore(aprilDate); + if ( beforeApril === true ) { this.minDate = aprilDate.subtract(2, 'years').format('YYYY-MM-DD'); } else { this.minDate = aprilDate.subtract(1, 'years').format('YYYY-MM-DD'); @@ -56,9 +57,9 @@ export class TransactionLogComponent { console.log(logPage); this.api.transList(logPage).subscribe( result => { - if(result.transactions.length > 0) { + if (result.transactions.length > 0) { this.transactionList = result.transactions; - //TODO Rename in server + // TODO Rename in server this.paginateConfig.totalItems = result.page_no; this.paginateConfig.currentPage = logPage; this.noTransactionList = false; From a5b786a74955e0c64d8ff813440671a136d04ad5 Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Tue, 19 Sep 2017 15:04:49 +0100 Subject: [PATCH 11/13] Linter errors in dashboard-customer component --- src/app/dashboard/dashboard-customer.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/dashboard/dashboard-customer.component.ts b/src/app/dashboard/dashboard-customer.component.ts index dc8c9c6..09787e3 100644 --- a/src/app/dashboard/dashboard-customer.component.ts +++ b/src/app/dashboard/dashboard-customer.component.ts @@ -15,7 +15,7 @@ export class DashboardCustomerComponent implements OnInit { /* Setting up dashboard's main variables*/ name: any; - email:any; + email: any; myPearPoints: any; trends: any; myRank: any; From 8f164ca94a2979390fa7bc052a6c5b6d70d61862 Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Tue, 19 Sep 2017 15:19:50 +0100 Subject: [PATCH 12/13] ignore linter errors in org-result items --- src/app/shared/org-result.component.ts | 3 ++- src/app/shared/org-table.component.ts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/shared/org-result.component.ts b/src/app/shared/org-result.component.ts index d7c599f..f22fbea 100644 --- a/src/app/shared/org-result.component.ts +++ b/src/app/shared/org-result.component.ts @@ -9,6 +9,7 @@ interface OrgData { } @Component({ + // tslint:disable-next-line selector: '[org-result]', templateUrl: 'org-result.component.html', }) @@ -19,6 +20,6 @@ export class OrgResultComponent { public orgClick(): void { this.onClick.emit( this.org - ) + ); } } diff --git a/src/app/shared/org-table.component.ts b/src/app/shared/org-table.component.ts index 8e0979d..764385c 100644 --- a/src/app/shared/org-table.component.ts +++ b/src/app/shared/org-table.component.ts @@ -10,6 +10,7 @@ interface OrgData { } @Component({ + // tslint:disable-next-line selector: 'org-table', templateUrl: 'org-table.component.html', }) From e62a46c312067fd3b442cb7cce8671f82f3980fa Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Tue, 19 Sep 2017 15:21:03 +0100 Subject: [PATCH 13/13] Ignore linter error in transaction-result component --- src/app/shared/transaction-result.component.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/shared/transaction-result.component.ts b/src/app/shared/transaction-result.component.ts index 782830a..ed76a56 100644 --- a/src/app/shared/transaction-result.component.ts +++ b/src/app/shared/transaction-result.component.ts @@ -8,6 +8,7 @@ interface TransactionData { } @Component({ + // tslint:disable-next-line selector: '[transaction-result]', templateUrl: 'transaction-result.component.html', })