refactor: folders and components

This commit is contained in:
2024-05-21 02:34:23 +03:00
parent 77845d3a99
commit afc01c1409
32 changed files with 608 additions and 22 deletions

View File

@ -0,0 +1,63 @@
import {Component, EventEmitter, Input, Output, ViewChild} from '@angular/core';
import {AsyncPipe} from "@angular/common";
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";
import {LoadingIndicatorComponent} from "@component/common/loading-indicator/loading-indicator.component";
@Component({
selector: 'app-lecture-hall',
standalone: true,
imports: [
MatChipsModule,
MatExpansionModule,
AsyncPipe,
ReactiveFormsModule,
MatAccordion,
LoadingIndicatorComponent
],
templateUrl: './lecture-hall.component.html',
styleUrl: './lecture-hall.component.css'
})
export class LectureHallComponent {
protected campusId: number | null = null;
protected chipLecture: FormControl = new FormControl();
@ViewChild('lecturePanel') lecturePanel!: MatExpansionPanel;
@Input() campuses: Observable<CampusBasicInfoResponse[]> = of([]);
@Input() campusesLoaded: boolean | null = false;
@Output() campusesLoadRetry: EventEmitter<void> = new EventEmitter<void>();
@Input() lectureHalls: Observable<LectureHallResponse[]> = of([]);
@Input() lectureHallsLoaded: boolean | null = false;
@Output() lectureHallsLoadRetry: EventEmitter<number> = new EventEmitter<number>();
@Output() campusSelected = new EventEmitter<number>();
@Output() lectureHallSelected = new EventEmitter<number>();
protected chooseCampus(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 chooseLectureHall(event: MatChipListboxChange) {
if (event.value === undefined || event.value === null)
return;
this.lecturePanel.close();
this.lectureHallSelected.emit(event.value);
}
}