feat: add show raw discipline if checked

This commit is contained in:
2024-08-28 01:22:45 +03:00
parent 1fa1e864da
commit 6a3a6a8d47
3 changed files with 60 additions and 12 deletions

View File

@ -1,6 +1,18 @@
<mat-sidenav-container class="schedule">
<app-tabs (eventResult)="result($event)"/>
<app-table-header [startWeek]="startWeek" [currentWeek]="currentWeek" (weekEvent)="handleWeekEvent($event)"
#tableHeader/>
<app-table [currentWeek]="currentWeek" [startWeek]="startWeek" [data]="data" [isLoad]="isLoadTable"/>
<mat-sidenav-content>
<app-tabs (eventResult)="result($event)"/>
</mat-sidenav-content>
<mat-sidenav-content>
<app-table-header [startWeek]="startWeek" [currentWeek]="currentWeek" (weekEvent)="handleWeekEvent($event)"
#tableHeader/>
</mat-sidenav-content>
<mat-sidenav-content>
<app-table [currentWeek]="currentWeek" [startWeek]="startWeek" [data]="data" [isLoad]="isLoadTable" [disciplineWithWeeks]="disciplineWithWeeks"/>
</mat-sidenav-content>
<mat-sidenav-content>
<mat-checkbox (change)="changeDisciplineWeeksView($event.checked)" [checked]="disciplineWithWeeks">Показать недели в дисциплине</mat-checkbox>
</mat-sidenav-content>
</mat-sidenav-container>

View File

@ -38,11 +38,12 @@ import {MatCheckbox} from "@angular/material/checkbox";
})
export class ScheduleComponent {
protected startWeek!: Date;
protected startWeek: Date;
protected data: ScheduleResponse[] = [];
protected startTerm: Date;
protected isLoadTable: boolean = false;
protected pairPeriods: PeriodTimes = {};
protected disciplineWithWeeks: boolean = false;
@ViewChild('tableHeader') childComponent!: TableHeaderComponent;
@ -50,6 +51,11 @@ export class ScheduleComponent {
this.startTerm = new Date(1, 1, 1);
this.startWeek = new Date(1, 1, 1);
let disciplineWithWeeksStorage = localStorage.getItem('disciplineWithWeeks');
if (disciplineWithWeeksStorage)
this.disciplineWithWeeks = disciplineWithWeeksStorage.toLowerCase() === 'true';
api.pairPeriod().subscribe(date => {
this.pairPeriods = date;
});
@ -122,4 +128,9 @@ export class ScheduleComponent {
return result;
}
protected changeDisciplineWeeksView(checked: boolean) {
localStorage.setItem('disciplineWithWeeks', checked.toString());
this.disciplineWithWeeks = checked;
}
}