Misc chart work
Search feature on both suppliers and the pagination feature on the spend history still not functional
This commit is contained in:
parent
420174e953
commit
1dc46a55e0
11 changed files with 84 additions and 40 deletions
8
package-lock.json
generated
8
package-lock.json
generated
|
@ -7149,6 +7149,14 @@
|
||||||
"resolved": "https://registry.npmjs.org/ngx-bootstrap/-/ngx-bootstrap-5.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/ngx-bootstrap/-/ngx-bootstrap-5.0.0.tgz",
|
||||||
"integrity": "sha512-5TTFP9s3wfiRychGcdyvpCvvxtxW1Nf2Dqmk2YBzuIhHHLT6gRq1Fsic4lYrtAUwmy0PSLhOY/XW/saYKlrSJw=="
|
"integrity": "sha512-5TTFP9s3wfiRychGcdyvpCvvxtxW1Nf2Dqmk2YBzuIhHHLT6gRq1Fsic4lYrtAUwmy0PSLhOY/XW/saYKlrSJw=="
|
||||||
},
|
},
|
||||||
|
"ngx-filter-pipe": {
|
||||||
|
"version": "2.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/ngx-filter-pipe/-/ngx-filter-pipe-2.1.2.tgz",
|
||||||
|
"integrity": "sha512-YEXvjEw+Mpg5jL+yqSnFWKiY0P9XtRAJ2Dk3n9sC4stnsuhPzPRwIkF58aBvqYfoi3vrb7KQFImgbmfFAQqnFw==",
|
||||||
|
"requires": {
|
||||||
|
"tslib": "^1.7.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"ngx-pagination": {
|
"ngx-pagination": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/ngx-pagination/-/ngx-pagination-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/ngx-pagination/-/ngx-pagination-4.0.0.tgz",
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
"ng2-charts": "^2.3.0",
|
"ng2-charts": "^2.3.0",
|
||||||
"ng2-validation-manager": "0.5.3",
|
"ng2-validation-manager": "0.5.3",
|
||||||
"ngx-bootstrap": "^5.0.0",
|
"ngx-bootstrap": "^5.0.0",
|
||||||
|
"ngx-filter-pipe": "^2.1.2",
|
||||||
"ngx-pagination": "^4.0.0",
|
"ngx-pagination": "^4.0.0",
|
||||||
"popper.js": "^1.15.0",
|
"popper.js": "^1.15.0",
|
||||||
"rxjs": "6.5.2",
|
"rxjs": "6.5.2",
|
||||||
|
|
|
@ -44,6 +44,7 @@ import { DashboardModule } from './dashboard/dashboard.module';
|
||||||
import { ChartsModule } from 'ng2-charts';
|
import { ChartsModule } from 'ng2-charts';
|
||||||
// import { StackedBarChartComponent } from './panels/stacked-bar.component';
|
// import { StackedBarChartComponent } from './panels/stacked-bar.component';
|
||||||
import { MoreStuffComponent } from './dashboard/more-graphs-and-tables.component';
|
import { MoreStuffComponent } from './dashboard/more-graphs-and-tables.component';
|
||||||
|
import { FilterPipeModule } from 'ngx-filter-pipe';
|
||||||
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
@ -51,6 +52,7 @@ import { MoreStuffComponent } from './dashboard/more-graphs-and-tables.component
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
HttpClientModule,
|
HttpClientModule,
|
||||||
FormsModule,
|
FormsModule,
|
||||||
|
FilterPipeModule,
|
||||||
ReactiveFormsModule,
|
ReactiveFormsModule,
|
||||||
NgxPaginationModule,
|
NgxPaginationModule,
|
||||||
BsDropdownModule.forRoot(),
|
BsDropdownModule.forRoot(),
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<h4 class="card-title mb-0">Spending by Category</h4>
|
<h4 class="card-title mb-0">This weeks' spending by Category</h4>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="chart-wrapper">
|
<div class="chart-wrapper">
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
<input type="date" [(ngModel)]="bubbleChartEnd" (change)="bubbleChartUpdate()">
|
<input type="date" [(ngModel)]="bubbleChartEnd" (change)="bubbleChartUpdate()">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<small>vertical shows number of purchases, size of bubble shows the total spend amount, horizontal shows date</small>
|
||||||
<div class="col-sm-12" *ngIf="!isBubbleChartLoaded">
|
<div class="col-sm-12" *ngIf="!isBubbleChartLoaded">
|
||||||
<div class="spinner"></div>
|
<div class="spinner"></div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -27,12 +28,9 @@
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-12">
|
||||||
<h4 class="card-title mb-0">Spend amount and number of organisations</h4>
|
<h4 class="card-title mb-0">Spend amount and number of organisations</h4>
|
||||||
</div>
|
<small>horizontal axis shows date, vertical axis shows total number of orgs and amount spent</small>
|
||||||
<div class="col-sm-4 hidden-sm-down">
|
|
||||||
<input type="date" [(ngModel)]="lineChartBegin" (change)="lineChartUpdate()">
|
|
||||||
<input type="date" [(ngModel)]="lineChartEnd" (change)="lineChartUpdate()">
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
@ -49,14 +47,15 @@
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-6">
|
||||||
<h4 class="card-title mb-0">Supplier Spend History</h4>
|
<h4 class="card-title mb-0">Supplier Spend History</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4 hidden-sm-down">
|
<div class="col-sm-6 hidden-sm-down">
|
||||||
<button type="button" class="btn btn-info" (click)="supplierChartUpdate()">New Suppliers</button>
|
<button type="button" class="btn btn-danger" (click)="supplierChartPrevious()">Previous Suppliers</button>
|
||||||
|
<button type="button" class="btn btn-info" (click)="supplierChartNext()">Next Suppliers</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div *ngIf="isSupplierChartLoaded">
|
||||||
<canvas baseChart #supplierChart
|
<canvas baseChart #supplierChart
|
||||||
[datasets]="supplierMonthChartData"
|
[datasets]="supplierMonthChartData"
|
||||||
[options]="supplierMonthChartOptions"
|
[options]="supplierMonthChartOptions"
|
||||||
|
|
|
@ -17,8 +17,9 @@ export class MoreStuffComponent implements OnInit {
|
||||||
bubbleChartBegin: any;
|
bubbleChartBegin: any;
|
||||||
bubbleChartEnd: any;
|
bubbleChartEnd: any;
|
||||||
cached_graph_data: any;
|
cached_graph_data: any;
|
||||||
isBubbleChartLoaded = false;
|
isBubbleChartLoaded:boolean = false;
|
||||||
isLineChartLoaded = false;
|
isLineChartLoaded:boolean = false;
|
||||||
|
isSupplierChartLoaded:boolean = false;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private api: ApiService,
|
private api: ApiService,
|
||||||
|
@ -31,7 +32,7 @@ export class MoreStuffComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.loadYearSpend(false, ('0'), ('0'));
|
this.loadYearSpend();
|
||||||
this.loadSupplierBubble(false, ('0'), ('0'));
|
this.loadSupplierBubble(false, ('0'), ('0'));
|
||||||
this.loadSupplierHistory();
|
this.loadSupplierHistory();
|
||||||
}
|
}
|
||||||
|
@ -131,9 +132,6 @@ export class MoreStuffComponent implements OnInit {
|
||||||
|
|
||||||
// console.log("variable \"this.isBubbleChartLoaded\": " + this.isBubbleChartLoaded);
|
// console.log("variable \"this.isBubbleChartLoaded\": " + this.isBubbleChartLoaded);
|
||||||
}
|
}
|
||||||
private bubbleChartUpdate() {
|
|
||||||
console.log("test change");
|
|
||||||
}
|
|
||||||
public supplierBubbleChartType: ChartType = 'bubble';
|
public supplierBubbleChartType: ChartType = 'bubble';
|
||||||
public supplierBubbleChartData: any[] = [
|
public supplierBubbleChartData: any[] = [
|
||||||
{
|
{
|
||||||
|
@ -275,7 +273,7 @@ export class MoreStuffComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
lineChartUpdate() {
|
lineChartUpdate() {
|
||||||
this.loadYearSpend(true, (this.lineChartBegin), (this.lineChartEnd));
|
this.loadYearSpend();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -300,27 +298,48 @@ export class MoreStuffComponent implements OnInit {
|
||||||
this.supplierMonthChartLabels = labels.slice(0,15);
|
this.supplierMonthChartLabels = labels.slice(0,15);
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
this.isSupplierChartLoaded = true;
|
||||||
}
|
}
|
||||||
supplierChartUpdate() {
|
|
||||||
this.api.loadMiscUrl('organisation/external/supplier_history').subscribe(
|
private supplierChartNext() {
|
||||||
result => {
|
result => {
|
||||||
let labels = [];
|
let labels = [];
|
||||||
let year = [];
|
let year = [];
|
||||||
let half = [];
|
let half = [];
|
||||||
let quarter = [];
|
let quarter = [];
|
||||||
result.data.map(item => {
|
result.data.map(item => {
|
||||||
labels.push(item.name);
|
labels.push(item.name);
|
||||||
year.push(item.year_total);
|
year.push(item.year_total);
|
||||||
half.push(item.half_total);
|
half.push(item.half_total);
|
||||||
quarter.push(item.quarter_total);
|
quarter.push(item.quarter_total);
|
||||||
});
|
});
|
||||||
this.supplierMonthChartData[0].data = quarter.slice(0,15);
|
this.supplierMonthChartData[0].data = quarter.slice(16,30);
|
||||||
this.supplierMonthChartData[1].data = half.slice(0,15);
|
this.supplierMonthChartData[1].data = half.slice(16,30);
|
||||||
this.supplierMonthChartData[2].data = year.slice(0,15);
|
this.supplierMonthChartData[2].data = year.slice(16,30);
|
||||||
this.supplierMonthChartLabels = labels.slice(0,15);
|
this.supplierMonthChartLabels = labels.slice(16,30);
|
||||||
}
|
}
|
||||||
)
|
this.isSupplierChartLoaded = true;
|
||||||
}
|
}
|
||||||
|
private supplierChartPrevious() {
|
||||||
|
result => {
|
||||||
|
let labels = [];
|
||||||
|
let year = [];
|
||||||
|
let half = [];
|
||||||
|
let quarter = [];
|
||||||
|
result.data.map(item => {
|
||||||
|
labels.push(item.name);
|
||||||
|
year.push(item.year_total);
|
||||||
|
half.push(item.half_total);
|
||||||
|
quarter.push(item.quarter_total);
|
||||||
|
});
|
||||||
|
this.supplierMonthChartData[0].data = quarter.slice(0,15);
|
||||||
|
this.supplierMonthChartData[1].data = half.slice(0,15);
|
||||||
|
this.supplierMonthChartData[2].data = year.slice(0,15);
|
||||||
|
this.supplierMonthChartLabels = labels.slice(0,15);
|
||||||
|
}
|
||||||
|
this.isSupplierChartLoaded = true;
|
||||||
|
}
|
||||||
|
|
||||||
public supplierMonthChartData: any[] = [
|
public supplierMonthChartData: any[] = [
|
||||||
{
|
{
|
||||||
data: [],
|
data: [],
|
||||||
|
|
|
@ -1,3 +1,20 @@
|
||||||
|
<div class="animated fadeIn">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<strong>Search list of suppliers</strong>
|
||||||
|
<small>Search by name or postcode of suppliers here</small>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="supplierListAvailable" class="card-block">
|
||||||
|
<div class="search-hero">
|
||||||
|
<input class="form-control" type="text" name="search" [(ngModel)]="searchText" autocomplete="off" placeholder="Search for a supplier here">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="animated fadeIn">
|
<div class="animated fadeIn">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { AgmCoreModule } from '@agm/core';
|
||||||
import { BsModalService, ModalDirective } from 'ngx-bootstrap/modal';
|
import { BsModalService, ModalDirective } from 'ngx-bootstrap/modal';
|
||||||
import { BsModalRef } from 'ngx-bootstrap/modal/bs-modal-ref.service';
|
import { BsModalRef } from 'ngx-bootstrap/modal/bs-modal-ref.service';
|
||||||
import { PaginationInstance } from 'ngx-pagination';
|
import { PaginationInstance } from 'ngx-pagination';
|
||||||
|
import { FilterPipeModule } from 'ngx-filter-pipe';
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: 'suppliers.component.html',
|
templateUrl: 'suppliers.component.html',
|
||||||
})
|
})
|
||||||
|
|
|
@ -89,7 +89,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer d-flex justify-content-between">
|
<div class="modal-footer d-flex justify-content-between">
|
||||||
<button type="submit" (click)="deleteRecurringTransaction()" class="btn btn-sm btn-danger"><i class="fa fa-times"></i> Delete</button>
|
<button type="submit" (click)="deleteRecurringTransaction()" class="btn btn-sm btn-danger"><i class="fa fa-times"></i> Delete</button>
|
||||||
<button type="submit" (click)="editRecurringTransaction()" class="btn btn-sm btn-primary"><i class="fa fa-dot-circle-o"></i> Edit</button>
|
<button type="submit" (click)="editRecurringTransaction()" class="btn btn-sm btn-primary"><i class="fa fa-dot-circle-o"></i> Save</button>
|
||||||
</div>
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -74,7 +74,6 @@ agm-map {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.small {
|
.small {
|
||||||
padding-left: 20px;
|
|
||||||
}
|
}
|
||||||
&.legend {
|
&.legend {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
|
@ -66,7 +66,6 @@ small,
|
||||||
.small {
|
.small {
|
||||||
font-size: $small-font-size;
|
font-size: $small-font-size;
|
||||||
font-weight: $font-weight-normal;
|
font-weight: $font-weight-normal;
|
||||||
padding-left: 20px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mark,
|
mark,
|
||||||
|
|
Reference in a new issue