Fix request user select

pull/3/head
Florian Hartwich 2017-08-02 20:20:05 +02:00
parent 5d69a04379
commit c1e666ebbc
4 changed files with 26 additions and 16 deletions

View File

@ -10,6 +10,7 @@
[compareWith]="equals"
(change)="toggleUser(decoPreview, decoDescription)"
required>
<option [ngValue]="{_id: '0'}">Auswählen...</option>
<option *ngFor="let user of users" [ngValue]="user">
{{user.username}}
</option>

View File

@ -19,7 +19,7 @@ export class RequestAwardComponent {
showSuccessLabel = false;
user: User = {};
user: User = {_id: '0'};
decoration: Decoration = null;
@ -49,19 +49,23 @@ export class RequestAwardComponent {
}
toggleUser(previewImage, decoDescription) {
this.decoration = null;
if (previewImage && decoDescription) {
previewImage.src = decoDescription.innerHTML = '';
if (this.user._id != '0') {
this.decoration = null;
if (previewImage && decoDescription) {
previewImage.src = decoDescription.innerHTML = '';
}
this.decorationService.findDecorations('', this.user.squad.fraction).subscribe(decorations => {
this.decorations = decorations;
});
this.awardingService.getUserAwardings(this.user._id).subscribe(awards => {
this.awards = awards;
});
this.showForm = true;
} else {
this.showForm = false;
}
this.decorationService.findDecorations('', this.user.squad.fraction).subscribe(decorations => {
this.decorations = decorations;
});
this.awardingService.getUserAwardings(this.user._id).subscribe(awards => {
this.awards = awards;
});
this.showForm = true;
}

View File

@ -10,6 +10,7 @@
[compareWith]="equals"
required
(change)="toggleUser()">
<option [ngValue]="{_id: '0'}">Auswählen...</option>
<option *ngFor="let user of users" [ngValue]="user">
{{user.username}}
</option>

View File

@ -19,7 +19,7 @@ export class RequestPromotionComponent {
showSuccessLabel = false;
user: User = {};
user: User = {_id: '0'};
newLevel: number;
@ -52,8 +52,12 @@ export class RequestPromotionComponent {
}
toggleUser() {
this.showForm = true;
this.newLevel = this.user.rank.level;
if (this.user._id != '0') {
this.showForm = true;
this.newLevel = this.user.rank.level;
} else {
this.showForm = false;
}
}