mirror of
https://github.com/sartography/uva-covid19-testing-frontend.git
synced 2025-01-13 17:24:11 +00:00
Switched Date Picker to make the first dow in
date picker to monday
This commit is contained in:
parent
2b64d3028c
commit
99f56af4ef
@ -55,6 +55,7 @@ import { SidebarComponent } from './sidebar/sidebar.component';
|
||||
import {MatListModule} from '@angular/material/list';
|
||||
import { ChangeDatePipe } from './change_date.pipe';
|
||||
import {DevHeaderInterceptorInterceptor} from './dev-header-interceptor.interceptor';
|
||||
import { TestWeekDateAdapter } from './test-week-date-adapter';
|
||||
|
||||
|
||||
|
||||
@ -138,7 +139,8 @@ export function getBaseHref(platformLocation: PlatformLocation): string {
|
||||
{provide: 'APP_ENVIRONMENT', useClass: ThisEnvironment},
|
||||
{provide: APP_BASE_HREF, useFactory: getBaseHref, deps: [PlatformLocation]},
|
||||
{provide: MAT_FORM_FIELD_DEFAULT_OPTIONS, useValue: {appearance: 'outline'}},
|
||||
{provide: HTTP_INTERCEPTORS, useClass: DevHeaderInterceptorInterceptor, multi: true}
|
||||
{provide: HTTP_INTERCEPTORS, useClass: DevHeaderInterceptorInterceptor, multi: true},
|
||||
{ provide: DateAdapter, useClass: TestWeekDateAdapter },
|
||||
],
|
||||
bootstrap: [AppComponent],
|
||||
entryComponents: []
|
||||
|
@ -13,15 +13,3 @@ export class ChangeDatePipe implements PipeTransform {
|
||||
}
|
||||
}
|
||||
|
||||
// @Pipe({ name: 'date' })
|
||||
// @Injectable()
|
||||
// export class CustomDateAdapter extends NativeDateAdapter implements PipeTransform {
|
||||
// transform(value: any, ...args: any[]) {
|
||||
// throw new Error('Method not implemented.');
|
||||
// }
|
||||
|
||||
// getFirstDayOfWeek(): number {
|
||||
// return 1;
|
||||
// }
|
||||
|
||||
// }
|
||||
|
@ -49,7 +49,12 @@ export class GraphsComponent implements OnInit {
|
||||
},
|
||||
legend: {
|
||||
onClick: (e, i) => {
|
||||
if (!this.ChartName.includes('Station')){
|
||||
this.form.location = String(i.text);
|
||||
}
|
||||
else {
|
||||
this.form.location = '';
|
||||
}
|
||||
this.updateGraphData();
|
||||
}
|
||||
},
|
||||
@ -110,8 +115,8 @@ export class GraphsComponent implements OnInit {
|
||||
this.pageSize = event.pageSize;
|
||||
this.pageIndex = event.pageIndex;
|
||||
this.pageIndex = event.pageIndex;
|
||||
this.graphService.getRawSearchData(this.form, this.pageIndex).subscribe(
|
||||
searchResult => {this.searchResult = searchResult;
|
||||
this.graphService.getRawSearchData(this.form, this.pageIndex, this.pageSize).subscribe(
|
||||
searchResult => {this.searchResult = searchResult;
|
||||
});
|
||||
}
|
||||
|
||||
@ -188,7 +193,7 @@ export class GraphsComponent implements OnInit {
|
||||
this.topBarData = tempData;
|
||||
this.totalItems = this.topBarData[0];
|
||||
});
|
||||
this.graphService.getRawSearchData(this.form, 0).subscribe(searchResult => this.searchResult = searchResult);
|
||||
this.graphService.getRawSearchData(this.form, 0, this.pageSize).subscribe(searchResult => this.searchResult = searchResult);
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
|
@ -32,9 +32,10 @@ export class GraphService {
|
||||
});
|
||||
}
|
||||
|
||||
getRawSearchData(form: SearchForm, page: number): Observable<Sample[]> {
|
||||
getRawSearchData(form: SearchForm, page: number, itemsPerPage: number ): Observable<Sample[]> {
|
||||
let params = this.createParams(form);
|
||||
params = params.set('page', String(page));
|
||||
params = params.set('items_per_page', String(itemsPerPage));
|
||||
|
||||
return this.httpClient
|
||||
.get<Sample[]>(this.apiRoot + `/dashboard/search`, { params })
|
||||
|
9
src/app/test-week-date-adapter.ts
Normal file
9
src/app/test-week-date-adapter.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import { NativeDateAdapter } from '@angular/material/core';
|
||||
|
||||
|
||||
/** Adapts the native JS Date for use with cdk-based components that work with dates. */
|
||||
export class TestWeekDateAdapter extends NativeDateAdapter {
|
||||
getFirstDayOfWeek(): number {
|
||||
return 1;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user