Skip to content

Commit

Permalink
Merge pull request #32 from ls1intum/bugfix/overlay-shown-before-deta…
Browse files Browse the repository at this point in the history
…il-card

Fix radio buttons for setting skill level in person detail view overl…
  • Loading branch information
Mtze authored May 16, 2023
2 parents 15edd07 + 767b0f4 commit 3f6a8f8
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,62 @@

<!-- skill level rating buttons -->
<div class="supervisor-rating-container flex-column">
<div
class="btn-group btn-group-sm flex-row"
ngbRadioGroup
name="radioBasic"
[(ngModel)]="data.person.supervisorRating">
<label ngbButtonLabel class="btn-secondary btn-none">
<input ngbButton type="radio" [value]="SkillLevel.None" />
<div class="key-icon-container">0</div>
{{ getLabelForSkillLevel(SkillLevel.None) }}
</label>
<label ngbButtonLabel class="btn-secondary btn-low">
<input ngbButton type="radio" [value]="SkillLevel.Low" />
<div class="key-icon-container">1</div>
{{ getLabelForSkillLevel(SkillLevel.Low) }}
</label>
<label ngbButtonLabel class="btn-secondary btn-medium">
<input ngbButton type="radio" [value]="SkillLevel.Medium" />
<div class="key-icon-container">2</div>
{{ getLabelForSkillLevel(SkillLevel.Medium) }}
</label>
<label ngbButtonLabel class="btn-secondary btn-high">
<input ngbButton type="radio" [value]="SkillLevel.High" />
<div class="key-icon-container">3</div>
{{ getLabelForSkillLevel(SkillLevel.High) }}
</label>
<label ngbButtonLabel class="btn-secondary btn-very-high">
<input ngbButton type="radio" [value]="SkillLevel.VeryHigh" />
<div class="key-icon-container">4</div>
{{ getLabelForSkillLevel(SkillLevel.VeryHigh) }}
</label>
</div>
<form [formGroup]="personSkillLevelFormGroup" (change)="personSkillLevelUpdated()">
<div class="btn-group btn-group-sm flex-row">
<input
type="radio"
id="option-1"
class="btn-check"
formControlName="personSkillLevelControl"
[value]="SkillLevel.None"
/>
<label class="btn-secondary btn-none" for="option-1">
<div class="key-icon-container">0</div>
{{ getLabelForSkillLevel(SkillLevel.None) }}
</label>
<input
type="radio"
id="option-2"
formControlName="personSkillLevelControl"
[value]="SkillLevel.Low"
/>
<label class="btn-secondary btn-low" for="option-2">
<div class="key-icon-container">1</div>
{{ getLabelForSkillLevel(SkillLevel.Low) }}
</label>
<input
type="radio"
id="option-3"
formControlName="personSkillLevelControl"
[value]="SkillLevel.Medium"
/>
<label class="btn-secondary btn-medium" for="option-3">
<div class="key-icon-container">2</div>
{{ getLabelForSkillLevel(SkillLevel.Medium) }}
</label>
<input
type="radio"
id="option-4"
formControlName="personSkillLevelControl"
[value]="SkillLevel.High"
/>
<label class="btn-secondary btn-high" for="option-4">
<div class="key-icon-container">3</div>
{{ getLabelForSkillLevel(SkillLevel.High) }}
</label>
<input
type="radio"
id="option-5"
class="btn-check"
formControlName="personSkillLevelControl"
[value]="SkillLevel.VeryHigh"
/>
<label class="btn-secondary btn-very-high" for="option-5">
<div class="key-icon-container">4</div>
{{ getLabelForSkillLevel(SkillLevel.VeryHigh) }}
</label>
</div>
</form>
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Component, HostListener, OnInit } from '@angular/core';
import { Person } from '../../shared/models/person';
import { Skill, SkillLevel } from '../../shared/models/skill';

import { OverlayComponent } from '../../overlay.service';
import { FormControl, FormGroup } from '@angular/forms';

@Component({
selector: 'app-person-detail-overlay',
Expand All @@ -21,10 +21,18 @@ export class PersonDetailOverlayComponent implements OnInit, OverlayComponent {
getLabelForSkillLevel = Skill.getLabelForSkillLevel;
SkillLevel = SkillLevel;

personSkillLevelFormGroup = new FormGroup({
personSkillLevelControl: new FormControl(SkillLevel.None),
});

constructor() {}

ngOnInit() {}

personSkillLevelUpdated() {
this.data.person.supervisorRating = this.personSkillLevelFormGroup.value.personSkillLevelControl;
}

isInTeam(person: Person): boolean {
return person.team !== null;
}
Expand Down

0 comments on commit 3f6a8f8

Please sign in to comment.