Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion uniplanWeb/src/app/core/shared/add-button/add-button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { MatIconModule } from '@angular/material/icon';
export class AddButton {
@Output() addClicked = new EventEmitter<void>();

onClick(): void {
public onClick(): void {
this.addClicked.emit();
}
}
4 changes: 2 additions & 2 deletions uniplanWeb/src/app/core/shared/add-form/add-form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { MatInputModule } from '@angular/material/input';
styleUrl: './add-form.scss',
})
export class AddForm {
@Input() title: string = '';
@Input() public title: string = '';

@Output() saveClicked = new EventEmitter<void>();
@Output() public readonly saveClicked :EventEmitter<void> = new EventEmitter<void>();
}
4 changes: 2 additions & 2 deletions uniplanWeb/src/app/core/shared/delete-form/delete-form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { MatInputModule } from '@angular/material/input';
styleUrl: './delete-form.scss',
})
export class DeleteForm {
@Input() title: string = '';
@Input() public title: string = '';

@Output() deleteClicked = new EventEmitter<void>();
@Output() public readonly deleteClicked:EventEmitter<void> = new EventEmitter<void>();
}
4 changes: 2 additions & 2 deletions uniplanWeb/src/app/core/shared/edit-form/edit-form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { MatDialogModule } from '@angular/material/dialog';
styleUrl: './edit-form.scss',
})
export class EditForm {
@Input() title: string = '';
@Input() public title: string = '';

@Output() saveClicked = new EventEmitter<void>();
@Output() public readonly saveClicked:EventEmitter<void> = new EventEmitter<void>();
}
14 changes: 7 additions & 7 deletions uniplanWeb/src/app/core/shared/filters-form/filters-form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ import { MatSelectModule } from '@angular/material/select';
styleUrl: './filters-form.scss',
})
export class FiltersForm {
@Input() label = '';
@Input() public label: string = '';

@Input() options: string[] = [];
@Input() public options: string[] = [];

@Input() objectOptions: { id: string; name: string }[] = [];
@Input() public objectOptions: { id: string; name: string }[] = [];

@Input() selected = '';
@Output() selectionChange = new EventEmitter<string>();
@Input() public selected = '';
@Output() public readonly selectionChange = new EventEmitter<string>();

onChange(value: string) {
public onChange(value: string) {
this.selectionChange.emit(value);
}

isObjectMode(): boolean {
public isObjectMode(): boolean {
return this.objectOptions && this.objectOptions.length > 0;
}
}
6 changes: 3 additions & 3 deletions uniplanWeb/src/app/core/shared/input-filter/input-filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { MatFormField, MatInputModule } from '@angular/material/input';
styleUrl: './input-filter.scss',
})
export class InputFilter {
@Input() label: string = '';
@Input() searchText = '';
@Output() searchTextChange = new EventEmitter<string>();
@Input() public label: string = '';
@Input() public searchText: string = '';
@Output() public readonly searchTextChange: EventEmitter<string> = new EventEmitter<string>();
}
48 changes: 25 additions & 23 deletions uniplanWeb/src/app/core/shared/main-panel/main-panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import { StudentFilters } from '../../../features/student/student-filters/studen
import { MajorElm } from '../../interfaces/major-elm';
import { MajorService } from '../../../features/major/major-service';
import { FacultyService } from '../../../features/faculty/faculty-service';
import {StudentElm} from '../../interfaces/student-elm';
import {FacultyElm} from '../../interfaces/faculty-elm';

@Component({
selector: 'app-main-panel',
Expand All @@ -34,55 +36,55 @@ import { FacultyService } from '../../../features/faculty/faculty-service';
styleUrl: './main-panel.scss',
})
export class MainPanel {
currentView = 'home';
protected currentView: string = 'home';

majors: MajorElm[] = [];
students = ELEMENT_STUDENT_DATA;
protected majors: MajorElm[] = [];
protected students: StudentElm[] = ELEMENT_STUDENT_DATA;

searchText = '';
searchFacNum = '';
searchMajor = '';
selectedStudentSubtype = '';
studentSubtypes: string[] = [];
protected searchText: string = '';
protected searchFacNum: string = '';
protected searchMajor: string = '';
protected selectedStudentSubtype: string = '';
protected studentSubtypes: string[] = [];

selectedFaculty = '';
selectedType = '';
selectedSubtype = '';
protected selectedFaculty: string = '';
protected selectedType: string = '';
protected selectedSubtype: string = '';

faculties: { id: string; name: string }[] = [];
types: string[] = [];
subtypes: string[] = [];
protected faculties: { id: string; name: string }[] = [];
protected types: string[] = [];
protected subtypes: string[] = [];

private facultyMap = new Map<string, string>();
private facultyMap: Map<string, string> = new Map<string, string>();

constructor(
public constructor(
private viewService: ViewService,
private majorService: MajorService,
private facultyService: FacultyService
) {
this.viewService.currentView$.subscribe((view) => {
this.viewService.currentView$.subscribe((view: string): void => {
this.currentView = view;
});
}

ngOnInit(): void {
public ngOnInit(): void {
this.loadMajorFilters();
this.loadStudentFilters();

this.majorService.refreshNeeded.subscribe(() => {
this.majorService.refreshNeeded.subscribe((): void => {
this.loadMajorFilters();
});

this.viewService.currentView$.subscribe((view) => {
this.viewService.currentView$.subscribe((view: string): void => {
this.currentView = view;
});
}

private loadMajorFilters(): void {
this.facultyService.getFaculties().subscribe((faculties) => {
this.facultyMap = new Map(faculties.map((f) => [f.id, f.facultyName]));
this.facultyService.getFaculties().subscribe((faculties: FacultyElm[]): void => {
this.facultyMap = new Map(faculties.map((f: FacultyElm): [any, any] => [f.id, f.facultyName]));

this.majorService.getMajors().subscribe((data) => {
this.majorService.getMajors().subscribe((data: MajorElm[]): void => {
this.majors = data;

const filterOptionsMajor = MajorTable.getFilterOptions(
Expand Down
6 changes: 3 additions & 3 deletions uniplanWeb/src/app/core/shared/main-panel/view.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { BehaviorSubject } from 'rxjs';

@Injectable({ providedIn: 'root' })
export class ViewService {
private viewSubject = new BehaviorSubject<string>('home');
currentView$ = this.viewSubject.asObservable();
private viewSubject: BehaviorSubject<string> = new BehaviorSubject<string>('home');
currentView$: any = this.viewSubject.asObservable();

public setView(view: string) {
public setView(view: string): void {
this.viewSubject.next(view);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@ import { LoginAuthService } from '../../../services/login-auth-service';
styleUrls: ['./navmenu-component.scss'],
})
export class NavmenuComponent implements OnInit {
isSidebarCollapsed = false;
isMobileView = window.innerWidth <= 768;
protected isSidebarCollapsed: boolean = false;
protected isMobileView: boolean = window.innerWidth <= 768;

constructor(
public authService: LoginAuthService,
public viewService: ViewService
protected authService: LoginAuthService,
private readonly viewService: ViewService
) {}

ngOnInit(): void {
public ngOnInit(): void {
this.checkViewport();
}

@HostListener('window:resize', ['$event'])
onResize(event: Event): void {
protected onResize(event: Event): void {
this.checkViewport();
}

private checkViewport(): void {
const isNowMobile = window.innerWidth <= 768;
const isNowMobile: boolean = window.innerWidth <= 768;
if (this.isMobileView !== isNowMobile) {
this.isMobileView = isNowMobile;
}
Expand All @@ -40,23 +40,23 @@ export class NavmenuComponent implements OnInit {
}
}

toggleSidebar(): void {
protected toggleSidebar(): void {
this.isSidebarCollapsed = !this.isSidebarCollapsed;
}

onHomeClick(): void {
protected onHomeClick(): void {
this.viewService.setView('home');
}

onFacultyClick(): void {
protected onFacultyClick(): void {
this.viewService.setView('faculty');
}

onMajorClick(): void {
protected onMajorClick(): void {
this.viewService.setView('major');
}

onStudentClick(): void {
protected onStudentClick(): void {
this.viewService.setView('student');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,29 +30,29 @@ import {
styleUrl: './faculty-add-form.scss',
})
export class FacultyAddForm implements OnInit {
facultyName = '';
location = '';
universityId = '';
universities: UniversityElm[] = [];
protected facultyName: string = '';
protected location: string = '';
protected universityId: string = '';
protected universities: UniversityElm[] = [];

constructor(
private dialogRef: MatDialogRef<AddForm>,
private facultyService: FacultyService,
private universityService: UniversityService
) {}

ngOnInit(): void {
public ngOnInit(): void {
this.universityService.getAllUniversities().subscribe({
next: (data) => {
next: (data: UniversityElm[]): void => {
this.universities = data;
},
error: (err) => {
error: (err: any): void => {
console.error('Failed to load universities', err);
},
});
}

save() {
protected save(): void {
if (!this.facultyName.trim()) {
alert('Please enter faculty name.');
return;
Expand All @@ -70,11 +70,11 @@ export class FacultyAddForm implements OnInit {
};

this.facultyService.createFaculty(newFaculty).subscribe({
next: (response) => {
next: (response: any): void => {
console.log('Faculty created:', response);
this.dialogRef.close(response);
},
error: (err) => {
error: (err: any): void => {
console.error('Failed to add faculty', err);
alert('Failed to add faculty.');
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ export class FacultyDeleteForm {
public data: { id: string; facultyName: string }
) {}

deleteFaculty(): void {
protected deleteFaculty(): void {
this.facultyService.deleteFaculty(this.data.id).subscribe({
next: () => {
next: (): void => {
this.dialogRef.close(true);
},
error: () => {
error: (): void => {
alert('Възникна грешка при изтриването на факултета.');
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ import { EditForm } from '../../../core/shared/edit-form/edit-form';
],
})
export class FacultyEdit {
facultyName = '';
location = '';
universityId = '';
protected facultyName: string = '';
protected location: string = '';
protected universityId: string = '';

constructor(
private dialogRef: MatDialogRef<EditForm>,
Expand All @@ -49,8 +49,7 @@ export class FacultyEdit {
this.location = data.location;
this.universityId = data.universityId;
}

save() {
protected save(): void {
if (!this.facultyName.trim()) {
alert('Please enter faculty name.');
return;
Expand All @@ -68,10 +67,10 @@ export class FacultyEdit {
universityId: this.universityId,
})
.subscribe({
next: () => {
next: (): void => {
this.dialogRef.close(true);
},
error: () => {
error: (): void => {
alert('Failed to update faculty.');
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { AddButton } from '../../../core/shared/add-button/add-button';
export class FacultyOptions {
constructor(private dialog: MatDialog) {}

openAddForm() {
protected openAddForm(): void {
this.dialog.open(FacultyAddForm, {
width: '400px',
});
Expand Down
Loading