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

View File

@ -19,7 +19,7 @@ export class RequestAwardComponent {
showSuccessLabel = false; showSuccessLabel = false;
user: User = {}; user: User = {_id: '0'};
decoration: Decoration = null; decoration: Decoration = null;
@ -49,19 +49,23 @@ export class RequestAwardComponent {
} }
toggleUser(previewImage, decoDescription) { toggleUser(previewImage, decoDescription) {
this.decoration = null; if (this.user._id != '0') {
if (previewImage && decoDescription) { this.decoration = null;
previewImage.src = decoDescription.innerHTML = ''; 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" [compareWith]="equals"
required required
(change)="toggleUser()"> (change)="toggleUser()">
<option [ngValue]="{_id: '0'}">Auswählen...</option>
<option *ngFor="let user of users" [ngValue]="user"> <option *ngFor="let user of users" [ngValue]="user">
{{user.username}} {{user.username}}
</option> </option>

View File

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