feat: add lecture hall tab
This commit is contained in:
parent
de159d0845
commit
95298278b6
@ -0,0 +1,35 @@
|
||||
<mat-accordion>
|
||||
<mat-expansion-panel expanded>
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>
|
||||
Кампус
|
||||
</mat-panel-title>
|
||||
</mat-expansion-panel-header>
|
||||
<mat-chip-listbox hideSingleSelectionIndicator (change)="selectedCampus($event)">
|
||||
@for (campus of campuses | async; track $index) {
|
||||
<mat-chip-option [value]="campus.id" color="accent">
|
||||
{{ campus.codeName }}
|
||||
</mat-chip-option>
|
||||
} @empty {
|
||||
<app-data-spinner/>
|
||||
}
|
||||
</mat-chip-listbox>
|
||||
</mat-expansion-panel>
|
||||
|
||||
<mat-expansion-panel [disabled]="campusId === null" #lecturePanel>
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>
|
||||
Кабинет
|
||||
</mat-panel-title>
|
||||
</mat-expansion-panel-header>
|
||||
<mat-chip-listbox hideSingleSelectionIndicator (change)="selectedLectureHall($event)" [formControl]="chipLecture">
|
||||
@for (lectureHall of lectureHalls | async; track $index) {
|
||||
<mat-chip-option [value]="lectureHall.id" color="accent">
|
||||
{{ lectureHall.name }}
|
||||
</mat-chip-option>
|
||||
} @empty {
|
||||
<app-data-spinner/>
|
||||
}
|
||||
</mat-chip-listbox>
|
||||
</mat-expansion-panel>
|
||||
</mat-accordion>
|
@ -0,0 +1,59 @@
|
||||
import {Component, EventEmitter, Input, Output, ViewChild} from '@angular/core';
|
||||
import {AsyncPipe} from "@angular/common";
|
||||
import {DataSpinnerComponent} from "@component/data-spinner/data-spinner.component";
|
||||
import {MatAccordion, MatExpansionModule, MatExpansionPanel} from "@angular/material/expansion";
|
||||
import {MatChipListboxChange, MatChipsModule} from "@angular/material/chips";
|
||||
import {Observable, of} from "rxjs";
|
||||
import {CampusBasicInfoResponse} from "@model/campusBasicInfoResponse";
|
||||
import {FormControl, ReactiveFormsModule} from "@angular/forms";
|
||||
import {LectureHallResponse} from "@model/lectureHallResponse";
|
||||
|
||||
@Component({
|
||||
selector: 'app-schedule-tabs-lecture-hall',
|
||||
standalone: true,
|
||||
imports: [
|
||||
MatChipsModule,
|
||||
DataSpinnerComponent,
|
||||
MatExpansionModule,
|
||||
AsyncPipe,
|
||||
ReactiveFormsModule,
|
||||
MatAccordion
|
||||
],
|
||||
templateUrl: './schedule-tabs-lecture-hall.component.html',
|
||||
styleUrl: './schedule-tabs-lecture-hall.component.css'
|
||||
})
|
||||
export class ScheduleTabsLectureHallComponent {
|
||||
protected campusId: number | null = null;
|
||||
protected chipLecture: FormControl = new FormControl();
|
||||
|
||||
@ViewChild('lecturePanel') lecturePanel!: MatExpansionPanel;
|
||||
|
||||
@Input() campuses: Observable<CampusBasicInfoResponse[]> = of([]);
|
||||
@Input() lectureHalls: Observable<LectureHallResponse[]> = of([]);
|
||||
|
||||
@Output() campusSelected = new EventEmitter<number>();
|
||||
@Output() lectureHallSelected = new EventEmitter<number>();
|
||||
|
||||
protected selectedCampus(event: MatChipListboxChange) {
|
||||
this.chipLecture.reset();
|
||||
|
||||
if (event.value === undefined || event.value === null) {
|
||||
this.campusId = null;
|
||||
this.lectureHalls = of([]);
|
||||
return;
|
||||
}
|
||||
|
||||
this.campusId = event.value;
|
||||
this.lecturePanel.open();
|
||||
|
||||
this.campusSelected.emit(this.campusId!);
|
||||
}
|
||||
|
||||
protected selectedLectureHall(event: MatChipListboxChange) {
|
||||
if (event.value === undefined || event.value === null)
|
||||
return;
|
||||
|
||||
this.lecturePanel.close();
|
||||
this.lectureHallSelected.emit(event.value);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user