Merge branch 'development' into finn/PayrollSubmit
This commit is contained in:
commit
f1a6b1886f
16 changed files with 217 additions and 193 deletions
23
bin/build-releases
Executable file
23
bin/build-releases
Executable 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"
|
|
@ -8,13 +8,13 @@ export class AuthGuard implements CanActivate {
|
||||||
|
|
||||||
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
|
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
|
||||||
if (localStorage.getItem('sessionKey')) {
|
if (localStorage.getItem('sessionKey')) {
|
||||||
console.log('session key found')
|
console.log('session key found');
|
||||||
// logged in so return true
|
// logged in so return true
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// not logged in so redirect to login page with the return url
|
// 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 }});
|
this.router.navigate(['/login'], { queryParams: { returnUrl: state.url }});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { Validators, FormBuilder, FormGroup } from '@angular/forms';
|
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 { Http, Response } from '@angular/http';
|
||||||
import { ApiService } from '../providers/api-service';
|
import { ApiService } from '../providers/api-service';
|
||||||
import {Router } from '@angular/router';
|
import {Router } from '@angular/router';
|
||||||
|
@ -16,7 +16,7 @@ export class RegisterComponent {
|
||||||
organisationForm: ValidationManager;
|
organisationForm: ValidationManager;
|
||||||
years: Object[];
|
years: Object[];
|
||||||
registerStatus: any;
|
registerStatus: any;
|
||||||
registerStatusError: string = 'Error received, please try again.';
|
registerStatusError = 'Error received, please try again.';
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private http: Http,
|
private http: Http,
|
||||||
|
@ -25,10 +25,10 @@ export class RegisterComponent {
|
||||||
private api: ApiService,
|
private api: ApiService,
|
||||||
) {
|
) {
|
||||||
this.years = [];
|
this.years = [];
|
||||||
let max = new Date().getFullYear() - 10,
|
const max = new Date().getFullYear() - 10,
|
||||||
min = max - 140;
|
min = max - 140;
|
||||||
|
|
||||||
for (let i = max; i>=min; i--){
|
for (let i = max; i >= min; i--) {
|
||||||
this.years.push(i);
|
this.years.push(i);
|
||||||
}
|
}
|
||||||
this.signupForm = new ValidationManager({
|
this.signupForm = new ValidationManager({
|
||||||
|
@ -42,7 +42,7 @@ export class RegisterComponent {
|
||||||
display_name: 'required',
|
display_name: 'required',
|
||||||
full_name: 'required',
|
full_name: 'required',
|
||||||
postcode: 'required',
|
postcode: 'required',
|
||||||
year_of_birth:'required',
|
year_of_birth: 'required',
|
||||||
});
|
});
|
||||||
this.organisationForm = new ValidationManager({
|
this.organisationForm = new ValidationManager({
|
||||||
name: 'required',
|
name: 'required',
|
||||||
|
@ -57,15 +57,15 @@ export class RegisterComponent {
|
||||||
|
|
||||||
console.log(this.signupForm.isValid());
|
console.log(this.signupForm.isValid());
|
||||||
if (!this.signupForm.isValid() && !this.customerForm.isValid()) {
|
if (!this.signupForm.isValid() && !this.customerForm.isValid()) {
|
||||||
console.log("Not Valid!");
|
console.log('Not Valid!');
|
||||||
this.registerStatus = "validation_failed";
|
this.registerStatus = 'validation_failed';
|
||||||
console.log(this.registerStatus);
|
console.log(this.registerStatus);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let signupForm = this.signupForm.getForm().value;
|
const signupForm = this.signupForm.getForm().value;
|
||||||
let customerForm = this.customerForm.getForm().value;
|
const customerForm = this.customerForm.getForm().value;
|
||||||
|
|
||||||
let data = {
|
const data = {
|
||||||
token: signupForm.token,
|
token: signupForm.token,
|
||||||
usertype: signupForm.usertype,
|
usertype: signupForm.usertype,
|
||||||
email: signupForm.email,
|
email: signupForm.email,
|
||||||
|
@ -73,7 +73,7 @@ export class RegisterComponent {
|
||||||
display_name: customerForm.display_name,
|
display_name: customerForm.display_name,
|
||||||
full_name: customerForm.full_name,
|
full_name: customerForm.full_name,
|
||||||
postcode: customerForm.postcode,
|
postcode: customerForm.postcode,
|
||||||
year_of_birth:customerForm.year_of_birth,
|
year_of_birth: customerForm.year_of_birth,
|
||||||
};
|
};
|
||||||
console.log(data);
|
console.log(data);
|
||||||
this.api
|
this.api
|
||||||
|
@ -81,7 +81,7 @@ export class RegisterComponent {
|
||||||
.subscribe(
|
.subscribe(
|
||||||
result => {
|
result => {
|
||||||
console.log('registered!');
|
console.log('registered!');
|
||||||
this.registerStatus = "success";
|
this.registerStatus = 'success';
|
||||||
console.log(this.registerStatus);
|
console.log(this.registerStatus);
|
||||||
this.router.navigate(['/dashboard']);
|
this.router.navigate(['/dashboard']);
|
||||||
},
|
},
|
||||||
|
@ -90,13 +90,13 @@ export class RegisterComponent {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
try {
|
try {
|
||||||
console.log(error.error);
|
console.log(error.error);
|
||||||
let jsonError = error.json();
|
const jsonError = error.json();
|
||||||
console.log("boop");
|
console.log('boop');
|
||||||
this.registerStatusError = '"' + jsonError.error + '" Error, ' + jsonError.message;
|
this.registerStatusError = '"' + jsonError.error + '" Error, ' + jsonError.message;
|
||||||
} catch(e) {
|
} catch (e) {
|
||||||
this.registerStatusError = 'There was a server error, please try again later.';
|
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);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -105,15 +105,15 @@ export class RegisterComponent {
|
||||||
|
|
||||||
console.log(this.signupForm.isValid());
|
console.log(this.signupForm.isValid());
|
||||||
if (!this.signupForm.isValid() || !this.organisationForm.isValid()) {
|
if (!this.signupForm.isValid() || !this.organisationForm.isValid()) {
|
||||||
console.log("Not Valid!");
|
console.log('Not Valid!');
|
||||||
this.registerStatus = "validation_failed";
|
this.registerStatus = 'validation_failed';
|
||||||
console.log(this.registerStatus);
|
console.log(this.registerStatus);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let signupForm = this.signupForm.getForm().value;
|
const signupForm = this.signupForm.getForm().value;
|
||||||
let organisationForm = this.organisationForm.getForm().value;
|
const organisationForm = this.organisationForm.getForm().value;
|
||||||
|
|
||||||
let data = {
|
const data = {
|
||||||
token: signupForm.token,
|
token: signupForm.token,
|
||||||
usertype: signupForm.usertype,
|
usertype: signupForm.usertype,
|
||||||
email: signupForm.email,
|
email: signupForm.email,
|
||||||
|
@ -130,7 +130,7 @@ export class RegisterComponent {
|
||||||
.subscribe(
|
.subscribe(
|
||||||
result => {
|
result => {
|
||||||
console.log('registered!');
|
console.log('registered!');
|
||||||
this.registerStatus = "success";
|
this.registerStatus = 'success';
|
||||||
console.log(this.registerStatus);
|
console.log(this.registerStatus);
|
||||||
this.router.navigate(['/dashboard']);
|
this.router.navigate(['/dashboard']);
|
||||||
},
|
},
|
||||||
|
@ -139,13 +139,13 @@ export class RegisterComponent {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
try {
|
try {
|
||||||
console.log(error.error);
|
console.log(error.error);
|
||||||
let jsonError = error.json();
|
const jsonError = error.json();
|
||||||
console.log("boop");
|
console.log('boop');
|
||||||
this.registerStatusError = '"' + jsonError.error + '" Error, ' + jsonError.message;
|
this.registerStatusError = '"' + jsonError.error + '" Error, ' + jsonError.message;
|
||||||
} catch(e) {
|
} catch (e) {
|
||||||
this.registerStatusError = 'There was a server error, please try again later.';
|
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);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -14,7 +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.';
|
submitStatusError = 'Error received, please try again.';
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private http: Http,
|
private http: Http,
|
||||||
|
@ -72,7 +72,7 @@ export class AccountEditComponent implements OnInit {
|
||||||
console.log(this.settingForm.valid);
|
console.log(this.settingForm.valid);
|
||||||
if (!this.settingForm.valid && !this.settingOrganisationForm.valid) {
|
if (!this.settingForm.valid && !this.settingOrganisationForm.valid) {
|
||||||
console.log('Not Valid!');
|
console.log('Not Valid!');
|
||||||
this.submitStatus = "validation_failed";
|
this.submitStatus = 'validation_failed';
|
||||||
console.log(this.submitStatus);
|
console.log(this.submitStatus);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ export class AccountEditComponent implements OnInit {
|
||||||
.subscribe(
|
.subscribe(
|
||||||
result => {
|
result => {
|
||||||
console.log('data submitted!');
|
console.log('data submitted!');
|
||||||
this.submitStatus = "success";
|
this.submitStatus = 'success';
|
||||||
console.log(this.submitStatus);
|
console.log(this.submitStatus);
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
|
@ -116,13 +116,13 @@ export class AccountEditComponent implements OnInit {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
try {
|
try {
|
||||||
console.log(error.error);
|
console.log(error.error);
|
||||||
let jsonError = error.json();
|
const jsonError = error.json();
|
||||||
console.log("boop");
|
console.log('boop');
|
||||||
this.submitStatusError = '"' + jsonError.error + '" Error, ' + jsonError.message;
|
this.submitStatusError = '"' + jsonError.error + '" Error, ' + jsonError.message;
|
||||||
} catch(e) {
|
} catch (e) {
|
||||||
this.submitStatusError = 'There was a server error, please try again later.';
|
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);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -132,7 +132,7 @@ export class AccountEditComponent implements OnInit {
|
||||||
console.log(this.settingForm.valid);
|
console.log(this.settingForm.valid);
|
||||||
if (!this.settingForm.valid && !this.settingCustomerForm.valid) {
|
if (!this.settingForm.valid && !this.settingCustomerForm.valid) {
|
||||||
console.log('Not Valid!');
|
console.log('Not Valid!');
|
||||||
this.submitStatus = "validation_failed";
|
this.submitStatus = 'validation_failed';
|
||||||
console.log(this.submitStatus);
|
console.log(this.submitStatus);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -165,7 +165,7 @@ export class AccountEditComponent implements OnInit {
|
||||||
.subscribe(
|
.subscribe(
|
||||||
result => {
|
result => {
|
||||||
console.log('data submitted!');
|
console.log('data submitted!');
|
||||||
this.submitStatus = "success";
|
this.submitStatus = 'success';
|
||||||
console.log(this.submitStatus);
|
console.log(this.submitStatus);
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
|
@ -173,13 +173,13 @@ export class AccountEditComponent implements OnInit {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
try {
|
try {
|
||||||
console.log(error.error);
|
console.log(error.error);
|
||||||
let jsonError = error.json();
|
const jsonError = error.json();
|
||||||
console.log("boop");
|
console.log('boop');
|
||||||
this.submitStatusError = '"' + jsonError.error + '" Error, ' + jsonError.message;
|
this.submitStatusError = '"' + jsonError.error + '" Error, ' + jsonError.message;
|
||||||
} catch(e) {
|
} catch (e) {
|
||||||
this.submitStatusError = 'There was a server error, please try again later.';
|
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);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -9,7 +9,7 @@ import 'rxjs/add/operator/map';
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: 'add-data.component.html',
|
templateUrl: 'add-data.component.html',
|
||||||
})
|
})
|
||||||
export class AddDataComponent {
|
export class AddDataComponent implements OnInit {
|
||||||
payrollForm: FormGroup;
|
payrollForm: FormGroup;
|
||||||
singleSupplierForm: FormGroup;
|
singleSupplierForm: FormGroup;
|
||||||
employeeForm: FormGroup;
|
employeeForm: FormGroup;
|
||||||
|
@ -18,7 +18,7 @@ export class AddDataComponent {
|
||||||
singleSupplierFormStatus: any;
|
singleSupplierFormStatus: any;
|
||||||
employeeFormStatus: any;
|
employeeFormStatus: any;
|
||||||
transactionFormStatus: any;
|
transactionFormStatus: any;
|
||||||
transactionFormStatusError: string = 'Error received, please try again.';
|
transactionFormStatusError = 'Error received, please try again.';
|
||||||
accountType: any;
|
accountType: any;
|
||||||
|
|
||||||
submitOrg = {
|
submitOrg = {
|
||||||
|
@ -73,13 +73,13 @@ export class AddDataComponent {
|
||||||
this.accountType = localStorage.getItem('usertype');
|
this.accountType = localStorage.getItem('usertype');
|
||||||
}
|
}
|
||||||
|
|
||||||
getMinDate(){
|
getMinDate() {
|
||||||
// gets the April 1st date of the current year
|
// gets the April 1st date of the current year
|
||||||
let aprilDate = moment().month(3).date(1);
|
const aprilDate = moment().month(3).date(1);
|
||||||
let now = moment();
|
const now = moment();
|
||||||
// Checks if current time is before April 1st, if so returns true
|
// Checks if current time is before April 1st, if so returns true
|
||||||
let beforeApril = now.isBefore(aprilDate);
|
const beforeApril = now.isBefore(aprilDate);
|
||||||
if ( beforeApril == true ) {
|
if ( beforeApril === true ) {
|
||||||
this.minDate = aprilDate.subtract(2, 'years').format('YYYY-MM-DD');
|
this.minDate = aprilDate.subtract(2, 'years').format('YYYY-MM-DD');
|
||||||
} else {
|
} else {
|
||||||
this.minDate = aprilDate.subtract(1, 'years').format('YYYY-MM-DD');
|
this.minDate = aprilDate.subtract(1, 'years').format('YYYY-MM-DD');
|
||||||
|
@ -88,16 +88,16 @@ export class AddDataComponent {
|
||||||
|
|
||||||
initializeItems() {
|
initializeItems() {
|
||||||
// Dont bother searching for an empty or undefined string
|
// Dont bother searching for an empty or undefined string
|
||||||
if ( this.submitOrg.name == '' ) {
|
if ( this.submitOrg.name === '' ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var searchData = {
|
const searchData = {
|
||||||
search_name: this.submitOrg.name,
|
search_name: this.submitOrg.name,
|
||||||
};
|
};
|
||||||
|
|
||||||
this.api.search(searchData).subscribe(
|
this.api.search(searchData).subscribe(
|
||||||
data => {
|
data => {
|
||||||
if(data.validated.length > 0) {
|
if (data.validated.length > 0) {
|
||||||
this.storeList = data.validated;
|
this.storeList = data.validated;
|
||||||
this.showAddStore = false;
|
this.showAddStore = false;
|
||||||
this.transactionAdditionType = 1;
|
this.transactionAdditionType = 1;
|
||||||
|
@ -107,7 +107,7 @@ export class AddDataComponent {
|
||||||
this.transactionAdditionType = 2;
|
this.transactionAdditionType = 2;
|
||||||
}
|
}
|
||||||
// handle the case when the storelist is empty
|
// handle the case when the storelist is empty
|
||||||
if(this.storeList.length < 1 ) {
|
if (this.storeList.length < 1) {
|
||||||
this.storeList = null;
|
this.storeList = null;
|
||||||
this.showAddStore = true;
|
this.showAddStore = true;
|
||||||
this.transactionAdditionType = 3;
|
this.transactionAdditionType = 3;
|
||||||
|
@ -120,7 +120,7 @@ export class AddDataComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
// if user select a item from the list
|
// if user select a item from the list
|
||||||
addStore(store){
|
addStore(store) {
|
||||||
this.submitOrg = store;
|
this.submitOrg = store;
|
||||||
this.transactionFormValidate();
|
this.transactionFormValidate();
|
||||||
this.organisationId = store.id;
|
this.organisationId = store.id;
|
||||||
|
@ -132,40 +132,40 @@ export class AddDataComponent {
|
||||||
this.initializeItems();
|
this.initializeItems();
|
||||||
|
|
||||||
// set val to the value of the searchbar
|
// 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
|
// 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(
|
this.storeList = this.storeList.filter(
|
||||||
(item) => {
|
(item) => {
|
||||||
return ( item.name.toLowerCase().indexOf( val.toLowerCase() ) > -1 );
|
return ( item.name.toLowerCase().indexOf( val.toLowerCase() ) > -1 );
|
||||||
}
|
}
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if nothing is found
|
// if nothing is found
|
||||||
if(!this.storeList === null){
|
if (!this.storeList === null) {
|
||||||
// display add new store button
|
// display add new store button
|
||||||
this.showAddStore = true;
|
this.showAddStore = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
transactionFormValidate() {
|
transactionFormValidate() {
|
||||||
if( this.submitOrg.name.length == 0 ||
|
if (this.submitOrg.name.length === 0 ||
|
||||||
this.submitOrg.town.length == 0 ||
|
this.submitOrg.town.length === 0 ||
|
||||||
this.amount == 0 ) {
|
this.amount === 0 ) {
|
||||||
this.transactionFormInvalid = true;
|
this.transactionFormInvalid = true;
|
||||||
}else{
|
} else {
|
||||||
this.transactionFormInvalid = false;
|
this.transactionFormInvalid = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public postTransaction() {
|
public postTransaction() {
|
||||||
|
|
||||||
var myParams: any;
|
let myParams: any;
|
||||||
let purchaseTime: string;
|
let purchaseTime: string;
|
||||||
purchaseTime = moment(this.myDate, 'YYYY-MM-DD[T]HH:mm').local().format('YYYY-MM-DD[T]HH:mm:ss.SSSZ');
|
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:
|
case 1:
|
||||||
myParams = {
|
myParams = {
|
||||||
transaction_type : this.transactionAdditionType,
|
transaction_type : this.transactionAdditionType,
|
||||||
|
@ -200,16 +200,16 @@ export class AddDataComponent {
|
||||||
.upload(myParams)
|
.upload(myParams)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
result => {
|
result => {
|
||||||
if ( result.success == true ) {
|
if ( result.success === true ) {
|
||||||
console.log('Successful Upload');
|
console.log('Successful Upload');
|
||||||
console.log(result);
|
console.log(result);
|
||||||
this.transactionFormStatus = "success";
|
this.transactionFormStatus = 'success';
|
||||||
console.log(this.transactionFormStatus);
|
console.log(this.transactionFormStatus);
|
||||||
this.resetForm();
|
this.resetForm();
|
||||||
} else {
|
} else {
|
||||||
console.log('Upload Error');
|
console.log('Upload Error');
|
||||||
this.transactionFormStatusError = JSON.stringify(result.status) + 'Error, ' + JSON.stringify(result.message);
|
this.transactionFormStatusError = JSON.stringify(result.status) + 'Error, ' + JSON.stringify(result.message);
|
||||||
this.transactionFormStatus = "send_failed";
|
this.transactionFormStatus = 'send_failed';
|
||||||
console.log(this.transactionFormStatus);
|
console.log(this.transactionFormStatus);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -218,13 +218,13 @@ export class AddDataComponent {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
try {
|
try {
|
||||||
console.log(error.error);
|
console.log(error.error);
|
||||||
let jsonError = error.json();
|
const jsonError = error.json();
|
||||||
console.log("boop");
|
console.log('boop');
|
||||||
this.transactionFormStatusError = '"' + jsonError.error + '" Error, ' + jsonError.message;
|
this.transactionFormStatusError = '"' + jsonError.error + '" Error, ' + jsonError.message;
|
||||||
} catch(e) {
|
} catch (e) {
|
||||||
this.transactionFormStatusError = 'There was a server error, please try again later.';
|
this.transactionFormStatusError = 'There was a server error, please try again later.';
|
||||||
}
|
}
|
||||||
this.transactionFormStatus = "send_failed";
|
this.transactionFormStatus = 'send_failed';
|
||||||
console.log(this.transactionFormStatus);
|
console.log(this.transactionFormStatus);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -251,12 +251,12 @@ export class AddDataComponent {
|
||||||
.subscribe(
|
.subscribe(
|
||||||
result => {
|
result => {
|
||||||
console.log('data submitted!');
|
console.log('data submitted!');
|
||||||
this.payrollFormStatus = "success";
|
this.payrollFormStatus = 'success';
|
||||||
console.log(this.payrollFormStatus);
|
console.log(this.payrollFormStatus);
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
console.log( error._body );
|
console.log( error._body );
|
||||||
this.payrollFormStatus = "send_failed";
|
this.payrollFormStatus = 'send_failed';
|
||||||
console.log(this.payrollFormStatus);
|
console.log(this.payrollFormStatus);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -270,12 +270,12 @@ export class AddDataComponent {
|
||||||
.subscribe(
|
.subscribe(
|
||||||
result => {
|
result => {
|
||||||
console.log('data submitted!');
|
console.log('data submitted!');
|
||||||
this.singleSupplierFormStatus = "success";
|
this.singleSupplierFormStatus = 'success';
|
||||||
console.log(this.singleSupplierFormStatus);
|
console.log(this.singleSupplierFormStatus);
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
console.log( error._body );
|
console.log( error._body );
|
||||||
this.singleSupplierFormStatus = "send_failed";
|
this.singleSupplierFormStatus = 'send_failed';
|
||||||
console.log(this.singleSupplierFormStatus);
|
console.log(this.singleSupplierFormStatus);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -289,12 +289,12 @@ export class AddDataComponent {
|
||||||
.subscribe(
|
.subscribe(
|
||||||
result => {
|
result => {
|
||||||
console.log('data submitted!');
|
console.log('data submitted!');
|
||||||
this.employeeFormStatus = "success";
|
this.employeeFormStatus = 'success';
|
||||||
console.log(this.employeeFormStatus);
|
console.log(this.employeeFormStatus);
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
console.log( error._body );
|
console.log( error._body );
|
||||||
this.employeeFormStatus = "send_failed";
|
this.employeeFormStatus = 'send_failed';
|
||||||
console.log(this.employeeFormStatus);
|
console.log(this.employeeFormStatus);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -15,7 +15,7 @@ export class DashboardCustomerComponent implements OnInit {
|
||||||
|
|
||||||
/* Setting up dashboard's main variables*/
|
/* Setting up dashboard's main variables*/
|
||||||
name: any;
|
name: any;
|
||||||
email:any;
|
email: any;
|
||||||
myPearPoints: any;
|
myPearPoints: any;
|
||||||
trends: any;
|
trends: any;
|
||||||
myRank: any;
|
myRank: any;
|
||||||
|
|
|
@ -7,13 +7,13 @@ import 'rxjs/add/operator/map';
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: 'feedback.component.html',
|
templateUrl: 'feedback.component.html',
|
||||||
})
|
})
|
||||||
export class FeedbackComponent {
|
export class FeedbackComponent implements OnInit {
|
||||||
feedbackForm: FormGroup;
|
feedbackForm: FormGroup;
|
||||||
loggedInEmail: string;
|
loggedInEmail: string;
|
||||||
noEmail: boolean = false;
|
noEmail = false;
|
||||||
username: any;
|
username: any;
|
||||||
feedbackFormStatus: any;
|
feedbackFormStatus: any;
|
||||||
feedbackFormStatusError: string = 'Error received, please try again.';
|
feedbackFormStatusError = 'Error received, please try again.';
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private http: Http,
|
private http: Http,
|
||||||
|
@ -28,7 +28,7 @@ export class FeedbackComponent {
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
|
||||||
if(localStorage.getItem('email')) {
|
if (localStorage.getItem('email')) {
|
||||||
this.loggedInEmail = localStorage.getItem('email');
|
this.loggedInEmail = localStorage.getItem('email');
|
||||||
}
|
}
|
||||||
console.log('loggedInEmail: ' + this.loggedInEmail);
|
console.log('loggedInEmail: ' + this.loggedInEmail);
|
||||||
|
@ -55,10 +55,10 @@ export class FeedbackComponent {
|
||||||
.feedback(this.feedbackForm.value)
|
.feedback(this.feedbackForm.value)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
result => {
|
result => {
|
||||||
if ( result.success == true ) {
|
if ( result.success === true ) {
|
||||||
console.log('Successful Upload');
|
console.log('Successful Upload');
|
||||||
console.log(result);
|
console.log(result);
|
||||||
this.feedbackFormStatus = "success";
|
this.feedbackFormStatus = 'success';
|
||||||
console.log(this.feedbackFormStatus);
|
console.log(this.feedbackFormStatus);
|
||||||
this.feedbackForm.patchValue({
|
this.feedbackForm.patchValue({
|
||||||
feedbacktext: '',
|
feedbacktext: '',
|
||||||
|
@ -66,7 +66,7 @@ export class FeedbackComponent {
|
||||||
} else {
|
} else {
|
||||||
console.log('Upload Error');
|
console.log('Upload Error');
|
||||||
this.feedbackFormStatusError = JSON.stringify(result.status) + 'Error, ' + JSON.stringify(result.message);
|
this.feedbackFormStatusError = JSON.stringify(result.status) + 'Error, ' + JSON.stringify(result.message);
|
||||||
this.feedbackFormStatus = "send_failed";
|
this.feedbackFormStatus = 'send_failed';
|
||||||
console.log(this.feedbackFormStatus);
|
console.log(this.feedbackFormStatus);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -75,13 +75,13 @@ export class FeedbackComponent {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
try {
|
try {
|
||||||
console.log(error.error);
|
console.log(error.error);
|
||||||
let jsonError = error.json();
|
const jsonError = error.json();
|
||||||
console.log("boop");
|
console.log('boop');
|
||||||
this.feedbackFormStatusError = '"' + jsonError.error + '" Error, ' + jsonError.message;
|
this.feedbackFormStatusError = '"' + jsonError.error + '" Error, ' + jsonError.message;
|
||||||
} catch(e) {
|
} catch (e) {
|
||||||
this.feedbackFormStatusError = 'There was a server error, please try again later.';
|
this.feedbackFormStatusError = 'There was a server error, please try again later.';
|
||||||
}
|
}
|
||||||
this.feedbackFormStatus = "send_failed";
|
this.feedbackFormStatus = 'send_failed';
|
||||||
console.log(this.feedbackFormStatus);
|
console.log(this.feedbackFormStatus);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -12,12 +12,13 @@ import 'rxjs/add/operator/map';
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: 'transaction-log.component.html',
|
templateUrl: 'transaction-log.component.html',
|
||||||
})
|
})
|
||||||
export class TransactionLogComponent {
|
export class TransactionLogComponent implements OnInit {
|
||||||
|
|
||||||
transactionList;
|
transactionList;
|
||||||
noTransactionList = true;
|
noTransactionList = true;
|
||||||
myDate: any;
|
myDate: any;
|
||||||
minDate: any;
|
minDate: any;
|
||||||
|
public p: any;
|
||||||
|
|
||||||
public paginateConfig: PaginationInstance = {
|
public paginateConfig: PaginationInstance = {
|
||||||
id: 'transpaginate',
|
id: 'transpaginate',
|
||||||
|
@ -39,13 +40,13 @@ export class TransactionLogComponent {
|
||||||
this.loadTransactions(1);
|
this.loadTransactions(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
getMinDate(){
|
getMinDate() {
|
||||||
// gets the April 1st date of the current year
|
// gets the April 1st date of the current year
|
||||||
let aprilDate = moment().month(3).date(1);
|
const aprilDate = moment().month(3).date(1);
|
||||||
let now = moment();
|
const now = moment();
|
||||||
// Checks if current time is before April 1st, if so returns true
|
// Checks if current time is before April 1st, if so returns true
|
||||||
let beforeApril = now.isBefore(aprilDate);
|
const beforeApril = now.isBefore(aprilDate);
|
||||||
if ( beforeApril == true ) {
|
if ( beforeApril === true ) {
|
||||||
this.minDate = aprilDate.subtract(2, 'years').format('YYYY-MM-DD');
|
this.minDate = aprilDate.subtract(2, 'years').format('YYYY-MM-DD');
|
||||||
} else {
|
} else {
|
||||||
this.minDate = aprilDate.subtract(1, 'years').format('YYYY-MM-DD');
|
this.minDate = aprilDate.subtract(1, 'years').format('YYYY-MM-DD');
|
||||||
|
@ -56,9 +57,9 @@ export class TransactionLogComponent {
|
||||||
console.log(logPage);
|
console.log(logPage);
|
||||||
this.api.transList(logPage).subscribe(
|
this.api.transList(logPage).subscribe(
|
||||||
result => {
|
result => {
|
||||||
if(result.transactions.length > 0) {
|
if (result.transactions.length > 0) {
|
||||||
this.transactionList = result.transactions;
|
this.transactionList = result.transactions;
|
||||||
//TODO Rename in server
|
// TODO Rename in server
|
||||||
this.paginateConfig.totalItems = result.page_no;
|
this.paginateConfig.totalItems = result.page_no;
|
||||||
this.paginateConfig.currentPage = logPage;
|
this.paginateConfig.currentPage = logPage;
|
||||||
this.noTransactionList = false;
|
this.noTransactionList = false;
|
||||||
|
|
|
@ -7,16 +7,15 @@ import { Router } from '@angular/router';
|
||||||
templateUrl: './full-layout.component.html',
|
templateUrl: './full-layout.component.html',
|
||||||
})
|
})
|
||||||
export class FullLayoutComponent implements OnInit {
|
export class FullLayoutComponent implements OnInit {
|
||||||
displayName: any;
|
public displayName: string;
|
||||||
|
public disabled = false;
|
||||||
|
public status: {isopen: boolean} = {isopen: false};
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private api: ApiService,
|
private api: ApiService,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
public disabled = false;
|
|
||||||
public status: {isopen: boolean} = {isopen: false};
|
|
||||||
|
|
||||||
public toggled(open: boolean): void {
|
public toggled(open: boolean): void {
|
||||||
console.log('Dropdown is now: ', open);
|
console.log('Dropdown is now: ', open);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,11 +7,10 @@ import { Location } from '@angular/common';
|
||||||
export class P404Component {
|
export class P404Component {
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private location: Location
|
private location: Location,
|
||||||
) {
|
) { }
|
||||||
}
|
|
||||||
|
|
||||||
goBack(): void {
|
goBack(): void {
|
||||||
this.location.back();
|
this.location.back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,11 +7,10 @@ import { Location } from '@angular/common';
|
||||||
export class P500Component {
|
export class P500Component {
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private location: Location
|
private location: Location,
|
||||||
) {
|
) { }
|
||||||
}
|
|
||||||
|
|
||||||
goBack(): void {
|
goBack(): void {
|
||||||
this.location.back();
|
this.location.back();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -9,6 +9,7 @@ interface OrgData {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
// tslint:disable-next-line
|
||||||
selector: '[org-result]',
|
selector: '[org-result]',
|
||||||
templateUrl: 'org-result.component.html',
|
templateUrl: 'org-result.component.html',
|
||||||
})
|
})
|
||||||
|
@ -19,6 +20,6 @@ export class OrgResultComponent {
|
||||||
public orgClick(): void {
|
public orgClick(): void {
|
||||||
this.onClick.emit(
|
this.onClick.emit(
|
||||||
this.org
|
this.org
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ interface OrgData {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
// tslint:disable-next-line
|
||||||
selector: 'org-table',
|
selector: 'org-table',
|
||||||
templateUrl: 'org-table.component.html',
|
templateUrl: 'org-table.component.html',
|
||||||
})
|
})
|
||||||
|
|
|
@ -8,6 +8,7 @@ interface TransactionData {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
// tslint:disable-next-line
|
||||||
selector: '[transaction-result]',
|
selector: '[transaction-result]',
|
||||||
templateUrl: 'transaction-result.component.html',
|
templateUrl: 'transaction-result.component.html',
|
||||||
})
|
})
|
||||||
|
|
Reference in a new issue