diff --git a/src/components/schedule-tabs/schedule-tabs-lecture-hall/schedule-tabs-lecture-hall.component.css b/src/components/schedule-tabs/schedule-tabs-lecture-hall/schedule-tabs-lecture-hall.component.css new file mode 100644 index 0000000..e69de29 diff --git a/src/components/schedule-tabs/schedule-tabs-lecture-hall/schedule-tabs-lecture-hall.component.html b/src/components/schedule-tabs/schedule-tabs-lecture-hall/schedule-tabs-lecture-hall.component.html new file mode 100644 index 0000000..c4a98d3 --- /dev/null +++ b/src/components/schedule-tabs/schedule-tabs-lecture-hall/schedule-tabs-lecture-hall.component.html @@ -0,0 +1,35 @@ + + + + + Кампус + + + + @for (campus of campuses | async; track $index) { + + {{ campus.codeName }} + + } @empty { + + } + + + + + + + Кабинет + + + + @for (lectureHall of lectureHalls | async; track $index) { + + {{ lectureHall.name }} + + } @empty { + + } + + + diff --git a/src/components/schedule-tabs/schedule-tabs-lecture-hall/schedule-tabs-lecture-hall.component.ts b/src/components/schedule-tabs/schedule-tabs-lecture-hall/schedule-tabs-lecture-hall.component.ts new file mode 100644 index 0000000..29eed08 --- /dev/null +++ b/src/components/schedule-tabs/schedule-tabs-lecture-hall/schedule-tabs-lecture-hall.component.ts @@ -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 = of([]); + @Input() lectureHalls: Observable = of([]); + + @Output() campusSelected = new EventEmitter(); + @Output() lectureHallSelected = new EventEmitter(); + + 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); + } +}