Commit 854a1a9a authored by Romain DELEAU's avatar Romain DELEAU

Traces on tasks supplementaryrole

parent 7118507c
......@@ -120,7 +120,7 @@
<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()" [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-supplementary-task class="container-sider-elements-element" [task]="pieceDetailsService.pieceAsTask()" [role]="pieceDetailsService.parentAsRole()" *ngIf="pieceDetailsService.pieceIsTask()" [scenario]="scenario"></app-supplementary-task>
<app-repeat class="container-sider-elements-element" [task]="pieceDetailsService.pieceAsTask()" *ngIf="pieceDetailsService.pieceIsTask()" [scenario]="scenario"></app-repeat>
<app-interupt class="container-sider-elements-element" [task]="pieceDetailsService.pieceAsTask()" *ngIf="pieceDetailsService.pieceIsTask()" [scenario]="scenario"></app-interupt>
<app-characters class="container-sider-elements-element" [scenario]="scenario" [task]="pieceDetailsService.pieceAsTask()" *ngIf="pieceDetailsService.pieceIsTask()"></app-characters>
......
......@@ -13,7 +13,7 @@
œ-->
<div class="piece-form-select">
<label>Rôle</label>
<select [(ngModel)]="task.supplementaryRole">
<select [(ngModel)]="task.supplementaryRole" (change)="editTrace($event,'supplementaryRole')">
<option selected [ngValue]="undefined">Aucun</option>
<ng-container *ngFor="let supplementaryRole of role.supplementaryRoles">
<option [ngValue]="supplementaryRole">{{supplementaryRole.name}}</option>
......
......@@ -2,6 +2,9 @@ import { Component, Input, OnInit } from '@angular/core';
import { Task } from 'src/app/class/task/task';
import { Role } from 'src/app/class/role/role';
import { TooltipService } from 'src/app/services/tooltip/tooltip.service';
import { Scenario } from 'src/app/class/scenario/scenario';
import { PieceDetailsService } from 'src/app/services/piece-details/piece-details.service';
import { Trace } from 'src/app/class/trace/trace';
@Component({
selector: 'app-supplementary-task',
......@@ -10,11 +13,37 @@ import { TooltipService } from 'src/app/services/tooltip/tooltip.service';
})
export class SupplementaryTaskComponent implements OnInit {
@Input() scenario: Scenario = new Scenario();
@Input() task: Task = new Task('normal');
@Input() role: Role = new Role();
constructor(protected tooltipService: TooltipService) { }
constructor(protected tooltipService: TooltipService, private pieceDetailsService: PieceDetailsService) { }
ngOnInit(): void {
}
formatTraceTarget(): string {
let res: string = '';
if (this.pieceDetailsService.piece instanceof Task) {
switch(this.pieceDetailsService.piece.type) {
case 'normal': res = 'Task_['+this.pieceDetailsService.pieceIndex+']'; break;
case 'annexe': res = 'Side_task_['+this.pieceDetailsService.pieceIndex+']'; break;
case 'final': res = 'Final_task_['+this.pieceDetailsService.pieceIndex+']'; break;
case 'optionnal': res = 'Opt_task_['+this.pieceDetailsService.pieceIndex+']'; break;
case 'event': res = 'Event_task_['+this.pieceDetailsService.pieceIndex+']'; break;
case 'repeat': res = 'Repeat_task_['+this.pieceDetailsService.pieceIndex+']'; break;
}
}
return res;
}
editTrace(event: any, source: string): void {
if (this.task.supplementaryRole != undefined) {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'Select_secondary_task',this.pieceDetailsService.missionIndex,this.pieceDetailsService.roleIndex,source,this.formatTraceTarget(), '#9AD5EC'));
} else {
this.scenario.traces.push(new Trace(this.scenario.traces.length,'Deselect_secondary_task',this.pieceDetailsService.missionIndex,this.pieceDetailsService.roleIndex,source,this.formatTraceTarget(), '#9AD5EC'));
}
}
}
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