Commit 802455b9 authored by Romain DELEAU's avatar Romain DELEAU

role/mission erase/add/delete

parent 7685c7e0
......@@ -9,7 +9,7 @@
</div>
<div class="container-scenario-main-missions">
<div class="container-scenario-main-missions-mission" *ngFor="let mission of this.scenario.missions">
<div class="container-scenario-main-missions-mission" *ngFor="let mission of this.scenario.missions, let i = index">
<div class="container-scenario-chronologie">
<div class="container-scenario-chronologie-title">Chronologie générale de la mission</div>
......@@ -29,12 +29,12 @@
<div style="display: flex;">
<div class="container-scenario-main-missions-mission-missionPieces" [style.z-index]="3">
<app-educational-objective [educationnalObjective]="mission.educationnalObjective"></app-educational-objective>
<app-mission-context [style.z-index]="2" [missionContext]="mission.context"></app-mission-context>
<app-educational-objective [educationnalObjective]="mission.educationnalObjective" [scenario]="scenario" [i]="i"></app-educational-objective>
<app-mission-context [style.z-index]="2" [missionContext]="mission.context" [scenario]="scenario" [i]="i"></app-mission-context>
</div>
<div class="container-scenario-main-missions-mission-roles" [style.z-index]="2">
<div class="container-scenario-main-missions-mission-roles-role" *ngFor="let role of mission.roles">
<div class="container-scenario-main-missions-mission-roles-role" *ngFor="let role of mission.roles, let i = index">
<div style="display: flex; flex-direction: column;">
<div class="container-scenario-main-missions-mission-roles-role-chronologie">
......@@ -54,7 +54,7 @@
</div>
<div style="display: flex; flex-direction: row;">
<app-role [style.z-index]="2" [role]="role"></app-role>
<app-role [style.z-index]="2" [role]="role" [mission]="mission" [i]="i"></app-role>
<div class="container-scenario-main-missions-mission-roles-role-tasks" [style.z-index]="1">
<div class="container-scenario-main-missions-mission-roles-role-tasks-inlineTasks" *ngFor="let tasks of role.tasks, let i = index" [style.z-index]="role.tasks.length+i">
<div *ngFor="let task of tasks, let j = index" [style.z-index]="tasks.length-j">
......
......@@ -6,6 +6,7 @@
<div class="piece-menu" [class]="displayMenu">
<mat-icon fontIcon="add" (click)="onClickAdd()"></mat-icon>
<mat-icon fontIcon="backspace" (click)="onClickErase()"></mat-icon>
<mat-icon fontIcon="delete" (click)="onClickDelete()" *ngIf="canDelete()"></mat-icon>
<mat-icon fontIcon="more_vert" (click)="onClickDots()"></mat-icon>
</div>
......
import { Component, Input, OnInit } from '@angular/core';
import { EducationnalObjective } from 'src/app/class/educationnal-objective/educationnal-objective';
import { Mission } from 'src/app/class/mission/mission';
import { Scenario } from 'src/app/class/scenario/scenario';
@Component({
selector: 'app-educational-objective',
......@@ -9,6 +11,8 @@ import { EducationnalObjective } from 'src/app/class/educationnal-objective/educ
export class EducationalObjectiveComponent implements OnInit {
@Input() educationnalObjective: EducationnalObjective = new EducationnalObjective();
@Input() scenario: Scenario = new Scenario();
@Input() i: number = 0;
constructor() { }
......@@ -22,11 +26,23 @@ export class EducationalObjectiveComponent implements OnInit {
}
onClickAdd(): void {
this.scenario.missions.push(new Mission());
}
onClickErase(): void {
this.educationnalObjective.objective = '';
}
onClickDelete(): void {
this.scenario.missions.splice(this.i, 1);
}
canDelete(): boolean {
let res: boolean = true;
if (this.scenario.missions.length <= 1) {
res = false;
}
return res;
}
}
......@@ -18,7 +18,11 @@ export class GameContextComponent implements OnInit {
displayMenu: string = 'hide';
onClickErase(): void {
this.gameContext.univers = '';
this.gameContext.support = '';
this.gameContext.duration = '';
this.gameContext.intrigue = '';
this.gameContext.other = '';
}
onClickDots(): void {
......
......@@ -22,7 +22,7 @@ export class GameEducationnalObjectiveComponent implements OnInit {
}
onClickErase(): void {
this.gameEducationnalObjective.objective = '';
}
}
......@@ -6,6 +6,7 @@
<div class="piece-menu" [class]="displayMenu">
<mat-icon fontIcon="add" (click)="onClickAdd()"></mat-icon>
<mat-icon fontIcon="backspace" (click)="onClickErase()"></mat-icon>
<mat-icon fontIcon="delete" (click)="onClickDelete()" *ngIf="canDelete()"></mat-icon>
<mat-icon fontIcon="more_vert" (click)="onClickDots()"></mat-icon>
</div>
......
import { Component, Input, OnInit } from '@angular/core';
import { MissionContext } from 'src/app/class/mission-context/mission-context';
import { Mission } from 'src/app/class/mission/mission';
import { Scenario } from 'src/app/class/scenario/scenario';
@Component({
selector: 'app-mission-context',
......@@ -11,6 +13,8 @@ export class MissionContextComponent implements OnInit {
constructor() { }
@Input() missionContext: MissionContext = new MissionContext();
@Input() scenario: Scenario = new Scenario();
@Input() i: number = 0;
ngOnInit(): void {
}
......@@ -22,11 +26,26 @@ export class MissionContextComponent implements OnInit {
}
onClickAdd(): void {
this.scenario.missions.push(new Mission());
}
onClickErase(): void {
this.missionContext.duration = '';
this.missionContext.intrigue = '';
this.missionContext.communication = '';
this.missionContext.various = '';
}
onClickDelete(): void {
this.scenario.missions.splice(this.i, 1);
}
canDelete(): boolean {
let res: boolean = true;
if (this.scenario.missions.length <= 1) {
res = false;
}
return res;
}
}
......@@ -6,7 +6,7 @@
<div class="piece-menu" [class]="displayMenu">
<mat-icon fontIcon="add" (click)="onClickAdd()"></mat-icon>
<mat-icon fontIcon="backspace" (click)="onClickErase()"></mat-icon>
<mat-icon fontIcon="delete" (click)="onClickDelete()"></mat-icon>
<mat-icon fontIcon="delete" (click)="onClickDelete()" *ngIf="canDelete()"></mat-icon>
<mat-icon fontIcon="more_vert" (click)="onClickDots()"></mat-icon>
</div>
......
import { Component, Input, OnInit } from '@angular/core';
import { Mission } from 'src/app/class/mission/mission';
import { Ressource } from 'src/app/class/ressource/ressource';
import { CharacterReward } from 'src/app/class/rewards/character-reward/character-reward';
import { ObjectiveReward } from 'src/app/class/rewards/objective-reward/objective-reward';
......@@ -19,10 +20,13 @@ import { SupplementaryRole } from 'src/app/class/supplementary-role/supplementar
export class RoleComponent implements OnInit {
@Input() role: Role = new Role();
@Input() mission: Mission = new Mission();
@Input() i: number = 0;
constructor() { }
ngOnInit(): void {
this.mission.equalizeLengths();
}
displayMenu: string = 'hide';
......@@ -33,15 +37,30 @@ export class RoleComponent implements OnInit {
}
onClickAdd(): void {
this.mission.roles.push(new Role());
}
onClickErase(): void {
this.role.intitule = '';
this.role.questName = '';
this.role.description = '';
this.role.educationnalObjectives = [new RoleEducationnalObjective()];
this.role.rewards = [];
this.role.stuff = '';
this.role.ressources = [];
this.role.supplementaryRoles = [];
}
onClickDelete(): void {
this.mission.roles.splice(this.i, 1);
}
canDelete(): boolean {
let res: boolean = true;
if (this.mission.roles.length <= 2) {
res = false;
}
return res;
}
addEducationnalObjective(): void {
......
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