Merge pull request #61 from Pear-Trading/development
Release of categories
This commit is contained in:
commit
9e122bf4bc
8 changed files with 2237 additions and 948 deletions
6
.gitattributes
vendored
6
.gitattributes
vendored
|
@ -15,3 +15,9 @@
|
|||
*.PDF 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
|
||||
|
||||
# v0.1.2
|
||||
|
||||
* Removed unused button
|
||||
* Added ability to choose category for transaction
|
||||
* Added version bump on Angular
|
||||
|
||||
# v0.1.1
|
||||
|
||||
* Redid layout on circle customer view
|
||||
|
|
3094
package-lock.json
generated
3094
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": {
|
||||
"@agm/core": "1.0.0-beta.2",
|
||||
"@agm/js-marker-clusterer": "1.0.0-beta.2",
|
||||
"@angular/common": "5.0.1",
|
||||
"@angular/compiler": "5.0.1",
|
||||
"@angular/core": "5.0.1",
|
||||
"@angular/forms": "5.0.1",
|
||||
"@angular/platform-browser": "5.0.1",
|
||||
"@angular/platform-browser-dynamic": "5.0.1",
|
||||
"@angular/router": "5.0.1",
|
||||
"@angular/upgrade": "5.0.1",
|
||||
"@angular/common": "5.2.0",
|
||||
"@angular/compiler": "5.2.0",
|
||||
"@angular/core": "5.2.0",
|
||||
"@angular/forms": "5.2.0",
|
||||
"@angular/platform-browser": "5.2.0",
|
||||
"@angular/platform-browser-dynamic": "5.2.0",
|
||||
"@angular/router": "5.2.0",
|
||||
"@angular/upgrade": "5.2.0",
|
||||
"@types/moment": "2.13.0",
|
||||
"chart.js": "2.7.1",
|
||||
"core-js": "2.5.1",
|
||||
|
@ -37,15 +37,15 @@
|
|||
"ng2-validation-manager": "0.5.3",
|
||||
"ngx-bootstrap": "2.0.0-beta.8",
|
||||
"ngx-pagination": "3.0.3",
|
||||
"rxjs": "5.5.2",
|
||||
"rxjs": "5.5.6",
|
||||
"ts-helpers": "1.1.2",
|
||||
"webpack": "3.8.1",
|
||||
"webpack-dev-server": "2.9.4",
|
||||
"zone.js": "0.8.18"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular/cli": "1.5.0",
|
||||
"@angular/compiler-cli": "5.0.1",
|
||||
"@angular/cli": "1.6.4",
|
||||
"@angular/compiler-cli": "5.2.0",
|
||||
"@types/jasmine": "2.8.2",
|
||||
"@types/jasminewd2": "2.0.3",
|
||||
"@types/node": "8.0.52",
|
||||
|
@ -61,6 +61,6 @@
|
|||
"protractor": "5.2.0",
|
||||
"ts-node": "3.3.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>
|
||||
</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">
|
||||
<label class="col-md-3 form-control-label" for="text-input"><strong>Organisation Name</strong></label>
|
||||
<div class="col-md-9">
|
||||
|
|
|
@ -30,6 +30,8 @@ export class AddDataComponent implements OnInit {
|
|||
organisationTown: string;
|
||||
organisationPostcode: string;
|
||||
amount: number;
|
||||
// Assumes Groceries is 1st category
|
||||
categoryId: number = 1;
|
||||
transactionAdditionType = 1;
|
||||
storeList = [];
|
||||
showAddStore = false;
|
||||
|
@ -37,6 +39,8 @@ export class AddDataComponent implements OnInit {
|
|||
transactionFormInvalid = true;
|
||||
myDate: any;
|
||||
minDate: any;
|
||||
categoryIdList: number[] = [];
|
||||
categoryNameList: string[] = [];
|
||||
|
||||
constructor(
|
||||
private formBuilder: FormBuilder,
|
||||
|
@ -64,6 +68,15 @@ export class AddDataComponent implements OnInit {
|
|||
});
|
||||
this.myDate = moment().format('YYYY-MM-DD[T]HH:mm');
|
||||
// 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 {
|
||||
|
@ -71,6 +84,11 @@ export class AddDataComponent implements OnInit {
|
|||
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() {
|
||||
// gets the April 1st date of the current year
|
||||
const aprilDate = moment().month(3).date(1);
|
||||
|
@ -170,6 +188,7 @@ export class AddDataComponent implements OnInit {
|
|||
transaction_value : this.amount,
|
||||
purchase_time : purchaseTime,
|
||||
organisation_id : this.organisationId,
|
||||
category : this.categoryId,
|
||||
};
|
||||
break;
|
||||
case 2:
|
||||
|
@ -178,6 +197,7 @@ export class AddDataComponent implements OnInit {
|
|||
transaction_value : this.amount,
|
||||
purchase_time : purchaseTime,
|
||||
organisation_id : this.organisationId,
|
||||
category : this.categoryId,
|
||||
};
|
||||
break;
|
||||
case 3:
|
||||
|
@ -189,6 +209,7 @@ export class AddDataComponent implements OnInit {
|
|||
street_name : this.submitOrg.street_name,
|
||||
town : this.submitOrg.town,
|
||||
postcode : this.submitOrg.postcode,
|
||||
category : this.categoryId,
|
||||
};
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -4,15 +4,6 @@
|
|||
<div class="col-sm-8">
|
||||
<h4 class="card-title mb-0">All Purchases</h4>
|
||||
</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 class="chart-wrapper">
|
||||
<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
|
||||
|
||||
public search(data) {
|
||||
|
|
Reference in a new issue