Professor category update

This commit is contained in:
2026-05-05 11:53:22 +05:30
parent 3e96bd4fb8
commit fc973e86d2
5 changed files with 73 additions and 20 deletions

View File

@ -3,5 +3,9 @@ package net.shyshkin.study.fullstack.supportportal.backend.domain;
public enum ProfessorCategory {
FACULTY,
SUPPORT_TEAM,
TRAINEE_FELLOW
TRAINEE_FELLOW,
RESIGNED,
GUIDES,
FRIENDS,
PATRONS
}

View File

@ -301,6 +301,26 @@
color: #92400e;
}
.badge-resigned {
background: #f3f4f6;
color: #374151;
}
.badge-guides {
background: #dbeafe;
color: #1e3a8a;
}
.badge-friends {
background: #dcfce7;
color: #14532d;
}
.badge-patrons {
background: #fae8ff;
color: #6b21a8;
}
/* Status Badge */
.status-badge {
display: inline-flex;

View File

@ -67,7 +67,11 @@
<td (click)="onSelectProfessor(professor)">
<span class="category-badge" [class.badge-faculty]="professor?.category === 'FACULTY'"
[class.badge-support]="professor?.category === 'SUPPORT_TEAM'"
[class.badge-trainee]="professor?.category === 'TRAINEE_FELLOW'">
[class.badge-trainee]="professor?.category === 'TRAINEE_FELLOW'"
[class.badge-resigned]="professor?.category === 'RESIGNED'"
[class.badge-guides]="professor?.category === 'GUIDES'"
[class.badge-friends]="professor?.category === 'FRIENDS'"
[class.badge-patrons]="professor?.category === 'PATRONS'">
{{ getCategoryDisplayName(professor?.category) }}
</span>
</td>
@ -137,7 +141,11 @@
<div class="badges-row">
<span class="category-badge" [class.badge-faculty]="selectedProfessor.category === 'FACULTY'"
[class.badge-support]="selectedProfessor.category === 'SUPPORT_TEAM'"
[class.badge-trainee]="selectedProfessor.category === 'TRAINEE_FELLOW'">
[class.badge-trainee]="selectedProfessor.category === 'TRAINEE_FELLOW'"
[class.badge-resigned]="selectedProfessor.category === 'RESIGNED'"
[class.badge-guides]="selectedProfessor.category === 'GUIDES'"
[class.badge-friends]="selectedProfessor.category === 'FRIENDS'"
[class.badge-patrons]="selectedProfessor.category === 'PATRONS'">
{{ getCategoryDisplayName(selectedProfessor.category) }}
</span>
<span class="status-badge" [class.status-active]="selectedProfessor.status === 'ACTIVE'"
@ -305,6 +313,10 @@
<option value="FACULTY">Faculty</option>
<option value="SUPPORT_TEAM">Support Team</option>
<option value="TRAINEE_FELLOW">Trainee/Fellow</option>
<option value="RESIGNED">Resigned</option>
<option value="GUIDES">Guides</option>
<option value="FRIENDS">Friends</option>
<option value="PATRONS">Patrons</option>
</select>
</div>
@ -488,18 +500,17 @@
<div class="file-upload-wrapper">
<input type="file" id="newProfessorProfileImage" accept="image/*" name="profileImage"
(change)="onProfileImageChange($any($event).target.files)" class="file-input"
[disabled]="newProfessorForm.value.category === 'TRAINEE_FELLOW' || newProfessorForm.value.category === 'SUPPORT_TEAM'">
[disabled]="isImageUploadDisabled(newProfessorForm.value.category)">
<label for="newProfessorProfileImage" class="file-label"
[class.disabled]="newProfessorForm.value.category === 'TRAINEE_FELLOW' || newProfessorForm.value.category === 'SUPPORT_TEAM'">
[class.disabled]="isImageUploadDisabled(newProfessorForm.value.category)">
<i class="fa fa-cloud-upload-alt"></i>
<span>{{ (newProfessorForm.value.category === 'TRAINEE_FELLOW' || newProfessorForm.value.category
=== 'SUPPORT_TEAM') ? 'Upload disabled for ' +
<span>{{ isImageUploadDisabled(newProfessorForm.value.category) ? 'Upload disabled for ' +
getCategoryDisplayName(newProfessorForm.value.category) : (profileImageFileName || 'Choose
profile picture') }}</span>
</label>
</div>
<small class="form-text text-muted"
*ngIf="newProfessorForm.value.category === 'TRAINEE_FELLOW' || newProfessorForm.value.category === 'SUPPORT_TEAM'">
*ngIf="isImageUploadDisabled(newProfessorForm.value.category)">
Profile image upload is not available for {{ getCategoryDisplayName(newProfessorForm.value.category)
}} category
</small>
@ -588,6 +599,10 @@
<option value="FACULTY">Faculty</option>
<option value="SUPPORT_TEAM">Support Team</option>
<option value="TRAINEE_FELLOW">Trainee/Fellow</option>
<option value="RESIGNED">Resigned</option>
<option value="GUIDES">Guides</option>
<option value="FRIENDS">Friends</option>
<option value="PATRONS">Patrons</option>
</select>
</div>
@ -771,17 +786,16 @@
<div class="file-upload-wrapper">
<input type="file" id="editProfessorProfileImage" accept="image/*" name="profileImage"
(change)="onProfileImageChange($any($event).target.files)" class="file-input"
[disabled]="!isManager || selectedProfessor.category === 'TRAINEE_FELLOW' || selectedProfessor.category === 'SUPPORT_TEAM'">
[disabled]="!isManager || isImageUploadDisabled(selectedProfessor.category)">
<label for="editProfessorProfileImage" class="file-label"
[class.disabled]="!isManager || selectedProfessor.category === 'TRAINEE_FELLOW' || selectedProfessor.category === 'SUPPORT_TEAM'">
[class.disabled]="!isManager || isImageUploadDisabled(selectedProfessor.category)">
<i class="fa fa-cloud-upload-alt"></i>
<span>{{ (selectedProfessor.category === 'TRAINEE_FELLOW' || selectedProfessor.category ===
'SUPPORT_TEAM') ? 'Upload disabled for ' + getCategoryDisplayName(selectedProfessor.category) :
<span>{{ isImageUploadDisabled(selectedProfessor.category) ? 'Upload disabled for ' + getCategoryDisplayName(selectedProfessor.category) :
(profileImageFileName || 'Choose profile picture') }}</span>
</label>
</div>
<small class="form-text text-muted"
*ngIf="selectedProfessor.category === 'TRAINEE_FELLOW' || selectedProfessor.category === 'SUPPORT_TEAM'">
*ngIf="isImageUploadDisabled(selectedProfessor.category)">
Profile image upload is not available for {{ getCategoryDisplayName(selectedProfessor.category) }}
category
</small>

View File

@ -210,13 +210,24 @@ export class ProfessorComponent implements OnInit, OnDestroy {
public getCategoryDisplayName(category: string): string {
switch (category) {
case 'FACULTY': return 'Faculty';
case 'SUPPORT_TEAM': return 'Support Team';
case 'FACULTY': return 'Faculty';
case 'SUPPORT_TEAM': return 'Support Team';
case 'TRAINEE_FELLOW': return 'Trainee/Fellow';
default: return 'Unknown';
case 'RESIGNED': return 'Resigned';
case 'GUIDES': return 'Guides';
case 'FRIENDS': return 'Friends';
case 'PATRONS': return 'Patrons';
default: return category || 'Unknown';
}
}
/** Categories that should NOT have a profile image upload */
private readonly NO_IMAGE_CATEGORIES = ['TRAINEE_FELLOW', 'SUPPORT_TEAM', 'GUIDES', 'FRIENDS', 'PATRONS'];
public isImageUploadDisabled(category: string): boolean {
return this.NO_IMAGE_CATEGORIES.includes(category);
}
handleTitleChange(title: string): void {
this.titleSubject.next(title);
}
@ -277,7 +288,7 @@ export class ProfessorComponent implements OnInit, OnDestroy {
}
public onCategoryChange(category: string): void {
if (category === 'TRAINEE_FELLOW' || category === 'SUPPORT_TEAM') {
if (this.isImageUploadDisabled(category)) {
this.profileImage = null;
this.profileImageFileName = null;
const fileInput = document.getElementById('newProfessorProfileImage') as HTMLInputElement;
@ -449,7 +460,7 @@ export class ProfessorComponent implements OnInit, OnDestroy {
}
// ─── Profile image ───────────────────────────────────────────────────────
if (profileImage && professor.category !== 'TRAINEE_FELLOW' && professor.category !== 'SUPPORT_TEAM') {
if (profileImage && !this.isImageUploadDisabled(professor.category)) {
formData.append('profileImage', profileImage);
}

View File

@ -1,6 +1,10 @@
// src/app/enum/professor-category.enum.ts
export enum ProfessorCategory {
FACULTY = 'FACULTY',
SUPPORT_TEAM = 'SUPPORT_TEAM',
TRAINEE_FELLOW = 'TRAINEE_FELLOW'
SUPPORT_TEAM = 'SUPPORT_TEAM',
TRAINEE_FELLOW = 'TRAINEE_FELLOW',
RESIGNED = 'RESIGNED',
GUIDES = 'GUIDES',
FRIENDS = 'FRIENDS',
PATRONS = 'PATRONS'
}