Merge remote-tracking branch 'origin/development' into theslby/pushapi

This commit is contained in:
Unknown 2018-03-13 16:33:59 +00:00
commit 9997cf7ee5
7 changed files with 3586 additions and 2394 deletions

View file

@ -2,8 +2,15 @@
# Next Release
# v0.1.4
* Amended category list on transaction submission
* Added budget view for weekly breakdown of spend by category
* Added flag to make purchases essential
* Fixed budget view issues and amended it to show essential purchases that week
* Added ability to make purchases recurring
* Updated Moment dependency due to security issue
* Fixed category uploading in upload
# v0.1.3

5860
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
{
"name": "localloop-web",
"version": "0.1.3",
"version": "0.1.4",
"description": "LocalLoop Web - Web interface for LocalLoop app",
"author": "",
"url": "http://www.peartrade.org",
@ -38,7 +38,7 @@
"core-js": "2.5.1",
"http-server": "0.11.1",
"js-marker-clusterer": "1.0.0",
"moment": "2.19.2",
"moment": "^2.21.0",
"ng2-charts": "1.6.0",
"ng2-validation-manager": "0.5.3",
"ngx-bootstrap": "2.0.0-beta.8",
@ -48,11 +48,11 @@
"ts-helpers": "1.1.2",
"web-push": "3.2.5",
"webpack": "3.8.1",
"webpack-dev-server": "2.9.4",
"webpack-dev-server": "3.1.0",
"zone.js": "0.8.18"
},
"devDependencies": {
"@angular/cli": "1.6.4",
"@angular/cli": "1.7.3",
"@angular/compiler-cli": "5.2.0",
"@types/jasmine": "2.8.2",
"@types/jasminewd2": "2.0.3",

View file

@ -33,30 +33,65 @@
<span class="help-block">Tick if the purchase is deemed an essential purchase for budgeting purposes.</span>
</div>
</div>
<div class="form-group row">
<label class="col-md-3 form-control-label" for="text-input">Recurring Purchase</label>
<div class="col-md-9">
<div class="input-group">
<input type="checkbox" class="mr-auto" [(ngModel)]="recurringPurchase" (ngModelChange)="transactionFormValidate()">
</div>
<span class="help-block">Tick if the purchase frequently recurs, such as monthly.</span>
</div>
</div>
<div *ngIf="recurringPurchase" class="form-group row">
<label class="col-md-3 form-control-label" for="text-input"><strong>Recurring Period</strong></label>
<div class="col-md-9">
<div class="row">
<div class="col-md-6">
<div>
<input value="daily" type="radio" name="daily" [(ngModel)]="recurringType" (ngModelChange)="transactionFormValidate()">
<label>Daily</label>
</div>
<div>
<input value="weekly" type="radio" name="weekly" [(ngModel)]="recurringType" (ngModelChange)="transactionFormValidate()">
<label>Weekly</label>
</div>
<div>
<input value="fortnightly" type="radio" name="fortnightly" [(ngModel)]="recurringType" (ngModelChange)="transactionFormValidate()">
<label>Fortnightly</label>
</div>
</div>
<div class="col-md-6">
<div>
<input value="monthly" type="radio" name="monthly" [(ngModel)]="recurringType" (ngModelChange)="transactionFormValidate()">
<label>Monthly</label>
</div>
<div>
<input value="quarterly" type="radio" name="quarterly" [(ngModel)]="recurringType" (ngModelChange)="transactionFormValidate()">
<label>Quarterly</label>
</div>
</div>
</div>
<span class="help-block">Please give the period of time the purchase will recur from "Time of Transaction".</span>
</div>
</div>
<div class="form-group row">
<label class="col-md-3 form-control-label" for="text-input">Budget Type</label>
<div class="col-md-9">
<div class="row">
<div class="col-md-6">
<div>
<label>
<input value="" type="radio" name="radios" [(ngModel)]="categoryId">
Uncategorised
</label>
<input value="" type="radio" name="radios" [(ngModel)]="categoryId">
<label>Uncategorised</label>
</div>
<div class="radio" *ngFor="let category of leftCategoryIdList, let i=index">
<label>
<input [value]="category" type="radio" name="radios" [(ngModel)]="categoryId">
{{ categoryNameList[i] }}
</label>
<input [value]="category" type="radio" name="radios" [(ngModel)]="categoryId">
<label>{{ leftCategoryNameList[i] }}</label>
</div>
</div>
<div class="col-md-6">
<div class="radio" *ngFor="let category2 of rightCategoryIdList, let i=index">
<label>
<input [value]="category2" type="radio" name="radios" [(ngModel)]="categoryId">
{{ categoryNameList[category2 - 1] }}
</label>
<input [value]="category2" type="radio" name="radios" [(ngModel)]="categoryId">
<label>{{ rightCategoryNameList[i] }}</label>
</div>
</div>
</div>

View file

@ -33,6 +33,8 @@ export class AddDataComponent implements OnInit {
// Assumes Groceries is 1st category
categoryId: number = 1;
essentialPurchase = false;
recurringPurchase = false;
recurringType: string;
transactionAdditionType = 1;
storeList = [];
showAddStore = false;
@ -42,7 +44,8 @@ export class AddDataComponent implements OnInit {
minDate: any;
leftCategoryIdList: number[] = [];
rightCategoryIdList: number[] = [];
categoryNameList: string[] = [];
leftCategoryNameList: number[] = [];
rightCategoryNameList: number[] = [];
constructor(
private formBuilder: FormBuilder,
@ -88,10 +91,12 @@ export class AddDataComponent implements OnInit {
private setCategoryList(data: any) {
let categoryIdList = Object.keys(data.ids).map(key => data.ids[key]);
this.categoryNameList = Object.keys(data.names).map(key => data.names[key]);
let categoryNameList = Object.keys(data.names).map(key => data.names[key]);
let halfLength = Math.floor(categoryIdList.length / 2);
this.leftCategoryIdList = categoryIdList.splice(0, halfLength);
this.leftCategoryNameList = categoryNameList.splice(0, halfLength);
this.rightCategoryIdList = categoryIdList;
this.rightCategoryNameList = categoryNameList;
}
getMinDate() {
@ -174,7 +179,9 @@ export class AddDataComponent implements OnInit {
transactionFormValidate() {
if (this.submitOrg.name.length === 0 ||
this.submitOrg.town.length === 0 ||
this.amount === 0 ) {
this.amount === 0 ||
this.recurringPurchase &&
!this.recurringType) {
this.transactionFormInvalid = true;
} else {
this.transactionFormInvalid = false;
@ -195,6 +202,7 @@ export class AddDataComponent implements OnInit {
organisation_id : this.organisationId,
category : this.categoryId,
essential : this.essentialPurchase,
recurring : this.recurringType,
};
break;
case 2:
@ -203,7 +211,9 @@ export class AddDataComponent implements OnInit {
transaction_value : this.amount,
purchase_time : purchaseTime,
organisation_id : this.organisationId,
category : this.categoryId,
essential : this.essentialPurchase,
recurring : this.recurringType,
};
break;
case 3:
@ -215,7 +225,9 @@ export class AddDataComponent implements OnInit {
street_name : this.submitOrg.street_name,
town : this.submitOrg.town,
postcode : this.submitOrg.postcode,
category : this.categoryId,
essential : this.essentialPurchase,
recurring : this.recurringType,
};
break;
}
@ -266,6 +278,9 @@ export class AddDataComponent implements OnInit {
this.amount = null;
this.transactionFormInvalid = true;
this.showAddStore = false;
this.essentialPurchase = false;
this.recurringPurchase = false;
this.recurringType = null;
}
onSubmitPayroll() {

View file

@ -9,8 +9,8 @@
</div><!--/.col-->
</div><!--/.row-->
<div class="chart-wrapper">
<ul class="horizontal-bars type-2">
<li *ngIf="weekList1 !== undefined">
<ul *ngIf="weekList1" class="horizontal-bars type-2">
<li *ngIf="weekEssential1">
<span class="title">Essential Purchases</span>
<span class="value">{{ ( weekEssential1.value || 0 ) | currency:'GBP':'symbol':'1.2-2' }} <span class="text-muted small">
({{ (weekEssential1.value || 0 ) / weekListValueSum1 | percent:'1.0-0' }})</span></span>
@ -32,7 +32,7 @@
</div>
</div>
</li>
<div *ngIf="weekList1 !== undefined">
<div *ngIf="weekList1">
<li *ngIf="weekList1.length > categoryLimit1 && disableCategoryButton1 == false" class="divider text-center">
<button type="button" class="btn btn-sm btn-link text-muted" (click)="loadMore1()"><i class="icon-options"></i></button>
</li>
@ -51,8 +51,8 @@
</div><!--/.col-->
</div><!--/.row-->
<div class="chart-wrapper">
<ul class="horizontal-bars type-2">
<li *ngIf="weekList2 !== undefined">
<ul *ngIf="weekList2" class="horizontal-bars type-2">
<li *ngIf="weekEssential2">
<span class="title">Essential Purchases</span>
<span class="value">{{ ( weekEssential2.value || 0 ) | currency:'GBP':'symbol':'1.2-2' }} <span class="text-muted small">
({{ (weekEssential2.value || 0 ) / weekListValueSum2 | percent:'1.0-0' }})</span></span>
@ -74,7 +74,7 @@
</div>
</div>
</li>
<div *ngIf="!weekList2 == null">
<div *ngIf="weekList2">
<li *ngIf="weekList2.length > categoryLimit2 && disableCategoryButtonFirst == false" class="divider text-center">
<button type="button" class="btn btn-sm btn-link text-muted" (click)="loadMore2()"><i class="icon-options"></i></button>
</li>
@ -93,8 +93,8 @@
</div><!--/.col-->
</div><!--/.row-->
<div class="chart-wrapper">
<ul class="horizontal-bars type-2">
<li *ngIf="weekList3 !== undefined">
<ul *ngIf="weekList3" class="horizontal-bars type-2">
<li *ngIf="weekEssential3">
<span class="title">Essential Purchases</span>
<span class="value">{{ ( weekEssential1.value || 0 ) | currency:'GBP':'symbol':'1.2-2' }} <span class="text-muted small">
({{ (weekEssential3.value || 0 ) / weekListValueSum3 | percent:'1.0-0' }})</span></span>
@ -116,7 +116,7 @@
</div>
</div>
</li>
<div *ngIf="weekList3 !== undefined">
<div *ngIf="weekList3">
<li *ngIf="weekList3.length > categoryLimit3 && disableCategoryButtonFirst == false" class="divider text-center">
<button type="button" class="btn btn-sm btn-link text-muted" (click)="loadMore3()"><i class="icon-options"></i></button>
</li>
@ -135,8 +135,8 @@
</div><!--/.col-->
</div><!--/.row-->
<div class="chart-wrapper">
<ul class="horizontal-bars type-2">
<li *ngIf="weekList4 !== undefined">
<ul *ngIf="weekList4" class="horizontal-bars type-2">
<li *ngIf="weekEssential4">
<span class="title">Essential Purchases</span>
<span class="value">{{ ( weekEssential4.value || 0 ) | currency:'GBP':'symbol':'1.2-2' }} <span class="text-muted small">
({{ (weekEssential4.value || 0 ) / weekListValueSum4 | percent:'1.0-0' }})</span></span>
@ -158,7 +158,7 @@
</div>
</div>
</li>
<div *ngIf="!weekList4 == null">
<div *ngIf="weekList4">
<li *ngIf="weekList4.length > categoryLimit4 && disableCategoryButtonFirst == false" class="divider text-center">
<button type="button" class="btn btn-sm btn-link text-muted" (click)="loadMore4()"><i class="icon-options"></i></button>
</li>

View file

@ -94,7 +94,6 @@ export class CategoryMonthComponent implements OnInit {
this.weekList4 = prop(data.data.categories, this.myWeek4);
this.getMaxValue(this.weekList1, this.weekList2, this.weekList3, this.weekList4);
this.weekEssential1 = prop(data.data.essentials, this.myWeek1);
console.log(this.weekEssential1);
this.weekEssential2 = prop(data.data.essentials, this.myWeek2);
this.weekEssential3 = prop(data.data.essentials, this.myWeek3);
this.weekEssential4 = prop(data.data.essentials, this.myWeek4);