= [0, 0, 0, 0, 0, 0, 0, 0];
addDeposit(): void {
this.newDeposit.date_added = this.date_temp.toLocaleDateString();
- this.depositService.addDeposit(this.newDeposit).subscribe()
- this.current_page = 0;
- this.depositService.getDeposits(0).subscribe(searchResult => this.depositList = searchResult);
+ this.depositService.addDeposit(this.newDeposit).subscribe();
+ this.loadPage(0);
}
current_page: number = 0;
@@ -37,25 +49,35 @@ export class DepositsComponent implements OnInit {
pageSizeOptions: number[] = [10,20,50,100];
displayedColumns: string[] = ['position', 'name', 'weight'];
- updatePage(event: PageEvent) {
+ changePage(event: PageEvent) {
this.current_page = event.pageIndex;
this.depositService.getDeposits(this.current_page).subscribe(searchResult => this.depositList = searchResult);
}
+ loadPage(event: number) {
+ this.current_page = event;
+ this.depositService.getDeposits(this.current_page).subscribe(searchResult => this.depositList = searchResult);
+ this.graphService.getTopBarData(this.form).subscribe(tempData => {
+ this.topBarData = tempData;
+ });
+ }
next(){
if (this.depositList.length > 0){
this.current_page += 1;
- this.depositService.getDeposits(this.current_page).subscribe(depositList => this.depositList = depositList); }}
+ this.loadPage(this.current_page);
+ }
+ }
prev(){
if (this.current_page > 0){
this.current_page -= 1;
- this.depositService.getDeposits(this.current_page).subscribe(depositList => this.depositList = depositList);
+ this.loadPage(this.current_page);
}
}
ngOnInit(): void {
- this.depositService.getDeposits(0).subscribe(searchResult => this.depositList = searchResult);
+
+ this.loadPage(0);
}
}
diff --git a/src/app/graphs/graphs.component.html b/src/app/graphs/graphs.component.html
index 88015b5..62d15a0 100644
--- a/src/app/graphs/graphs.component.html
+++ b/src/app/graphs/graphs.component.html
@@ -142,34 +142,34 @@
Barcode |
- {{sample.barcode}} |
+ {{sample.barcode}} |
Date |
- {{sample.date}} |
+ {{sample.date}} |
Location |
- Location: {{sample.location}} Station:
+ | Location: {{sample.location}} Station:
{{sample.station}} |
IDs |
-
+ |
Compute ID: {{sample.compute_id}} Student ID: {{sample.student_id}}
|
Contacts |
-
+ |
Phone: {{sample.phone}} Email: {{sample.email}}
|
diff --git a/src/app/graphs/graphs.component.ts b/src/app/graphs/graphs.component.ts
index 5776b76..7b6ab2a 100644
--- a/src/app/graphs/graphs.component.ts
+++ b/src/app/graphs/graphs.component.ts
@@ -5,6 +5,7 @@ import { Label } from 'ng2-charts';
import { GraphService } from '../services/graph.service'
import { Sample } from '../models/sample.interface'
import { SearchForm } from '../models/search_form'
+
import {PageEvent} from '@angular/material/paginator'
import * as pluginDataLabels from 'chartjs-plugin-datalabels';
@@ -19,7 +20,7 @@ export class GraphsComponent implements OnInit {
constructor(private graphService: GraphService) { }
- topBarData: Array = [0, 0, 0, 0, 0, 0, 0];
+ topBarData: Array = [0, 0, 0, 0, 0, 0, 0, 0];
ChartName: String = "Location Activity";
dailyChartLabels: Label[] = [];
weekdayChartLabels: Label[] = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
diff --git a/src/app/navbar/navbar.component.html b/src/app/navbar/navbar.component.html
index 468fcc4..c301b7a 100644
--- a/src/app/navbar/navbar.component.html
+++ b/src/app/navbar/navbar.component.html
@@ -4,7 +4,7 @@
-
+