Skip to content

Commit

Permalink
Merge pull request #8236 from Nik720/R-4.10.2-SB-30707
Browse files Browse the repository at this point in the history
Issue #SB-30707 fix: Mentor and participant list dropdown migration
  • Loading branch information
Rajesh Kumaravel authored Aug 17, 2022
2 parents 65d64f1 + d3c6adb commit 9d22c81
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
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

0 comments on commit 9d22c81

Please sign in to comment.