feat: add parameters as navigation

Now there is automatic navigation on the inserted url and on localStorage
This commit is contained in:
2024-08-28 03:52:47 +03:00
parent 60218a73f2
commit 79393a39c3
7 changed files with 131 additions and 80 deletions

View File

@ -1,4 +1,4 @@
import {Component, LOCALE_ID, ViewChild} from '@angular/core';
import {Component, LOCALE_ID, OnInit, ViewChild} from '@angular/core';
import {TableComponent} from "@component/schedule/table/table.component";
import {MatFormField, MatInput} from "@angular/material/input";
import {MatButton} from "@angular/material/button";
@ -13,6 +13,8 @@ import {ScheduleService} from "@api/v1/schedule.service";
import {ScheduleResponse} from "@api/v1/scheduleResponse";
import {PeriodTimes} from "@model/pairPeriodTime";
import {MatCheckbox} from "@angular/material/checkbox";
import {ActivatedRoute} from "@angular/router";
import {TabStorageService} from "@service/tab-storage.service";
@Component({
selector: 'app-schedule',
@ -37,7 +39,7 @@ import {MatCheckbox} from "@angular/material/checkbox";
]
})
export class ScheduleComponent {
export class ScheduleComponent implements OnInit {
protected startWeek: Date;
protected data: ScheduleResponse[] = [];
protected startTerm: Date;
@ -47,7 +49,11 @@ export class ScheduleComponent {
@ViewChild('tableHeader') childComponent!: TableHeaderComponent;
constructor(api: ScheduleService) {
constructor(api: ScheduleService, route: ActivatedRoute) {
route.queryParams.subscribe(params => {
TabStorageService.selectDataFromQuery(params);
});
this.startTerm = new Date(1, 1, 1);
this.startWeek = new Date(1, 1, 1);
@ -65,6 +71,9 @@ export class ScheduleComponent {
});
}
ngOnInit(): void {
}
protected result(data: [TabsSelect, number, Observable<ScheduleResponse[]>]) {
this.isLoadTable = true;
data[2]