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,6 +49,7 @@ export class RequestAwardComponent {
} }
toggleUser(previewImage, decoDescription) { toggleUser(previewImage, decoDescription) {
if (this.user._id != '0') {
this.decoration = null; this.decoration = null;
if (previewImage && decoDescription) { if (previewImage && decoDescription) {
previewImage.src = decoDescription.innerHTML = ''; previewImage.src = decoDescription.innerHTML = '';
@ -62,6 +63,9 @@ export class RequestAwardComponent {
}); });
this.showForm = true; this.showForm = true;
} else {
this.showForm = false;
}
} }

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() {
if (this.user._id != '0') {
this.showForm = true; this.showForm = true;
this.newLevel = this.user.rank.level; this.newLevel = this.user.rank.level;
} else {
this.showForm = false;
}
} }