<div class="piece" (mouseover)="displayMenu='show'" (mouseleave)="displayMenu='hide'" (click)="onClickPiece()"
[class]="pieceDetailsService.piece == scenario ? 'isActive' : 'border'">

    <div class="piece-menu" [class]="displayMenu">
        <mat-icon fontIcon="backspace" (click)="onClickErase()"
        [matTooltip]="translate.instant('clearPiece_tooltip')"
        matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></mat-icon>
    </div>

    <div class="piece-form">
        <div class="piece-form-rules">
            <div class="piece-form-title">{{'rules_title' | translate}}</div>  
            <textarea [(ngModel)]="scenario.gameRules" (change)="editTrace($event,'rules')"
            [matTooltip]="translate.instant('rules_rule_tooltip')"
            matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></textarea>
        </div>
        <div class="piece-form-ressources">
            <div class="piece-form-title">{{'rules_ressource_title' | translate}}</div>
            <div class="piece-form-ressources-object">
                <div class="piece-form-ressources-object-infos" *ngFor="let ressource of scenario.ressources; let i = index"
                [matTooltip]="translate.instant('rules_ressource_tooltip')"
                matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips">
                    <div class="piece-form-ressources-object-infos-name">
                        <label for="name">{{'rules_ressource_name_label' | translate}}</label>
                        <input name="name" type="text" [(ngModel)]="ressource.name" (change)="editTrace($event,'Ressource_['+i+']_name')"/>
                    </div>
                    <div class="piece-form-ressources-object-infos-quantity">
                        <label for="quantity">{{'rules_ressource_quantity_label' | translate}}</label>
                        <input name="quantity" type="number" min="1"[(ngModel)]="ressource.number" (change)="editTrace($event,'Ressource_['+i+']_quantity')"/>
                    </div>
                    <button mat-button (click)="removeRessource(i)"><mat-icon fontIcon="remove"></mat-icon></button>                           
                </div>
                <button mat-button (click)="addRessource()"><mat-icon fontIcon="add"></mat-icon></button>
            </div>
        </div>
    </div>
</div>