Merge branch 'development' into finn/PayrollSubmit

This commit is contained in:
piratefinn 2017-09-19 15:37:17 +01:00
commit f1a6b1886f
16 changed files with 217 additions and 193 deletions

23
bin/build-releases Executable file
View file

@ -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"

View file

@ -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;
}

View file

@ -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,7 +16,7 @@ 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,
@ -25,7 +25,7 @@ export class RegisterComponent {
private api: ApiService,
) {
this.years = [];
let max = new Date().getFullYear() - 10,
const max = new Date().getFullYear() - 10,
min = max - 140;
for (let i = max; i >= min; i--) {
@ -57,15 +57,15 @@ export class RegisterComponent {
console.log(this.signupForm.isValid());
if (!this.signupForm.isValid() && !this.customerForm.isValid()) {
console.log("Not Valid!");
this.registerStatus = "validation_failed";
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;
const signupForm = this.signupForm.getForm().value;
const customerForm = this.customerForm.getForm().value;
let data = {
const data = {
token: signupForm.token,
usertype: signupForm.usertype,
email: signupForm.email,
@ -81,7 +81,7 @@ export class RegisterComponent {
.subscribe(
result => {
console.log('registered!');
this.registerStatus = "success";
this.registerStatus = 'success';
console.log(this.registerStatus);
this.router.navigate(['/dashboard']);
},
@ -90,13 +90,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) {
this.registerStatusError = 'There was a server error, please try again later.';
}
this.registerStatus = "send_failed";
this.registerStatus = 'send_failed';
console.log(this.registerStatus);
}
);
@ -105,15 +105,15 @@ export class RegisterComponent {
console.log(this.signupForm.isValid());
if (!this.signupForm.isValid() || !this.organisationForm.isValid()) {
console.log("Not Valid!");
this.registerStatus = "validation_failed";
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;
const signupForm = this.signupForm.getForm().value;
const organisationForm = this.organisationForm.getForm().value;
let data = {
const data = {
token: signupForm.token,
usertype: signupForm.usertype,
email: signupForm.email,
@ -130,7 +130,7 @@ export class RegisterComponent {
.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) {
this.registerStatusError = 'There was a server error, please try again later.';
}
this.registerStatus = "send_failed";
this.registerStatus = 'send_failed';
console.log(this.registerStatus);
}
);

View file

@ -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) {
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) {
this.submitStatusError = 'There was a server error, please try again later.';
}
this.submitStatus = "send_failed";
this.submitStatus = 'send_failed';
console.log(this.submitStatus);
}
);

View file

@ -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 = {
@ -75,11 +75,11 @@ export class AddDataComponent {
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,10 +88,10 @@ 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,
};
@ -132,15 +132,15 @@ 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
@ -151,9 +151,9 @@ export class AddDataComponent {
}
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 {
this.transactionFormInvalid = false;
@ -162,7 +162,7 @@ export class AddDataComponent {
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) {
@ -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) {
this.transactionFormStatusError = 'There was a server error, please try again later.';
}
this.transactionFormStatus = "send_failed";
this.transactionFormStatus = 'send_failed';
console.log(this.transactionFormStatus);
}
);
@ -251,12 +251,12 @@ export class AddDataComponent {
.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);
}
);
@ -270,12 +270,12 @@ export class AddDataComponent {
.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);
}
);
@ -289,12 +289,12 @@ export class AddDataComponent {
.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);
}
);

View file

@ -7,13 +7,13 @@ 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,
@ -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) {
this.feedbackFormStatusError = 'There was a server error, please try again later.';
}
this.feedbackFormStatus = "send_failed";
this.feedbackFormStatus = 'send_failed';
console.log(this.feedbackFormStatus);
}
);

View file

@ -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',
@ -41,11 +42,11 @@ export class TransactionLogComponent {
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');

View file

@ -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);
}

View file

@ -7,9 +7,8 @@ import { Location } from '@angular/common';
export class P404Component {
constructor(
private location: Location
) {
}
private location: Location,
) { }
goBack(): void {
this.location.back();

View file

@ -7,9 +7,8 @@ import { Location } from '@angular/common';
export class P500Component {
constructor(
private location: Location
) {
}
private location: Location,
) { }
goBack(): void {
this.location.back();

View file

@ -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
)
);
}
}

View file

@ -10,6 +10,7 @@ interface OrgData {
}
@Component({
// tslint:disable-next-line
selector: 'org-table',
templateUrl: 'org-table.component.html',
})

View file

@ -8,6 +8,7 @@ interface TransactionData {
}
@Component({
// tslint:disable-next-line
selector: '[transaction-result]',
templateUrl: 'transaction-result.component.html',
})