Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #SB-30707 fix: Mentor and participant list dropdown migration #8236

Merged
merged 1 commit into from
Aug 17, 2022
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@
</div>
</div>
<div class="sb-field-group mb-8">
<label>{{resourceService?.frmelmnts?.lbl?.batchmentors}}</label>
<mat-form-field appearance="fill" class="sb-mat__dropdown w-100 mb-16">
<mat-label>{{resourceService?.frmelmnts?.lbl?.batchmentors}}</mat-label>
<mat-select formControlName="mentors" role="listbox" multiple aria-label="mentor list"
class="selection" (selectionChange)="selectedMultiValues($event, 'mentors')">
<mat-select-trigger>
Expand All @@ -159,8 +159,8 @@
</div>

<div class="sb-field-group " *ngIf="createBatchForm.value.enrollmentType !== 'open'">
<label>{{resourceService?.frmelmnts?.lbl?.bacthmembers}}</label>
<mat-form-field appearance="fill" class="sb-mat__dropdown w-100 mb-16">
<mat-label>{{resourceService?.frmelmnts?.lbl?.bacthmembers}}</mat-label>
<mat-select formControlName="users" role="listbox" multiple aria-label="participant list"
class="selection" (selectionChange)="selectedMultiValues($event, 'participant')">
<mat-select-trigger>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,17 +149,17 @@
<app-loader></app-loader>
</div>
<div class="sb-field-group mb-8">
<label>{{resourceService?.frmelmnts?.lbl?.batchmentors}}</label>
<mat-form-field appearance="fill" class="sb-mat__dropdown w-100 mb-16">
<mat-label>{{resourceService?.frmelmnts?.lbl?.batchmentors}}</mat-label>
<mat-select formControlName="mentors" role="listbox" multiple aria-label="mentor list"
class="selection" [disabled]="showFormInViewMode" (selectionChange)="selectedMultiValues($event, 'mentors')">
<mat-select-trigger>
<span>{{selectedMentors ? selectedMentors[0].name : ''}} </span>
<span *ngIf="selectedMentorList?.length > 2" class="example-additional-selection">
(+{{selectedMentorList.length - 1}} {{selectedMentorList?.length === 2 ? 'other' : 'others'}})
<span>{{selectedMentors ? selectedMentors[0] : ''}} </span>
<span *ngIf="selectedMentors?.length >= 2" class="example-additional-selection">
(+{{selectedMentors.length - 1}} {{selectedMentors?.length === 2 ? 'other' : 'others'}})
</span>
</mat-select-trigger>
<mat-option [disabled]="true" class="mat-dropdown__options" role="option" *ngFor="let mentor of mentorList" [value]="mentor.id"
<mat-option [disabled]="batchDetails.status === 0" class="mat-dropdown__options" role="option" *ngFor="let mentor of mentorList" [value]="mentor.id"
attr.aria-label="{{mentor.name}}">
<img class="ui mini avatar image"
src="{{mentor.avatar || 'assets/images/user_logo.png' | cdnprefixurl}}" alt="avatar image">
Expand All @@ -170,17 +170,17 @@
</div>

<div class="sb-field-group mb-8" *ngIf="batchUpdateForm.value.enrollmentType !== 'open'">
<label>{{resourceService?.frmelmnts?.lbl?.bacthmembers}}</label>
<mat-form-field appearance="fill" class="sb-mat__dropdown w-100 mb-16">
<mat-label>{{resourceService?.frmelmnts?.lbl?.bacthmembers}}</mat-label>
<mat-select formControlName="users" role="listbox" multiple aria-label="participant list"
class="selection" [disabled]="showFormInViewMode || (batchDetails.participants && batchDetails.participants.length >= 100)" (selectionChange)="selectedMultiValues($event, 'participant')">
<mat-select-trigger>
<span>{{selectedParticipants ? selectedParticipants[0].name : ''}} </span>
<span *ngIf="selectedMentorList?.length > 2" class="example-additional-selection">
<span>{{selectedParticipants ? selectedParticipants[0] : ''}} </span>
<span *ngIf="selectedMentorList?.length >= 2" class="example-additional-selection">
(+{{selectedParticipants.length - 1}} {{selectedParticipants?.length === 2 ? 'other' : 'others'}})
</span>
</mat-select-trigger>
<mat-option [disabled]="true" class="mat-dropdown__options" role="option" *ngFor="let participant of participantList" [value]="participant.id"
<mat-option [disabled]="batchDetails.status === 0" class="mat-dropdown__options" role="option" *ngFor="let participant of participantList" [value]="participant.id"
attr.aria-label="{{participant.name}}">
<img class="ui mini avatar image"
src="{{participant.avatar || 'assets/images/user_logo.png' | cdnprefixurl}}" alt="avatar image">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,17 +355,15 @@ export class UpdateCourseBatchComponent implements OnInit, OnDestroy, AfterViewI
_.forEach(this.batchDetails.participants, (value, key) => {
const user = _.find(participantList, ['id', value]);
if (user) {
this.selectedParticipants.push(user);
this.selectedParticipants.push(`${user.name}${user.otherDetail}`);
}
});
_.forEach(this.batchDetails.mentors, (value, key) => {
const mentor = _.find(mentorList, ['id', value]);
if (mentor) {
this.selectedMentors.push(mentor);
this.selectedMentors.push(`${mentor.name}${mentor.otherDetail}`);
}
});
this.selectedParticipants = _.uniqBy(this.selectedParticipants, 'id');
this.selectedMentors = _.uniqBy(this.selectedMentors, 'id');
this.disableSubmitBtn = false;
this.showLoader = false;
}
Expand Down