Merge pull request #61 from Pear-Trading/development
Release of categories
This commit is contained in:
commit
de6b547473
8 changed files with 2237 additions and 948 deletions
6
.gitattributes
vendored
6
.gitattributes
vendored
|
@ -15,3 +15,9 @@
|
||||||
*.PDF diff=astextplain
|
*.PDF diff=astextplain
|
||||||
*.rtf diff=astextplain
|
*.rtf diff=astextplain
|
||||||
*.RTF diff=astextplain
|
*.RTF diff=astextplain
|
||||||
|
|
||||||
|
# ensures font files are loaded as binary not text
|
||||||
|
*.ttf binary
|
||||||
|
*.eot binary
|
||||||
|
*.woff binary
|
||||||
|
*.woff2 binary
|
||||||
|
|
|
@ -2,6 +2,12 @@
|
||||||
|
|
||||||
# Next Release
|
# Next Release
|
||||||
|
|
||||||
|
# v0.1.2
|
||||||
|
|
||||||
|
* Removed unused button
|
||||||
|
* Added ability to choose category for transaction
|
||||||
|
* Added version bump on Angular
|
||||||
|
|
||||||
# v0.1.1
|
# v0.1.1
|
||||||
|
|
||||||
* Redid layout on circle customer view
|
* Redid layout on circle customer view
|
||||||
|
|
3194
package-lock.json
generated
3194
package-lock.json
generated
File diff suppressed because it is too large
Load diff
24
package.json
24
package.json
|
@ -20,14 +20,14 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@agm/core": "1.0.0-beta.2",
|
"@agm/core": "1.0.0-beta.2",
|
||||||
"@agm/js-marker-clusterer": "1.0.0-beta.2",
|
"@agm/js-marker-clusterer": "1.0.0-beta.2",
|
||||||
"@angular/common": "5.0.1",
|
"@angular/common": "5.2.0",
|
||||||
"@angular/compiler": "5.0.1",
|
"@angular/compiler": "5.2.0",
|
||||||
"@angular/core": "5.0.1",
|
"@angular/core": "5.2.0",
|
||||||
"@angular/forms": "5.0.1",
|
"@angular/forms": "5.2.0",
|
||||||
"@angular/platform-browser": "5.0.1",
|
"@angular/platform-browser": "5.2.0",
|
||||||
"@angular/platform-browser-dynamic": "5.0.1",
|
"@angular/platform-browser-dynamic": "5.2.0",
|
||||||
"@angular/router": "5.0.1",
|
"@angular/router": "5.2.0",
|
||||||
"@angular/upgrade": "5.0.1",
|
"@angular/upgrade": "5.2.0",
|
||||||
"@types/moment": "2.13.0",
|
"@types/moment": "2.13.0",
|
||||||
"chart.js": "2.7.1",
|
"chart.js": "2.7.1",
|
||||||
"core-js": "2.5.1",
|
"core-js": "2.5.1",
|
||||||
|
@ -37,15 +37,15 @@
|
||||||
"ng2-validation-manager": "0.5.3",
|
"ng2-validation-manager": "0.5.3",
|
||||||
"ngx-bootstrap": "2.0.0-beta.8",
|
"ngx-bootstrap": "2.0.0-beta.8",
|
||||||
"ngx-pagination": "3.0.3",
|
"ngx-pagination": "3.0.3",
|
||||||
"rxjs": "5.5.2",
|
"rxjs": "5.5.6",
|
||||||
"ts-helpers": "1.1.2",
|
"ts-helpers": "1.1.2",
|
||||||
"webpack": "3.8.1",
|
"webpack": "3.8.1",
|
||||||
"webpack-dev-server": "2.9.4",
|
"webpack-dev-server": "2.9.4",
|
||||||
"zone.js": "0.8.18"
|
"zone.js": "0.8.18"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular/cli": "1.5.0",
|
"@angular/cli": "1.6.4",
|
||||||
"@angular/compiler-cli": "5.0.1",
|
"@angular/compiler-cli": "5.2.0",
|
||||||
"@types/jasmine": "2.8.2",
|
"@types/jasmine": "2.8.2",
|
||||||
"@types/jasminewd2": "2.0.3",
|
"@types/jasminewd2": "2.0.3",
|
||||||
"@types/node": "8.0.52",
|
"@types/node": "8.0.52",
|
||||||
|
@ -61,6 +61,6 @@
|
||||||
"protractor": "5.2.0",
|
"protractor": "5.2.0",
|
||||||
"ts-node": "3.3.0",
|
"ts-node": "3.3.0",
|
||||||
"tslint": "5.8.0",
|
"tslint": "5.8.0",
|
||||||
"typescript": "2.4.2"
|
"typescript": "2.6.x"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,20 @@
|
||||||
<span class="help-block">Enter the amount spent, such as 5.35 for £5.35.</span>
|
<span class="help-block">Enter the amount spent, such as 5.35 for £5.35.</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-md-3 form-control-label" for="text-input">Category</label>
|
||||||
|
<div class="col-md-9">
|
||||||
|
<div class="input-group">
|
||||||
|
<select type="text" class="form-control" [(ngModel)]="categoryId" size="6">
|
||||||
|
<option value="">Uncategorised</option>
|
||||||
|
<option *ngFor="let category of categoryIdList, let i=index" [ngValue]="category" >
|
||||||
|
{{ categoryNameList[i] }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<span class="help-block"><strong>Optional:</strong> Choose the relevant Category for the purchase.</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label class="col-md-3 form-control-label" for="text-input"><strong>Organisation Name</strong></label>
|
<label class="col-md-3 form-control-label" for="text-input"><strong>Organisation Name</strong></label>
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
|
|
|
@ -30,6 +30,8 @@ export class AddDataComponent implements OnInit {
|
||||||
organisationTown: string;
|
organisationTown: string;
|
||||||
organisationPostcode: string;
|
organisationPostcode: string;
|
||||||
amount: number;
|
amount: number;
|
||||||
|
// Assumes Groceries is 1st category
|
||||||
|
categoryId: number = 1;
|
||||||
transactionAdditionType = 1;
|
transactionAdditionType = 1;
|
||||||
storeList = [];
|
storeList = [];
|
||||||
showAddStore = false;
|
showAddStore = false;
|
||||||
|
@ -37,6 +39,8 @@ export class AddDataComponent implements OnInit {
|
||||||
transactionFormInvalid = true;
|
transactionFormInvalid = true;
|
||||||
myDate: any;
|
myDate: any;
|
||||||
minDate: any;
|
minDate: any;
|
||||||
|
categoryIdList: number[] = [];
|
||||||
|
categoryNameList: string[] = [];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private formBuilder: FormBuilder,
|
private formBuilder: FormBuilder,
|
||||||
|
@ -64,6 +68,15 @@ export class AddDataComponent implements OnInit {
|
||||||
});
|
});
|
||||||
this.myDate = moment().format('YYYY-MM-DD[T]HH:mm');
|
this.myDate = moment().format('YYYY-MM-DD[T]HH:mm');
|
||||||
// this.myDate = new Date().toISOString().slice(0, 16);
|
// this.myDate = new Date().toISOString().slice(0, 16);
|
||||||
|
this.api.categoryList().subscribe(
|
||||||
|
result => {
|
||||||
|
this.setCategoryList(result.categories);
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
console.log('Retrieval Error');
|
||||||
|
console.log( error._body );
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
@ -71,6 +84,11 @@ export class AddDataComponent implements OnInit {
|
||||||
this.accountType = localStorage.getItem('usertype');
|
this.accountType = localStorage.getItem('usertype');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private setCategoryList(data: any) {
|
||||||
|
this.categoryIdList = Object.keys(data.ids).map(key => data.ids[key]);
|
||||||
|
this.categoryNameList = Object.keys(data.names).map(key => data.names[key]);
|
||||||
|
}
|
||||||
|
|
||||||
getMinDate() {
|
getMinDate() {
|
||||||
// gets the April 1st date of the current year
|
// gets the April 1st date of the current year
|
||||||
const aprilDate = moment().month(3).date(1);
|
const aprilDate = moment().month(3).date(1);
|
||||||
|
@ -170,6 +188,7 @@ export class AddDataComponent implements OnInit {
|
||||||
transaction_value : this.amount,
|
transaction_value : this.amount,
|
||||||
purchase_time : purchaseTime,
|
purchase_time : purchaseTime,
|
||||||
organisation_id : this.organisationId,
|
organisation_id : this.organisationId,
|
||||||
|
category : this.categoryId,
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
@ -178,6 +197,7 @@ export class AddDataComponent implements OnInit {
|
||||||
transaction_value : this.amount,
|
transaction_value : this.amount,
|
||||||
purchase_time : purchaseTime,
|
purchase_time : purchaseTime,
|
||||||
organisation_id : this.organisationId,
|
organisation_id : this.organisationId,
|
||||||
|
category : this.categoryId,
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
|
@ -189,6 +209,7 @@ export class AddDataComponent implements OnInit {
|
||||||
street_name : this.submitOrg.street_name,
|
street_name : this.submitOrg.street_name,
|
||||||
town : this.submitOrg.town,
|
town : this.submitOrg.town,
|
||||||
postcode : this.submitOrg.postcode,
|
postcode : this.submitOrg.postcode,
|
||||||
|
category : this.categoryId,
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,15 +4,6 @@
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<h4 class="card-title mb-0">All Purchases</h4>
|
<h4 class="card-title mb-0">All Purchases</h4>
|
||||||
</div><!--/.col-->
|
</div><!--/.col-->
|
||||||
<div class="col-sm-4 hidden-sm-down">
|
|
||||||
<div class="btn-toolbar float-right" role="toolbar" aria-label="Toolbar with button groups">
|
|
||||||
<div class="btn-group mr-3" data-toggle="buttons" aria-label="First group">
|
|
||||||
<label class="btn btn-outline-secondary active">
|
|
||||||
<input type="radio" name="options" id="option2" checked> Week
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div><!--/.col-->
|
|
||||||
</div><!--/.row-->
|
</div><!--/.row-->
|
||||||
<div class="chart-wrapper">
|
<div class="chart-wrapper">
|
||||||
<canvas baseChart class="chart"
|
<canvas baseChart class="chart"
|
||||||
|
|
|
@ -116,6 +116,17 @@ export class ApiService {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Basic Customer User stats API
|
||||||
|
public categoryList() {
|
||||||
|
const key = this.sessionKey;
|
||||||
|
return this.http.post<any>(
|
||||||
|
this.apiUrl + '/search/category',
|
||||||
|
{
|
||||||
|
session_key : key,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Searches organisations used for transaction submission
|
// Searches organisations used for transaction submission
|
||||||
|
|
||||||
public search(data) {
|
public search(data) {
|
||||||
|
|
Reference in a new issue