Updated Navbar link

This commit is contained in:
Nile Walker 2021-02-15 13:05:44 -05:00
parent 3b80d8dd89
commit a3de450b2d
5 changed files with 42 additions and 19 deletions

View File

@ -8,7 +8,7 @@
<mat-card-header> <mat-card-header>
<h1>Inventory Deposits</h1> <h1>Inventory Deposits</h1>
</mat-card-header> </mat-card-header>
<mat-card-header> <h4 class="card-title">(Total Inventory - Total Prints) since 10/5/2020: ""| safe:" samples_since" Labels <mat-card-header> <h4 class="card-title">(Total Inventory - Total Prints) since 10/5/2020: {{topBarData[7]}} Labels
Remaining</h4> Remaining</h4>
</mat-card-header> </mat-card-header>

View File

@ -1,9 +1,9 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { GraphService } from '../services/graph.service'
import { PageEvent } from '@angular/material/paginator' import { PageEvent } from '@angular/material/paginator'
import { ApiService } from '../services/api.service'; import { ApiService } from '../services/api.service';
import { InventoryDeposit } from "../models/deposit.interface"; import { InventoryDeposit } from "../models/deposit.interface";
import { SearchForm } from '../models/search_form'
@Component({ @Component({
selector: 'app-deposits', selector: 'app-deposits',
templateUrl: './deposits.component.html', templateUrl: './deposits.component.html',
@ -19,16 +19,28 @@ export class DepositsComponent implements OnInit {
date_temp = new Date(Date.now()); date_temp = new Date(Date.now());
notify_data : Array<Array<number>>[] = []; notify_data : Array<Array<number>>[] = [];
constructor( 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<number> = [0, 0, 0, 0, 0, 0, 0, 0];
addDeposit(): void { addDeposit(): void {
this.newDeposit.date_added = this.date_temp.toLocaleDateString(); this.newDeposit.date_added = this.date_temp.toLocaleDateString();
this.depositService.addDeposit(this.newDeposit).subscribe() this.depositService.addDeposit(this.newDeposit).subscribe();
this.current_page = 0; this.loadPage(0);
this.depositService.getDeposits(0).subscribe(searchResult => this.depositList = searchResult);
} }
current_page: number = 0; current_page: number = 0;
@ -37,25 +49,35 @@ export class DepositsComponent implements OnInit {
pageSizeOptions: number[] = [10,20,50,100]; pageSizeOptions: number[] = [10,20,50,100];
displayedColumns: string[] = ['position', 'name', 'weight']; displayedColumns: string[] = ['position', 'name', 'weight'];
updatePage(event: PageEvent) { changePage(event: PageEvent) {
this.current_page = event.pageIndex; this.current_page = event.pageIndex;
this.depositService.getDeposits(this.current_page).subscribe(searchResult => this.depositList = searchResult); 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(){ next(){
if (this.depositList.length > 0){ if (this.depositList.length > 0){
this.current_page += 1; this.current_page += 1;
this.depositService.getDeposits(this.current_page).subscribe(depositList => this.depositList = depositList); }} this.loadPage(this.current_page);
}
}
prev(){ prev(){
if (this.current_page > 0){ if (this.current_page > 0){
this.current_page -= 1; this.current_page -= 1;
this.depositService.getDeposits(this.current_page).subscribe(depositList => this.depositList = depositList); this.loadPage(this.current_page);
} }
} }
ngOnInit(): void { ngOnInit(): void {
this.depositService.getDeposits(0).subscribe(searchResult => this.depositList = searchResult);
this.loadPage(0);
} }
} }

View File

@ -142,34 +142,34 @@
<ng-container matColumnDef="position"> <ng-container matColumnDef="position">
<th mat-header-cell *matHeaderCellDef> Barcode </th> <th mat-header-cell *matHeaderCellDef> Barcode </th>
<td mat-cell *matCellDef="let sample; let i = index;"> {{sample.barcode}} </td> <td mat-cell *matCellDef="let sample; "> {{sample.barcode}} </td>
</ng-container> </ng-container>
<!-- Name Column --> <!-- Name Column -->
<ng-container matColumnDef="name"> <ng-container matColumnDef="name">
<th mat-header-cell *matHeaderCellDef> Date </th> <th mat-header-cell *matHeaderCellDef> Date </th>
<td mat-cell *matCellDef="let sample; let i = index;"> {{sample.date}}</td> <td mat-cell *matCellDef="let sample; "> {{sample.date}}</td>
</ng-container> </ng-container>
<!-- Weight Column --> <!-- Weight Column -->
<ng-container matColumnDef="weight"> <ng-container matColumnDef="weight">
<th mat-header-cell *matHeaderCellDef> Location </th> <th mat-header-cell *matHeaderCellDef> Location </th>
<td mat-cell *matCellDef="let sample; let i = index;"> Location: {{sample.location}}<br>Station: <td mat-cell *matCellDef="let sample; "> Location: {{sample.location}}<br>Station:
{{sample.station}}</td> {{sample.station}}</td>
</ng-container> </ng-container>
<ng-container matColumnDef="email"> <ng-container matColumnDef="email">
<th mat-header-cell *matHeaderCellDef> IDs </th> <th mat-header-cell *matHeaderCellDef> IDs </th>
<td mat-cell *matCellDef="let sample; let i = index;"> <td mat-cell *matCellDef="let sample; ">
Compute ID: {{sample.compute_id}}<br>Student ID: {{sample.student_id}} Compute ID: {{sample.compute_id}}<br>Student ID: {{sample.student_id}}
</td> </td>
</ng-container> </ng-container>
<ng-container matColumnDef="text"> <ng-container matColumnDef="text">
<th mat-header-cell *matHeaderCellDef> Contacts </th> <th mat-header-cell *matHeaderCellDef> Contacts </th>
<td mat-cell *matCellDef="let sample; let i = index;"> <td mat-cell *matCellDef="let sample; ">
Phone: {{sample.phone}}<br>Email: {{sample.email}} Phone: {{sample.phone}}<br>Email: {{sample.email}}
</td> </td>
</ng-container> </ng-container>

View File

@ -5,6 +5,7 @@ import { Label } from 'ng2-charts';
import { GraphService } from '../services/graph.service' import { GraphService } from '../services/graph.service'
import { Sample } from '../models/sample.interface' import { Sample } from '../models/sample.interface'
import { SearchForm } from '../models/search_form' import { SearchForm } from '../models/search_form'
import {PageEvent} from '@angular/material/paginator' import {PageEvent} from '@angular/material/paginator'
import * as pluginDataLabels from 'chartjs-plugin-datalabels'; import * as pluginDataLabels from 'chartjs-plugin-datalabels';
@ -19,7 +20,7 @@ export class GraphsComponent implements OnInit {
constructor(private graphService: GraphService) { } constructor(private graphService: GraphService) { }
topBarData: Array<number> = [0, 0, 0, 0, 0, 0, 0]; topBarData: Array<number> = [0, 0, 0, 0, 0, 0, 0, 0];
ChartName: String = "Location Activity"; ChartName: String = "Location Activity";
dailyChartLabels: Label[] = []; dailyChartLabels: Label[] = [];
weekdayChartLabels: Label[] = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]; weekdayChartLabels: Label[] = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];

View File

@ -4,7 +4,7 @@
<button id="nav_location" mat-button routerLink="/settings">{{locationId === '0000' ? 'Click here to set location' : 'Location: ' + locationId}}</button> <button id="nav_location" mat-button routerLink="/settings">{{locationId === '0000' ? 'Click here to set location' : 'Location: ' + locationId}}</button>
<span fxFlex></span> <span fxFlex></span>
<button id="nav_home" mat-icon-button routerLink="/"><mat-icon>home</mat-icon></button> <button id="nav_home" mat-icon-button routerLink="/"><mat-icon>home</mat-icon></button>
<button id="nav_dash" mat-icon-button routerLink="/dashboard"><mat-icon>dashboard</mat-icon></button> <button id="nav_dash" mat-icon-button [routerLink]="['/dashboard', 'graphs']"><mat-icon>dashboard</mat-icon></button>
<button id="nav_settings" mat-icon-button routerLink="/settings"><mat-icon>settings</mat-icon></button> <button id="nav_settings" mat-icon-button routerLink="/settings"><mat-icon>settings</mat-icon></button>
</mat-toolbar-row> </mat-toolbar-row>
</mat-toolbar> </mat-toolbar>