Professor category update
This commit is contained in:
@ -3,5 +3,9 @@ package net.shyshkin.study.fullstack.supportportal.backend.domain;
|
|||||||
public enum ProfessorCategory {
|
public enum ProfessorCategory {
|
||||||
FACULTY,
|
FACULTY,
|
||||||
SUPPORT_TEAM,
|
SUPPORT_TEAM,
|
||||||
TRAINEE_FELLOW
|
TRAINEE_FELLOW,
|
||||||
|
RESIGNED,
|
||||||
|
GUIDES,
|
||||||
|
FRIENDS,
|
||||||
|
PATRONS
|
||||||
}
|
}
|
||||||
@ -301,6 +301,26 @@
|
|||||||
color: #92400e;
|
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 */
|
||||||
.status-badge {
|
.status-badge {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
|
|||||||
@ -67,7 +67,11 @@
|
|||||||
<td (click)="onSelectProfessor(professor)">
|
<td (click)="onSelectProfessor(professor)">
|
||||||
<span class="category-badge" [class.badge-faculty]="professor?.category === 'FACULTY'"
|
<span class="category-badge" [class.badge-faculty]="professor?.category === 'FACULTY'"
|
||||||
[class.badge-support]="professor?.category === 'SUPPORT_TEAM'"
|
[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) }}
|
{{ getCategoryDisplayName(professor?.category) }}
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
@ -137,7 +141,11 @@
|
|||||||
<div class="badges-row">
|
<div class="badges-row">
|
||||||
<span class="category-badge" [class.badge-faculty]="selectedProfessor.category === 'FACULTY'"
|
<span class="category-badge" [class.badge-faculty]="selectedProfessor.category === 'FACULTY'"
|
||||||
[class.badge-support]="selectedProfessor.category === 'SUPPORT_TEAM'"
|
[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) }}
|
{{ getCategoryDisplayName(selectedProfessor.category) }}
|
||||||
</span>
|
</span>
|
||||||
<span class="status-badge" [class.status-active]="selectedProfessor.status === 'ACTIVE'"
|
<span class="status-badge" [class.status-active]="selectedProfessor.status === 'ACTIVE'"
|
||||||
@ -305,6 +313,10 @@
|
|||||||
<option value="FACULTY">Faculty</option>
|
<option value="FACULTY">Faculty</option>
|
||||||
<option value="SUPPORT_TEAM">Support Team</option>
|
<option value="SUPPORT_TEAM">Support Team</option>
|
||||||
<option value="TRAINEE_FELLOW">Trainee/Fellow</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>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -488,18 +500,17 @@
|
|||||||
<div class="file-upload-wrapper">
|
<div class="file-upload-wrapper">
|
||||||
<input type="file" id="newProfessorProfileImage" accept="image/*" name="profileImage"
|
<input type="file" id="newProfessorProfileImage" accept="image/*" name="profileImage"
|
||||||
(change)="onProfileImageChange($any($event).target.files)" class="file-input"
|
(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"
|
<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>
|
<i class="fa fa-cloud-upload-alt"></i>
|
||||||
<span>{{ (newProfessorForm.value.category === 'TRAINEE_FELLOW' || newProfessorForm.value.category
|
<span>{{ isImageUploadDisabled(newProfessorForm.value.category) ? 'Upload disabled for ' +
|
||||||
=== 'SUPPORT_TEAM') ? 'Upload disabled for ' +
|
|
||||||
getCategoryDisplayName(newProfessorForm.value.category) : (profileImageFileName || 'Choose
|
getCategoryDisplayName(newProfessorForm.value.category) : (profileImageFileName || 'Choose
|
||||||
profile picture') }}</span>
|
profile picture') }}</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<small class="form-text text-muted"
|
<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)
|
Profile image upload is not available for {{ getCategoryDisplayName(newProfessorForm.value.category)
|
||||||
}} category
|
}} category
|
||||||
</small>
|
</small>
|
||||||
@ -588,6 +599,10 @@
|
|||||||
<option value="FACULTY">Faculty</option>
|
<option value="FACULTY">Faculty</option>
|
||||||
<option value="SUPPORT_TEAM">Support Team</option>
|
<option value="SUPPORT_TEAM">Support Team</option>
|
||||||
<option value="TRAINEE_FELLOW">Trainee/Fellow</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>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -771,17 +786,16 @@
|
|||||||
<div class="file-upload-wrapper">
|
<div class="file-upload-wrapper">
|
||||||
<input type="file" id="editProfessorProfileImage" accept="image/*" name="profileImage"
|
<input type="file" id="editProfessorProfileImage" accept="image/*" name="profileImage"
|
||||||
(change)="onProfileImageChange($any($event).target.files)" class="file-input"
|
(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"
|
<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>
|
<i class="fa fa-cloud-upload-alt"></i>
|
||||||
<span>{{ (selectedProfessor.category === 'TRAINEE_FELLOW' || selectedProfessor.category ===
|
<span>{{ isImageUploadDisabled(selectedProfessor.category) ? 'Upload disabled for ' + getCategoryDisplayName(selectedProfessor.category) :
|
||||||
'SUPPORT_TEAM') ? 'Upload disabled for ' + getCategoryDisplayName(selectedProfessor.category) :
|
|
||||||
(profileImageFileName || 'Choose profile picture') }}</span>
|
(profileImageFileName || 'Choose profile picture') }}</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<small class="form-text text-muted"
|
<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) }}
|
Profile image upload is not available for {{ getCategoryDisplayName(selectedProfessor.category) }}
|
||||||
category
|
category
|
||||||
</small>
|
</small>
|
||||||
|
|||||||
@ -210,13 +210,24 @@ export class ProfessorComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
public getCategoryDisplayName(category: string): string {
|
public getCategoryDisplayName(category: string): string {
|
||||||
switch (category) {
|
switch (category) {
|
||||||
case 'FACULTY': return 'Faculty';
|
case 'FACULTY': return 'Faculty';
|
||||||
case 'SUPPORT_TEAM': return 'Support Team';
|
case 'SUPPORT_TEAM': return 'Support Team';
|
||||||
case 'TRAINEE_FELLOW': return 'Trainee/Fellow';
|
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 {
|
handleTitleChange(title: string): void {
|
||||||
this.titleSubject.next(title);
|
this.titleSubject.next(title);
|
||||||
}
|
}
|
||||||
@ -277,7 +288,7 @@ export class ProfessorComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public onCategoryChange(category: string): void {
|
public onCategoryChange(category: string): void {
|
||||||
if (category === 'TRAINEE_FELLOW' || category === 'SUPPORT_TEAM') {
|
if (this.isImageUploadDisabled(category)) {
|
||||||
this.profileImage = null;
|
this.profileImage = null;
|
||||||
this.profileImageFileName = null;
|
this.profileImageFileName = null;
|
||||||
const fileInput = document.getElementById('newProfessorProfileImage') as HTMLInputElement;
|
const fileInput = document.getElementById('newProfessorProfileImage') as HTMLInputElement;
|
||||||
@ -449,7 +460,7 @@ export class ProfessorComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ─── Profile image ───────────────────────────────────────────────────────
|
// ─── Profile image ───────────────────────────────────────────────────────
|
||||||
if (profileImage && professor.category !== 'TRAINEE_FELLOW' && professor.category !== 'SUPPORT_TEAM') {
|
if (profileImage && !this.isImageUploadDisabled(professor.category)) {
|
||||||
formData.append('profileImage', profileImage);
|
formData.append('profileImage', profileImage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,5 +2,9 @@
|
|||||||
export enum ProfessorCategory {
|
export enum ProfessorCategory {
|
||||||
FACULTY = 'FACULTY',
|
FACULTY = 'FACULTY',
|
||||||
SUPPORT_TEAM = 'SUPPORT_TEAM',
|
SUPPORT_TEAM = 'SUPPORT_TEAM',
|
||||||
TRAINEE_FELLOW = 'TRAINEE_FELLOW'
|
TRAINEE_FELLOW = 'TRAINEE_FELLOW',
|
||||||
|
RESIGNED = 'RESIGNED',
|
||||||
|
GUIDES = 'GUIDES',
|
||||||
|
FRIENDS = 'FRIENDS',
|
||||||
|
PATRONS = 'PATRONS'
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user