Commit cdc41d87 authored by Romain DELEAU's avatar Romain DELEAU

Traces on occurences

parent b223b132
......@@ -119,7 +119,7 @@
<div class="container-sider">
<div class="container-sider-title">{{getSiderTitle()}}</div>
<div class="container-sider-elements">
<app-role-occurence class="container-sider-elements-element" [role]="pieceDetailsService.pieceAsRole()" *ngIf="pieceDetailsService.pieceIsRole()"></app-role-occurence>
<app-role-occurence class="container-sider-elements-element" [role]="pieceDetailsService.pieceAsRole()" *ngIf="pieceDetailsService.pieceIsRole()" [scenario]="scenario"></app-role-occurence>
<app-supplementary-task class="container-sider-elements-element" [task]="pieceDetailsService.pieceAsTask()" [role]="pieceDetailsService.parentAsRole()" *ngIf="pieceDetailsService.pieceIsTask()"></app-supplementary-task>
<app-repeat class="container-sider-elements-element" [task]="pieceDetailsService.pieceAsTask()" *ngIf="pieceDetailsService.pieceIsTask()"></app-repeat>
<app-interupt class="container-sider-elements-element" [task]="pieceDetailsService.pieceAsTask()" *ngIf="pieceDetailsService.pieceIsTask()"></app-interupt>
......
......@@ -5,11 +5,11 @@ matTooltipPosition="before" [matTooltipDisabled]="!tooltipService.activatedToolt
<div class="piece-title">Occurrence du rôle</div>
<div class="piece-form-occurrence" *ngFor="let occurence of role.occurences, let i = index">
<div class="piece-form-occurrence-text">
<input type="text" [(ngModel)]="occurence.iteration"/>
<input type="number" [(ngModel)]="occurence.iteration" (change)="editTrace($event,'Occurrence_['+i+']_nbRole')"/>
<label> entre </label>
<input type="text" [(ngModel)]="occurence.min"/>
<input type="number" [(ngModel)]="occurence.min" (change)="editTrace($event,'Occurrence_['+i+']_playersMin')"/>
<label> et </label>
<input type="text" [(ngModel)]="occurence.max"/>
<input type="number" [(ngModel)]="occurence.max" (change)="editTrace($event,'Occurrence_['+i+']_playersMax')"/>
<label> joueurs</label>
</div>
<button mat-button (click)="removeOccurrence(i)"><mat-icon fontIcon="remove"></mat-icon></button>
......
......@@ -27,6 +27,19 @@
margin-right: 5px;
}
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
-webkit-appearance: none;
appearance: none;
margin: 0;
}
@-moz-document url-prefix() {
input[type=number] {
-moz-appearance: textfield;
}
}
button {
background-color: white;
border-radius: 10px;
......
import { Component, Input, OnInit } from '@angular/core';
import { RoleOccurrence } from 'src/app/class/role-occurrence/role-occurrence';
import { Role } from 'src/app/class/role/role';
import { Scenario } from 'src/app/class/scenario/scenario';
import { Trace } from 'src/app/class/trace/trace';
import { PieceDetailsService } from 'src/app/services/piece-details/piece-details.service';
import { TooltipService } from 'src/app/services/tooltip/tooltip.service';
@Component({
......@@ -10,19 +13,30 @@ import { TooltipService } from 'src/app/services/tooltip/tooltip.service';
})
export class RoleOccurenceComponent implements OnInit {
@Input() scenario: Scenario = new Scenario();
@Input() role: Role = new Role();
constructor(protected tooltipService: TooltipService) { }
constructor(protected tooltipService: TooltipService, private pieceDetailsService: PieceDetailsService) { }
ngOnInit(): void {
}
addOccurrence(): void {
this.role.occurences.push(new RoleOccurrence());
this.scenario.traces.push(new Trace(this.scenario.traces.length,'new',this.pieceDetailsService.missionIndex,this.pieceDetailsService.roleIndex,'occurence_['+(this.role.occurences.length-1)+']','Role_['+this.pieceDetailsService.roleIndex+']','#E5C5AC'));
}
removeOccurrence(index: number): void {
this.role.occurences.splice(index, 1);
this.scenario.traces.push(new Trace(this.scenario.traces.length,'delete',this.pieceDetailsService.missionIndex,this.pieceDetailsService.roleIndex,'occurence_['+(index)+']','Role_['+this.pieceDetailsService.roleIndex+']','#E5C5AC'));
}
editTrace(event: any, source: string): void {
if (event.target.value != '') {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'write',this.pieceDetailsService.missionIndex,this.pieceDetailsService.roleIndex,source,'Role_['+this.pieceDetailsService.roleIndex+']', '#E5C5AC'));
} else {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'erase',this.pieceDetailsService.missionIndex,this.pieceDetailsService.roleIndex,source,'Role_['+this.pieceDetailsService.roleIndex+']', '#E5C5AC'));
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment