rewards.component.html 3.83 KB
Newer Older
1 2 3 4 5
<div class="piece"
[matTooltip]="translate.instant('rewards_tooltip')"
matTooltipPosition="before" [matTooltipDisabled]="!tooltipService.activatedTooltips">
    <div class="piece-form">
        <div class="piece-form-title">{{'rewards_title' | translate}}</div>
Romain DELEAU's avatar
Romain DELEAU committed
6
        <div class="piece-form-content" *ngFor="let reward of task.rewards, let rewardIndex = index">          
7 8
            <div class="piece-form-content-type">
                <label for="type">{{'rewards_type_label'| translate}}</label>
Romain DELEAU's avatar
Romain DELEAU committed
9 10
                <select name="type" [(ngModel)]="reward.type" (change)="changeRewardType(rewardIndex,reward.type)">
                    <!--<option value="none" selected>{{'rewards_type_none' | translate}}</option>-->
11 12 13 14 15
                    <option value="object">{{'rewards_type_object' | translate}}</option>
                    <option value="character">{{'rewards_type_character' | translate}}</option>
                    <option value="skill">{{'rewards_type_skill' | translate}}</option>
                </select>
            </div>
Romain DELEAU's avatar
Romain DELEAU committed
16
            <div *ngIf="reward.type != 'none'">
17 18 19 20 21
                <!--
                <div class="piece-form-content-name">
                    <label for="name">{{'rewards_name_label' | translate}}</label>
                    <input type="text" name="name" [(ngModel)]="task.rewardName">
                </div>
Romain DELEAU's avatar
Romain DELEAU committed
22 23 24 25
                -->     
                <div class="piece-form-content-object" *ngIf="reward.type == 'object'">
                    <input type="number" name="quantity" [(ngModel)]="getObjectReward(rewardIndex).quantity"/>
                    <select name="object_name" [(ngModel)]="getObjectReward(rewardIndex).object">
26 27 28 29 30 31 32 33 34
                        <option value="null" selected disabled>{{'rewards_object_placeholder' | translate}}</option>
                        <ng-container *ngFor="let ressource of scenario.ressources">
                            <option *ngIf="ressource.type == 'ressource'" [ngValue]="ressource">{{ressource.name}}</option>
                        </ng-container>
                        <ng-container *ngFor="let ressource of pieceDetailsService.parentAsRole().ressources">
                            <option *ngIf="ressource.type == 'ressource'" [ngValue]="ressource">{{ressource.name}}</option>
                        </ng-container>
                    </select>
                </div>
Romain DELEAU's avatar
Romain DELEAU committed
35 36
                <div class="piece-form-content-character" *ngIf="reward.type == 'character'">
                    <select name="character" [(ngModel)]="getCharacterReward(rewardIndex).character">
37 38 39 40
                        <option value="null" selected disabled>{{'rewards_character_placeholder' | translate}}</option>
                        <option *ngFor="let character of scenario.characters" [ngValue]="character">{{character.name}}</option>
                    </select>
                </div>
Romain DELEAU's avatar
Romain DELEAU committed
41 42 43
                <div class="piece-form-content-skill" *ngIf="reward.type == 'skill'">
                    <input type="number" name="quantity" [(ngModel)]="getSkillReward(rewardIndex).quantity"/>
                    <select name="skill" [(ngModel)]="getSkillReward(rewardIndex).skill">
44 45 46 47 48 49 50
                        <option value="null" selected disabled>{{'rewards_skill_placeholder' | translate}}</option>
                        <ng-container *ngFor="let ressource of pieceDetailsService.parentAsRole().ressources">
                            <option *ngIf="ressource.type == 'attribut'" [ngValue]="ressource">{{ressource.name}}</option>
                        </ng-container>
                    </select>
                </div>
            </div>
Romain DELEAU's avatar
Romain DELEAU committed
51
            <button mat-button class="piece-form-buttons-remove" (click)="removeReward(rewardIndex)"><mat-icon fontIcon="remove"></mat-icon></button>
52
        </div>
Romain DELEAU's avatar
Romain DELEAU committed
53
        <button mat-button class="piece-form-buttons-add" (click)="addReward()"><mat-icon fontIcon="add"></mat-icon></button>
54 55
    </div>
</div>