From a3de450b2da9ab0a6c3d3b1ddae01eec62c58b6a Mon Sep 17 00:00:00 2001 From: Nile Walker Date: Mon, 15 Feb 2021 13:05:44 -0500 Subject: [PATCH] Updated Navbar link --- src/app/deposits/deposits.component.html | 2 +- src/app/deposits/deposits.component.ts | 44 ++++++++++++++++++------ src/app/graphs/graphs.component.html | 10 +++--- src/app/graphs/graphs.component.ts | 3 +- src/app/navbar/navbar.component.html | 2 +- 5 files changed, 42 insertions(+), 19 deletions(-) diff --git a/src/app/deposits/deposits.component.html b/src/app/deposits/deposits.component.html index d1b0957..6f56dba 100644 --- a/src/app/deposits/deposits.component.html +++ b/src/app/deposits/deposits.component.html @@ -8,7 +8,7 @@

Inventory Deposits

-

(Total Inventory - Total Prints) since 10/5/2020: ""| safe:" samples_since" Labels +

(Total Inventory - Total Prints) since 10/5/2020: {{topBarData[7]}} Labels Remaining

diff --git a/src/app/deposits/deposits.component.ts b/src/app/deposits/deposits.component.ts index 5ea44bb..5a9ab17 100644 --- a/src/app/deposits/deposits.component.ts +++ b/src/app/deposits/deposits.component.ts @@ -1,9 +1,9 @@ import { Component, OnInit } from '@angular/core'; - +import { GraphService } from '../services/graph.service' import { PageEvent } from '@angular/material/paginator' import { ApiService } from '../services/api.service'; import { InventoryDeposit } from "../models/deposit.interface"; - +import { SearchForm } from '../models/search_form' @Component({ selector: 'app-deposits', templateUrl: './deposits.component.html', @@ -19,16 +19,28 @@ export class DepositsComponent implements OnInit { date_temp = new Date(Date.now()); notify_data : Array>[] = []; constructor( - private depositService: ApiService) { + private depositService: ApiService, + private graphService: GraphService) { } - + + form: SearchForm = { + start_date: "10/05/2020", + end_date: new Date().toLocaleDateString(), + student_id: "", + location: "", + compute_id: "", + include_tests: false + }; + + remainingLabels: number; + + topBarData: Array = [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 @@ - +