Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
RLG Maker
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Romain DELEAU
RLG Maker
Commits
e3968fae
Commit
e3968fae
authored
Jul 10, 2023
by
Romain DELEAU
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prerequires
parent
566ce1a6
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
762 additions
and
203 deletions
+762
-203
app.component.html
src/app/app.component.html
+5
-5
app.component.ts
src/app/app.component.ts
+12
-0
prerequire-ressource.spec.ts
...equires/prerequire-ressource/prerequire-ressource.spec.ts
+7
-0
prerequire-ressource.ts
.../prerequires/prerequire-ressource/prerequire-ressource.ts
+14
-0
prerequire-task.spec.ts
...class/prerequires/prerequire-task/prerequire-task.spec.ts
+7
-0
prerequire-task.ts
src/app/class/prerequires/prerequire-task/prerequire-task.ts
+7
-0
scenario.ts
src/app/class/scenario/scenario.ts
+1
-1
task.ts
src/app/class/task/task.ts
+4
-1
role.component.ts
src/app/pieces/role/role.component.ts
+9
-0
annexe-task.component.html
src/app/pieces/tasks/annexe-task/annexe-task.component.html
+42
-38
annexe-task.component.scss
src/app/pieces/tasks/annexe-task/annexe-task.component.scss
+1
-0
annexe-task.component.ts
src/app/pieces/tasks/annexe-task/annexe-task.component.ts
+93
-0
final-task.component.html
src/app/pieces/tasks/final-task/final-task.component.html
+42
-38
final-task.component.scss
src/app/pieces/tasks/final-task/final-task.component.scss
+1
-0
final-task.component.ts
src/app/pieces/tasks/final-task/final-task.component.ts
+93
-0
optionnal-task.component.html
...pieces/tasks/optionnal-task/optionnal-task.component.html
+42
-38
optionnal-task.component.scss
...pieces/tasks/optionnal-task/optionnal-task.component.scss
+1
-0
optionnal-task.component.ts
...p/pieces/tasks/optionnal-task/optionnal-task.component.ts
+94
-1
random-event.component.html
...app/pieces/tasks/random-event/random-event.component.html
+42
-38
random-event.component.scss
...app/pieces/tasks/random-event/random-event.component.scss
+1
-0
random-event.component.ts
src/app/pieces/tasks/random-event/random-event.component.ts
+94
-1
task.component.html
src/app/pieces/tasks/task/task.component.html
+44
-40
task.component.scss
src/app/pieces/tasks/task/task.component.scss
+1
-0
task.component.ts
src/app/pieces/tasks/task/task.component.ts
+92
-1
rules.component.ts
src/app/sider-pieces/rules/rules.component.ts
+13
-1
No files found.
src/app/app.component.html
View file @
e3968fae
...
...
@@ -59,11 +59,11 @@
<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
"
>
<div
*
ngIf=
"task != null"
>
<app-task
*
ngIf=
"task.type == 'normal'"
[
task
]="
task
"
[
mission
]="
mission
"
[
role
]="
role
"
[
i
]="
i
"
[
j
]="
j
"
></app-task>
<app-annexe-task
*
ngIf=
"task.type == 'annexe'"
[
task
]="
task
"
[
mission
]="
mission
"
[
role
]="
role
"
[
i
]="
i
"
[
j
]="
j
"
></app-annexe-task>
<app-random-event
*
ngIf=
"task.type == 'event'"
[
task
]="
task
"
[
mission
]="
mission
"
[
role
]="
role
"
[
i
]="
i
"
[
j
]="
j
"
></app-random-event>
<app-optionnal-task
*
ngIf=
"task.type == 'optionnal'"
[
task
]="
task
"
[
mission
]="
mission
"
[
role
]="
role
"
[
i
]="
i
"
[
j
]="
j
"
></app-optionnal-task>
<app-final-task
*
ngIf=
"task.type == 'final'"
[
task
]="
task
"
[
mission
]="
mission
"
[
role
]="
role
"
[
i
]="
i
"
[
j
]="
j
"
></app-final-task>
<app-task
*
ngIf=
"task.type == 'normal'"
[
task
]="
task
"
[
scenario
]="
scenario
"
[
mission
]="
mission
"
[
role
]="
role
"
[
i
]="
i
"
[
j
]="
j
"
></app-task>
<app-annexe-task
*
ngIf=
"task.type == 'annexe'"
[
task
]="
task
"
[
scenario
]="
scenario
"
[
mission
]="
mission
"
[
role
]="
role
"
[
i
]="
i
"
[
j
]="
j
"
></app-annexe-task>
<app-random-event
*
ngIf=
"task.type == 'event'"
[
task
]="
task
"
[
scenario
]="
scenario
"
[
mission
]="
mission
"
[
role
]="
role
"
[
i
]="
i
"
[
j
]="
j
"
></app-random-event>
<app-optionnal-task
*
ngIf=
"task.type == 'optionnal'"
[
task
]="
task
"
[
scenario
]="
scenario
"
[
mission
]="
mission
"
[
role
]="
role
"
[
i
]="
i
"
[
j
]="
j
"
></app-optionnal-task>
<app-final-task
*
ngIf=
"task.type == 'final'"
[
task
]="
task
"
[
scenario
]="
scenario
"
[
mission
]="
mission
"
[
role
]="
role
"
[
i
]="
i
"
[
j
]="
j
"
></app-final-task>
<app-repeat-task
*
ngIf=
"task.type == 'repeat'"
[
task
]="
task
"
[
mission
]="
mission
"
[
role
]="
role
"
[
i
]="
i
"
[
j
]="
j
"
></app-repeat-task>
</div>
<div
class=
"container-scenario-main-missions-mission-buttonAdd"
style=
"height: 400px;"
*
ngIf=
"task == null"
>
...
...
src/app/app.component.ts
View file @
e3968fae
...
...
@@ -22,6 +22,8 @@ import { QuestReward } from './class/rewards/quest-reward/quest-reward';
import
{
ObjectsReward
}
from
'./class/rewards/objects-reward/objects-reward'
;
import
{
ObjectiveReward
}
from
'./class/rewards/objective-reward/objective-reward'
;
import
{
OtherReward
}
from
'./class/rewards/other-reward/other-reward'
;
import
{
PrerequireRessource
}
from
'./class/prerequires/prerequire-ressource/prerequire-ressource'
;
import
{
elementAt
}
from
'rxjs'
;
@
Component
({
selector
:
'app-root'
,
...
...
@@ -165,6 +167,16 @@ export class AppComponent {
&&
element
.
color
==
task
.
supplementaryRole
.
color
);
task
.
supplementaryRole
=
role
.
supplementaryRoles
[
supplementaryRoleIndex
];
task
.
prerequireRessources
=
task
.
prerequireRessources
.
map
((
prerequireData
:
any
)
=>
Object
.
assign
(
new
PrerequireRessource
(),
prerequireData
));
task
.
prerequireRessources
.
forEach
((
prerequire
,
index
)
=>
{
if
(
scenario
.
ressources
.
some
(
element
=>
element
.
name
==
prerequire
.
ressource
.
name
&&
element
.
number
==
prerequire
.
ressource
.
number
))
{
let
i
:
number
=
scenario
.
ressources
.
findIndex
(
element
=>
element
.
name
==
prerequire
.
ressource
.
name
&&
element
.
number
==
prerequire
.
ressource
.
number
);
prerequire
.
ressource
=
scenario
.
ressources
[
i
];
}
else
{
let
i
:
number
=
role
.
ressources
.
findIndex
(
element
=>
element
.
name
==
prerequire
.
ressource
.
name
&&
element
.
number
==
prerequire
.
ressource
.
number
);
prerequire
.
ressource
=
role
.
ressources
[
i
];
}
})
}
});
});
...
...
src/app/class/prerequires/prerequire-ressource/prerequire-ressource.spec.ts
0 → 100644
View file @
e3968fae
import
{
PrerequireRessource
}
from
'./prerequire-ressource'
;
describe
(
'PrerequireRessource'
,
()
=>
{
it
(
'should create an instance'
,
()
=>
{
expect
(
new
PrerequireRessource
()).
toBeTruthy
();
});
});
src/app/class/prerequires/prerequire-ressource/prerequire-ressource.ts
0 → 100644
View file @
e3968fae
import
{
Ressource
}
from
"../../ressource/ressource"
;
export
class
PrerequireRessource
{
constructor
(
ressource
?:
Ressource
)
{
if
(
ressource
)
{
this
.
ressource
=
ressource
;
}
}
ressource
!
:
Ressource
;
operator
:
string
=
''
;
quantity
:
number
=
1
;
}
src/app/class/prerequires/prerequire-task/prerequire-task.spec.ts
0 → 100644
View file @
e3968fae
import
{
PrerequireTask
}
from
'./prerequire-task'
;
describe
(
'PrerequireTask'
,
()
=>
{
it
(
'should create an instance'
,
()
=>
{
expect
(
new
PrerequireTask
()).
toBeTruthy
();
});
});
src/app/class/prerequires/prerequire-task/prerequire-task.ts
0 → 100644
View file @
e3968fae
export
class
PrerequireTask
{
constructor
(
identifier
:
string
)
{
this
.
identifier
=
identifier
;
}
identifier
:
string
=
''
;
}
src/app/class/scenario/scenario.ts
View file @
e3968fae
...
...
@@ -12,6 +12,6 @@ export class Scenario {
missions
:
Mission
[]
=
[
new
Mission
()];
characters
:
Character
[]
=
[];
gameRules
:
string
=
''
;
ressources
:
Ressource
[]
=
[
new
Ressource
()
];
ressources
:
Ressource
[]
=
[];
comments
:
Comment
[]
=
[];
}
\ No newline at end of file
src/app/class/task/task.ts
View file @
e3968fae
import
{
Character
}
from
"../character/character"
;
import
{
Comment
}
from
"../comment/comment"
;
import
{
PrerequireRessource
}
from
"../prerequires/prerequire-ressource/prerequire-ressource"
;
import
{
PrerequireTask
}
from
"../prerequires/prerequire-task/prerequire-task"
;
import
{
Repeat
}
from
"../repeat/repeat"
;
import
{
SupplementaryRole
}
from
"../supplementary-role/supplementary-role"
;
import
{
Symbol
}
from
"../symbol/symbol"
;
...
...
@@ -10,7 +12,8 @@ export class Task {
identifier
:
string
=
''
;
symbol
:
Symbol
=
new
Symbol
();
objective
:
string
=
''
;
antecedents
:
Task
[]
=
[];
prerequireTasks
:
PrerequireTask
[]
=
[];
prerequireRessources
:
PrerequireRessource
[]
=
[];
duration
:
number
=
1
;
durationUnit
:
string
=
'UT'
;
comments
:
Comment
[]
=
[];
...
...
src/app/pieces/role/role.component.ts
View file @
e3968fae
...
...
@@ -78,6 +78,15 @@ export class RoleComponent implements OnInit {
}
removeRessource
(
index
:
number
):
void
{
this
.
role
.
tasks
.
forEach
(
inlineTasks
=>
{
inlineTasks
.
forEach
(
task
=>
{
task
?.
prerequireRessources
.
forEach
((
prerequire
,
j
)
=>
{
if
(
prerequire
.
ressource
==
this
.
role
.
ressources
[
index
])
{
task
.
prerequireRessources
.
splice
(
j
,
1
);
}
});
});
});
this
.
role
.
ressources
.
splice
(
index
,
1
);
}
...
...
src/app/pieces/tasks/annexe-task/annexe-task.component.html
View file @
e3968fae
...
...
@@ -25,51 +25,55 @@
<div
class=
"piece-prerequires-prerequires"
>
<label
class=
"piece-prerequires-title"
>
Antécédents
</label>
<div
class=
"piece-prerequires-form"
>
<
div
class=
"piece-prerequires-prerequires-element
"
>
<
input
name=
"antecedent"
type=
"checkbox"
value=
"true"
/
>
<label
for=
"antecedent"
>
EX1
</label>
</div
>
<div
class=
"piece-prerequires-prerequires-element"
>
<input
name=
"antecedent"
type=
"checkbox"
/
>
<
label
for=
"antecedent"
>
EX2
</label
>
</
div
>
<
ng-container
*
ngFor=
"let inlineTask of role.tasks
"
>
<
ng-container
*
ngFor=
"let element of inlineTask; let index = index"
>
<div
class=
"piece-prerequires-prerequires-element"
*
ngIf=
"element?.identifier && (task.identifier != element?.identifier) && index < j"
>
<input
name=
"antecedent"
type=
"checkbox"
[
checked
]="
isCheckedTask
(
element
)"
(
change
)="
checkboxChangedTask
($
event
,
element
)"
/
>
<label
for=
"antecedent"
>
{{element?.identifier}}
</label
>
</div
>
<
/ng-container
>
</
ng-container
>
</div>
</div>
<div
class=
"piece-prerequires-ressources"
>
<label
class=
"piece-prerequires-title"
>
Ressources
&
attributs
</label>
<div
class=
"piece-prerequires-form"
>
<div
class=
"piece-prerequires-ressources-element"
>
<div
class=
"piece-prerequires-ressources-element-checkbox"
>
<input
name=
"ressource"
type=
"checkbox"
/>
<label
for=
"ressource"
>
Pain
</label>
<ng-container
*
ngFor=
"let ressource of scenario.ressources"
>
<div
class=
"piece-prerequires-ressources-element"
*
ngIf=
"ressource.name"
>
<div
class=
"piece-prerequires-ressources-element-checkbox"
>
<input
name=
"ressource"
type=
"checkbox"
(
change
)="
checkboxChangedRessource
($
event
,
ressource
)"
[
checked
]="
isCheckedRessource
(
ressource
)"
/>
<label
for=
"ressource"
>
{{ressource.name}}
</label>
</div>
<div
class=
"piece-prerequires-ressources-element-quantity"
*
ngIf=
"isCheckedRessource(ressource)"
>
<select
name=
"ressource"
[(
ngModel
)]="
getAssociatePrerequireRessource
(
ressource
).
operator
"
>
<option><
</
option
>
<option><
=</
option
>
<option>
=
</option>
<option>
>=
</option>
<option>
>
</option>
</select>
<input
type=
"text"
value=
"1"
[(
ngModel
)]="
getAssociatePrerequireRessource
(
ressource
).
quantity
"
/>
</div>
</div>
<div
class=
"piece-prerequires-ressources-element-quantity"
>
<select
name=
"ressource"
>
<option><
</
option
>
<option><
=</
option
>
<option>
=
</option>
<option>
>=
</option>
<option>
>
</option>
</select>
<input
type=
"text"
value=
"1"
/>
</ng-container>
<ng-container
*
ngFor=
"let ressource of role.ressources"
>
<div
class=
"piece-prerequires-ressources-element"
*
ngIf=
"ressource.name"
>
<div
class=
"piece-prerequires-ressources-element-checkbox"
>
<input
name=
"ressource"
type=
"checkbox"
(
change
)="
checkboxChangedRessource
($
event
,
ressource
)"
[
checked
]="
isCheckedRessource
(
ressource
)"
/>
<label
for=
"ressource"
>
{{ressource.name}}
</label>
</div>
<div
class=
"piece-prerequires-ressources-element-quantity"
*
ngIf=
"isCheckedRessource(ressource)"
>
<select
name=
"ressource"
[(
ngModel
)]="
getAssociatePrerequireRessource
(
ressource
).
operator
"
>
<option><
</
option
>
<option><
=</
option
>
<option>
=
</option>
<option>
>=
</option>
<option>
>
</option>
</select>
<input
type=
"text"
value=
"1"
[(
ngModel
)]="
getAssociatePrerequireRessource
(
ressource
).
quantity
"
/>
</div>
</div>
</div>
<div
class=
"piece-prerequires-ressources-element"
>
<div
class=
"piece-prerequires-ressources-element-checkbox"
>
<input
name=
"ressource"
type=
"checkbox"
/>
<label
for=
"ressource"
>
Citron
</label>
</div>
<div
class=
"piece-prerequires-ressources-element-quantity"
>
<select
name=
"ressource"
>
<option><
</
option
>
<option><
=</
option
>
<option>
=
</option>
<option>
>=
</option>
<option>
>
</option>
</select>
<input
type=
"text"
value=
"1"
/>
</div>
</div>
</ng-container>
</div>
</div>
</div>
...
...
src/app/pieces/tasks/annexe-task/annexe-task.component.scss
View file @
e3968fae
...
...
@@ -65,6 +65,7 @@
border-left
:
none
;
display
:
flex
;
flex-direction
:
row
;
padding-left
:
2px
;
&
-title
{
margin-left
:
auto
;
...
...
src/app/pieces/tasks/annexe-task/annexe-task.component.ts
View file @
e3968fae
import
{
Component
,
Input
,
OnInit
}
from
'@angular/core'
;
import
{
Mission
}
from
'src/app/class/mission/mission'
;
import
{
PrerequireRessource
}
from
'src/app/class/prerequires/prerequire-ressource/prerequire-ressource'
;
import
{
PrerequireTask
}
from
'src/app/class/prerequires/prerequire-task/prerequire-task'
;
import
{
Ressource
}
from
'src/app/class/ressource/ressource'
;
import
{
Role
}
from
'src/app/class/role/role'
;
import
{
Scenario
}
from
'src/app/class/scenario/scenario'
;
import
{
Task
}
from
'src/app/class/task/task'
;
import
{
PieceDetailsService
}
from
'src/app/services/piece-details/piece-details.service'
;
...
...
@@ -18,6 +22,7 @@ export class AnnexeTaskComponent implements OnInit {
pieceWidth
:
string
=
'400px'
;
@
Input
()
task
:
Task
=
new
Task
(
'normal'
);
@
Input
()
scenario
:
Scenario
=
new
Scenario
();
@
Input
()
mission
!
:
Mission
;
@
Input
()
role
!
:
Role
;
@
Input
()
i
!
:
number
;
...
...
@@ -60,6 +65,15 @@ export class AnnexeTaskComponent implements OnInit {
}
onClickDelete
():
void
{
this
.
role
.
tasks
.
forEach
(
inlineTasks
=>
{
inlineTasks
.
forEach
(
task
=>
{
task
?.
prerequireTasks
.
forEach
((
prerequire
,
index
)
=>
{
if
(
prerequire
.
identifier
==
this
.
task
.
identifier
)
{
task
.
prerequireTasks
.
splice
(
index
,
1
);
}
});
});
});
this
.
role
.
removeTask
(
this
.
i
,
this
.
j
);
this
.
mission
.
equalizeLengths
();
}
...
...
@@ -123,4 +137,83 @@ export class AnnexeTaskComponent implements OnInit {
}
return
[
0
,
0
];
}
changeIdentifier
(
event
:
any
):
void
{
let
value
:
string
=
event
.
target
.
value
;
if
(
value
!=
''
)
{
this
.
role
.
tasks
.
forEach
(
inlineTasks
=>
{
inlineTasks
.
forEach
(
task
=>
{
task
?.
prerequireTasks
.
forEach
(
prerequire
=>
{
if
(
prerequire
.
identifier
==
this
.
task
.
identifier
)
{
prerequire
.
identifier
=
value
;
}
});
});
});
}
else
{
this
.
role
.
tasks
.
forEach
(
inlineTasks
=>
{
inlineTasks
.
forEach
(
task
=>
{
task
?.
prerequireTasks
.
forEach
((
prerequire
,
index
)
=>
{
if
(
prerequire
.
identifier
==
this
.
task
.
identifier
)
{
task
.
prerequireTasks
.
splice
(
index
,
1
);
}
});
});
});
}
this
.
task
.
identifier
=
value
;
}
checkboxChangedTask
(
event
:
any
,
task
:(
Task
|
null
)):
void
{
if
(
task
instanceof
Task
)
{
if
(
event
.
target
.
checked
)
{
this
.
onCheckTask
(
task
);
}
else
{
this
.
onUncheckTask
(
task
);
}
}
}
isCheckedTask
(
task
:
(
Task
|
null
)):
boolean
{
if
(
task
instanceof
Task
)
{
return
this
.
task
.
prerequireTasks
.
some
(
element
=>
element
.
identifier
==
task
.
identifier
);
}
return
false
;
}
onCheckTask
(
task
:
Task
):
void
{
this
.
task
.
prerequireTasks
.
push
(
new
PrerequireTask
(
task
.
identifier
));
}
onUncheckTask
(
task
:
Task
):
void
{
let
i
:
number
=
this
.
task
.
prerequireTasks
.
findIndex
(
element
=>
element
.
identifier
==
task
.
identifier
);
this
.
task
.
prerequireTasks
.
splice
(
i
,
1
);
}
checkboxChangedRessource
(
event
:
any
,
ressource
:
Ressource
):
void
{
if
(
event
.
target
.
checked
)
{
this
.
onCheckRessource
(
ressource
);
}
else
{
this
.
onUncheckRessource
(
ressource
);
}
console
.
log
(
this
.
task
.
prerequireRessources
);
}
isCheckedRessource
(
ressource
:
Ressource
):
boolean
{
return
this
.
task
.
prerequireRessources
.
some
(
element
=>
element
.
ressource
==
ressource
);
}
onCheckRessource
(
ressource
:
Ressource
):
void
{
this
.
task
.
prerequireRessources
.
push
(
new
PrerequireRessource
(
ressource
));
}
onUncheckRessource
(
ressource
:
Ressource
):
void
{
let
i
:
number
=
this
.
task
.
prerequireRessources
.
findIndex
(
element
=>
ressource
==
element
.
ressource
);
this
.
task
.
prerequireRessources
.
splice
(
i
,
1
);
}
getAssociatePrerequireRessource
(
ressource
:
Ressource
):
PrerequireRessource
{
let
i
:
number
=
this
.
task
.
prerequireRessources
.
findIndex
(
element
=>
ressource
==
element
.
ressource
);
return
this
.
task
.
prerequireRessources
[
i
];
}
}
src/app/pieces/tasks/final-task/final-task.component.html
View file @
e3968fae
...
...
@@ -53,51 +53,55 @@
<div
class=
"piece-prerequires-prerequires"
>
<label
class=
"piece-prerequires-title"
>
Antécédents
</label>
<div
class=
"piece-prerequires-form"
>
<
div
class=
"piece-prerequires-prerequires-element
"
>
<
input
name=
"antecedent"
type=
"checkbox"
value=
"true"
/
>
<label
for=
"antecedent"
>
EX1
</label>
</div
>
<div
class=
"piece-prerequires-prerequires-element"
>
<input
name=
"antecedent"
type=
"checkbox"
/
>
<
label
for=
"antecedent"
>
EX2
</label
>
</
div
>
<
ng-container
*
ngFor=
"let inlineTask of role.tasks
"
>
<
ng-container
*
ngFor=
"let element of inlineTask; let index = index"
>
<div
class=
"piece-prerequires-prerequires-element"
*
ngIf=
"element?.identifier && (task.identifier != element?.identifier) && index < j"
>
<input
name=
"antecedent"
type=
"checkbox"
[
checked
]="
isCheckedTask
(
element
)"
(
change
)="
checkboxChangedTask
($
event
,
element
)"
/
>
<label
for=
"antecedent"
>
{{element?.identifier}}
</label
>
</div
>
<
/ng-container
>
</
ng-container
>
</div>
</div>
<div
class=
"piece-prerequires-ressources"
>
<label
class=
"piece-prerequires-title"
>
Ressources
&
attributs
</label>
<div
class=
"piece-prerequires-form"
>
<div
class=
"piece-prerequires-ressources-element"
>
<div
class=
"piece-prerequires-ressources-element-checkbox"
>
<input
name=
"ressource"
type=
"checkbox"
/>
<label
for=
"ressource"
>
Pain
</label>
<ng-container
*
ngFor=
"let ressource of scenario.ressources"
>
<div
class=
"piece-prerequires-ressources-element"
*
ngIf=
"ressource.name"
>
<div
class=
"piece-prerequires-ressources-element-checkbox"
>
<input
name=
"ressource"
type=
"checkbox"
(
change
)="
checkboxChangedRessource
($
event
,
ressource
)"
[
checked
]="
isCheckedRessource
(
ressource
)"
/>
<label
for=
"ressource"
>
{{ressource.name}}
</label>
</div>
<div
class=
"piece-prerequires-ressources-element-quantity"
*
ngIf=
"isCheckedRessource(ressource)"
>
<select
name=
"ressource"
[(
ngModel
)]="
getAssociatePrerequireRessource
(
ressource
).
operator
"
>
<option><
</
option
>
<option><
=</
option
>
<option>
=
</option>
<option>
>=
</option>
<option>
>
</option>
</select>
<input
type=
"text"
value=
"1"
[(
ngModel
)]="
getAssociatePrerequireRessource
(
ressource
).
quantity
"
/>
</div>
</div>
<div
class=
"piece-prerequires-ressources-element-quantity"
>
<select
name=
"ressource"
>
<option><
</
option
>
<option><
=</
option
>
<option>
=
</option>
<option>
>=
</option>
<option>
>
</option>
</select>
<input
type=
"text"
value=
"1"
/>
</ng-container>
<ng-container
*
ngFor=
"let ressource of role.ressources"
>
<div
class=
"piece-prerequires-ressources-element"
*
ngIf=
"ressource.name"
>
<div
class=
"piece-prerequires-ressources-element-checkbox"
>
<input
name=
"ressource"
type=
"checkbox"
(
change
)="
checkboxChangedRessource
($
event
,
ressource
)"
[
checked
]="
isCheckedRessource
(
ressource
)"
/>
<label
for=
"ressource"
>
{{ressource.name}}
</label>
</div>
<div
class=
"piece-prerequires-ressources-element-quantity"
*
ngIf=
"isCheckedRessource(ressource)"
>
<select
name=
"ressource"
[(
ngModel
)]="
getAssociatePrerequireRessource
(
ressource
).
operator
"
>
<option><
</
option
>
<option><
=</
option
>
<option>
=
</option>
<option>
>=
</option>
<option>
>
</option>
</select>
<input
type=
"text"
value=
"1"
[(
ngModel
)]="
getAssociatePrerequireRessource
(
ressource
).
quantity
"
/>
</div>
</div>
</div>
<div
class=
"piece-prerequires-ressources-element"
>
<div
class=
"piece-prerequires-ressources-element-checkbox"
>
<input
name=
"ressource"
type=
"checkbox"
/>
<label
for=
"ressource"
>
Citron
</label>
</div>
<div
class=
"piece-prerequires-ressources-element-quantity"
>
<select
name=
"ressource"
>
<option><
</
option
>
<option><
=</
option
>
<option>
=
</option>
<option>
>=
</option>
<option>
>
</option>
</select>
<input
type=
"text"
value=
"1"
/>
</div>
</div>
</ng-container>
</div>
</div>
</div>
...
...
src/app/pieces/tasks/final-task/final-task.component.scss
View file @
e3968fae
...
...
@@ -111,6 +111,7 @@
border-left
:
none
;
display
:
flex
;
flex-direction
:
row
;
padding-left
:
2px
;
&
-title
{
margin-left
:
auto
;
...
...
src/app/pieces/tasks/final-task/final-task.component.ts
View file @
e3968fae
import
{
Component
,
Input
,
OnInit
}
from
'@angular/core'
;
import
{
Mission
}
from
'src/app/class/mission/mission'
;
import
{
PrerequireRessource
}
from
'src/app/class/prerequires/prerequire-ressource/prerequire-ressource'
;
import
{
PrerequireTask
}
from
'src/app/class/prerequires/prerequire-task/prerequire-task'
;
import
{
Ressource
}
from
'src/app/class/ressource/ressource'
;
import
{
Role
}
from
'src/app/class/role/role'
;
import
{
Scenario
}
from
'src/app/class/scenario/scenario'
;
import
{
Task
}
from
'src/app/class/task/task'
;
import
{
PieceDetailsService
}
from
'src/app/services/piece-details/piece-details.service'
;
...
...
@@ -18,6 +22,7 @@ export class FinalTaskComponent implements OnInit {
pieceWidth
:
string
=
'400px'
;
@
Input
()
task
:
Task
=
new
Task
(
'normal'
);
@
Input
()
scenario
:
Scenario
=
new
Scenario
();
@
Input
()
mission
!
:
Mission
;
@
Input
()
role
!
:
Role
;
@
Input
()
i
!
:
number
;
...
...
@@ -71,6 +76,15 @@ export class FinalTaskComponent implements OnInit {
}
onClickDelete
():
void
{
this
.
role
.
tasks
.
forEach
(
inlineTasks
=>
{
inlineTasks
.
forEach
(
task
=>
{
task
?.
prerequireTasks
.
forEach
((
prerequire
,
index
)
=>
{
if
(
prerequire
.
identifier
==
this
.
task
.
identifier
)
{
task
.
prerequireTasks
.
splice
(
index
,
1
);
}
});
});
});
this
.
role
.
removeTask
(
this
.
i
,
this
.
j
);
this
.
mission
.
equalizeLengths
();
}
...
...
@@ -125,4 +139,83 @@ export class FinalTaskComponent implements OnInit {
}
return
[
0
,
0
];
}
changeIdentifier
(
event
:
any
):
void
{
let
value
:
string
=
event
.
target
.
value
;
if
(
value
!=
''
)
{
this
.
role
.
tasks
.
forEach
(
inlineTasks
=>
{
inlineTasks
.
forEach
(
task
=>
{
task
?.
prerequireTasks
.
forEach
(
prerequire
=>
{
if
(
prerequire
.
identifier
==
this
.
task
.
identifier
)
{
prerequire
.
identifier
=
value
;
}
});
});
});
}
else
{
this
.
role
.
tasks
.
forEach
(
inlineTasks
=>
{
inlineTasks
.
forEach
(
task
=>
{
task
?.
prerequireTasks
.
forEach
((
prerequire
,
index
)
=>
{
if
(
prerequire
.
identifier
==
this
.
task
.
identifier
)
{
task
.
prerequireTasks
.
splice
(
index
,
1
);
}
});
});
});
}
this
.
task
.
identifier
=
value
;
}
checkboxChangedTask
(
event
:
any
,
task
:(
Task
|
null
)):
void
{
if
(
task
instanceof
Task
)
{
if
(
event
.
target
.
checked
)
{
this
.
onCheckTask
(
task
);
}
else
{
this
.
onUncheckTask
(
task
);
}
}
}
isCheckedTask
(
task
:
(
Task
|
null
)):
boolean
{
if
(
task
instanceof
Task
)
{
return
this
.
task
.
prerequireTasks
.
some
(
element
=>
element
.
identifier
==
task
.
identifier
);
}
return
false
;
}
onCheckTask
(
task
:
Task
):
void
{
this
.
task
.
prerequireTasks
.
push
(
new
PrerequireTask
(
task
.
identifier
));
}
onUncheckTask
(
task
:
Task
):
void
{
let
i
:
number
=
this
.
task
.
prerequireTasks
.
findIndex
(
element
=>
element
.
identifier
==
task
.
identifier
);
this
.
task
.
prerequireTasks
.
splice
(
i
,
1
);
}
checkboxChangedRessource
(
event
:
any
,
ressource
:
Ressource
):
void
{
if
(
event
.
target
.
checked
)
{
this
.
onCheckRessource
(
ressource
);
}
else
{
this
.
onUncheckRessource
(
ressource
);
}
console
.
log
(
this
.
task
.
prerequireRessources
);
}
isCheckedRessource
(
ressource
:
Ressource
):
boolean
{
return
this
.
task
.
prerequireRessources
.
some
(
element
=>
element
.
ressource
==
ressource
);
}
onCheckRessource
(
ressource
:
Ressource
):
void
{
this
.
task
.
prerequireRessources
.
push
(
new
PrerequireRessource
(
ressource
));
}
onUncheckRessource
(
ressource
:
Ressource
):
void
{
let
i
:
number
=
this
.
task
.
prerequireRessources
.
findIndex
(
element
=>
ressource
==
element
.
ressource
);
this
.
task
.
prerequireRessources
.
splice
(
i
,
1
);
}
getAssociatePrerequireRessource
(
ressource
:
Ressource
):
PrerequireRessource
{
let
i
:
number
=
this
.
task
.
prerequireRessources
.
findIndex
(
element
=>
ressource
==
element
.
ressource
);
return
this
.
task
.
prerequireRessources
[
i
];
}
}
src/app/pieces/tasks/optionnal-task/optionnal-task.component.html
View file @
e3968fae
...
...
@@ -54,51 +54,55 @@
<div
class=
"piece-prerequires-prerequires"
>
<label
class=
"piece-prerequires-title"
>
Antécédents
</label>
<div
class=
"piece-prerequires-form"
>
<
div
class=
"piece-prerequires-prerequires-element
"
>
<
input
name=
"antecedent"
type=
"checkbox"
value=
"true"
/
>
<label
for=
"antecedent"
>
EX1
</label>
</div
>
<div
class=
"piece-prerequires-prerequires-element"
>
<input
name=
"antecedent"
type=
"checkbox"
/
>
<
label
for=
"antecedent"
>
EX2
</label
>
</
div
>
<
ng-container
*
ngFor=
"let inlineTask of role.tasks
"
>
<
ng-container
*
ngFor=
"let element of inlineTask; let index = index"
>
<div
class=
"piece-prerequires-prerequires-element"
*
ngIf=
"element?.identifier && (task.identifier != element?.identifier) && index < j"
>
<input
name=
"antecedent"
type=
"checkbox"
[
checked
]="
isCheckedTask
(
element
)"
(
change
)="
checkboxChangedTask
($
event
,
element
)"
/
>
<label
for=
"antecedent"
>
{{element?.identifier}}
</label
>
</div
>
<
/ng-container
>
</
ng-container
>
</div>
</div>
<div
class=
"piece-prerequires-ressources"
>
<label
class=
"piece-prerequires-title"
>
Ressources
&
attributs
</label>
<div
class=
"piece-prerequires-form"
>
<div
class=
"piece-prerequires-ressources-element"
>
<div
class=
"piece-prerequires-ressources-element-checkbox"
>
<input
name=
"ressource"
type=
"checkbox"
/>
<label
for=
"ressource"
>
Pain
</label>
<ng-container
*
ngFor=
"let ressource of scenario.ressources"
>
<div
class=
"piece-prerequires-ressources-element"
*
ngIf=
"ressource.name"
>
<div
class=
"piece-prerequires-ressources-element-checkbox"
>
<input
name=
"ressource"
type=
"checkbox"
(
change
)="
checkboxChangedRessource
($
event
,
ressource
)"
[
checked
]="
isCheckedRessource
(
ressource
)"
/>
<label
for=
"ressource"
>
{{ressource.name}}
</label>
</div>
<div
class=
"piece-prerequires-ressources-element-quantity"
*
ngIf=
"isCheckedRessource(ressource)"
>
<select
name=
"ressource"
[(
ngModel
)]="
getAssociatePrerequireRessource
(
ressource
).
operator
"
>
<option><
</
option
>
<option><
=</
option
>
<option>
=
</option>
<option>
>=
</option>
<option>
>
</option>
</select>
<input
type=
"text"
value=
"1"
[(
ngModel
)]="
getAssociatePrerequireRessource
(
ressource
).
quantity
"
/>
</div>
</div>
<div
class=
"piece-prerequires-ressources-element-quantity"
>
<select
name=
"ressource"
>
<option><
</
option
>
<option><
=</
option
>
<option>
=
</option>
<option>
>=
</option>
<option>
>
</option>
</select>
<input
type=
"text"
value=
"1"
/>
</ng-container>
<ng-container
*
ngFor=
"let ressource of role.ressources"
>
<div
class=
"piece-prerequires-ressources-element"
*
ngIf=
"ressource.name"
>
<div
class=
"piece-prerequires-ressources-element-checkbox"
>
<input
name=
"ressource"
type=
"checkbox"
(
change
)="
checkboxChangedRessource
($
event
,
ressource
)"
[
checked
]="
isCheckedRessource
(
ressource
)"
/>
<label
for=
"ressource"
>
{{ressource.name}}
</label>
</div>
<div
class=
"piece-prerequires-ressources-element-quantity"
*
ngIf=
"isCheckedRessource(ressource)"
>
<select
name=
"ressource"
[(
ngModel
)]="
getAssociatePrerequireRessource
(
ressource
).
operator
"
>
<option><
</
option
>
<option><
=</
option
>
<option>
=
</option>
<option>
>=
</option>
<option>
>
</option>
</select>
<input
type=
"text"
value=
"1"
[(
ngModel
)]="
getAssociatePrerequireRessource
(
ressource
).
quantity
"
/>
</div>
</div>
</div>
<div
class=
"piece-prerequires-ressources-element"
>
<div
class=
"piece-prerequires-ressources-element-checkbox"
>
<input
name=
"ressource"
type=
"checkbox"
/>
<label
for=
"ressource"
>
Citron
</label>
</div>
<div
class=
"piece-prerequires-ressources-element-quantity"
>
<select
name=
"ressource"
>
<option><
</
option
>
<option><
=</
option
>
<option>
=
</option>
<option>
>=
</option>
<option>
>
</option>
</select>
<input
type=
"text"
value=
"1"
/>
</div>
</div>
</ng-container>
</div>
</div>
</div>
...
...
src/app/pieces/tasks/optionnal-task/optionnal-task.component.scss
View file @
e3968fae
...
...
@@ -111,6 +111,7 @@
border-left
:
none
;
display
:
flex
;
flex-direction
:
row
;
padding-left
:
2px
;
&
-title
{
margin-left
:
auto
;
...
...
src/app/pieces/tasks/optionnal-task/optionnal-task.component.ts
View file @
e3968fae
import
{
Component
,
Input
,
OnInit
}
from
'@angular/core'
;
import
{
Mission
}
from
'src/app/class/mission/mission'
;
import
{
PrerequireRessource
}
from
'src/app/class/prerequires/prerequire-ressource/prerequire-ressource'
;
import
{
PrerequireTask
}
from
'src/app/class/prerequires/prerequire-task/prerequire-task'
;
import
{
Ressource
}
from
'src/app/class/ressource/ressource'
;
import
{
Role
}
from
'src/app/class/role/role'
;
import
{
Scenario
}
from
'src/app/class/scenario/scenario'
;
import
{
Task
}
from
'src/app/class/task/task'
;
import
{
PieceDetailsService
}
from
'src/app/services/piece-details/piece-details.service'
;
...
...
@@ -18,6 +22,7 @@ export class OptionnalTaskComponent implements OnInit {
pieceWidth
:
string
=
'400px'
;
@
Input
()
task
:
Task
=
new
Task
(
'normal'
);
@
Input
()
scenario
:
Scenario
=
new
Scenario
();
@
Input
()
mission
!
:
Mission
;
@
Input
()
role
!
:
Role
;
@
Input
()
i
!
:
number
;
...
...
@@ -70,6 +75,15 @@ export class OptionnalTaskComponent implements OnInit {
}
onClickDelete
():
void
{
this
.
role
.
tasks
.
forEach
(
inlineTasks
=>
{
inlineTasks
.
forEach
(
task
=>
{
task
?.
prerequireTasks
.
forEach
((
prerequire
,
index
)
=>
{
if
(
prerequire
.
identifier
==
this
.
task
.
identifier
)
{
task
.
prerequireTasks
.
splice
(
index
,
1
);
}
});
});
});
this
.
role
.
removeTask
(
this
.
i
,
this
.
j
);
this
.
mission
.
equalizeLengths
();
}
...
...
@@ -142,5 +156,84 @@ export class OptionnalTaskComponent implements OnInit {
}
}
return
[
0
,
0
];
}
}
changeIdentifier
(
event
:
any
):
void
{
let
value
:
string
=
event
.
target
.
value
;
if
(
value
!=
''
)
{
this
.
role
.
tasks
.
forEach
(
inlineTasks
=>
{
inlineTasks
.
forEach
(
task
=>
{
task
?.
prerequireTasks
.
forEach
(
prerequire
=>
{
if
(
prerequire
.
identifier
==
this
.
task
.
identifier
)
{
prerequire
.
identifier
=
value
;
}
});
});
});
}
else
{
this
.
role
.
tasks
.
forEach
(
inlineTasks
=>
{
inlineTasks
.
forEach
(
task
=>
{
task
?.
prerequireTasks
.
forEach
((
prerequire
,
index
)
=>
{
if
(
prerequire
.
identifier
==
this
.
task
.
identifier
)
{
task
.
prerequireTasks
.
splice
(
index
,
1
);
}
});
});
});
}
this
.
task
.
identifier
=
value
;
}
checkboxChangedTask
(
event
:
any
,
task
:(
Task
|
null
)):
void
{
if
(
task
instanceof
Task
)
{
if
(
event
.
target
.
checked
)
{
this
.
onCheckTask
(
task
);
}
else
{
this
.
onUncheckTask
(
task
);
}
}
}
isCheckedTask
(
task
:
(
Task
|
null
)):
boolean
{
if
(
task
instanceof
Task
)
{
return
this
.
task
.
prerequireTasks
.
some
(
element
=>
element
.
identifier
==
task
.
identifier
);
}
return
false
;
}
onCheckTask
(
task
:
Task
):
void
{
this
.
task
.
prerequireTasks
.
push
(
new
PrerequireTask
(
task
.
identifier
));
}
onUncheckTask
(
task
:
Task
):
void
{
let
i
:
number
=
this
.
task
.
prerequireTasks
.
findIndex
(
element
=>
element
.
identifier
==
task
.
identifier
);
this
.
task
.
prerequireTasks
.
splice
(
i
,
1
);
}
checkboxChangedRessource
(
event
:
any
,
ressource
:
Ressource
):
void
{
if
(
event
.
target
.
checked
)
{
this
.
onCheckRessource
(
ressource
);
}
else
{
this
.
onUncheckRessource
(
ressource
);
}
console
.
log
(
this
.
task
.
prerequireRessources
);
}
isCheckedRessource
(
ressource
:
Ressource
):
boolean
{
return
this
.
task
.
prerequireRessources
.
some
(
element
=>
element
.
ressource
==
ressource
);
}
onCheckRessource
(
ressource
:
Ressource
):
void
{
this
.
task
.
prerequireRessources
.
push
(
new
PrerequireRessource
(
ressource
));
}
onUncheckRessource
(
ressource
:
Ressource
):
void
{
let
i
:
number
=
this
.
task
.
prerequireRessources
.
findIndex
(
element
=>
ressource
==
element
.
ressource
);
this
.
task
.
prerequireRessources
.
splice
(
i
,
1
);
}
getAssociatePrerequireRessource
(
ressource
:
Ressource
):
PrerequireRessource
{
let
i
:
number
=
this
.
task
.
prerequireRessources
.
findIndex
(
element
=>
ressource
==
element
.
ressource
);
return
this
.
task
.
prerequireRessources
[
i
];
}
}
src/app/pieces/tasks/random-event/random-event.component.html
View file @
e3968fae
...
...
@@ -46,51 +46,55 @@
<div
class=
"piece-prerequires-prerequires"
>
<label
class=
"piece-prerequires-title"
>
Antécédents
</label>
<div
class=
"piece-prerequires-form"
>
<
div
class=
"piece-prerequires-prerequires-element
"
>
<
input
name=
"antecedent"
type=
"checkbox"
value=
"true"
/
>
<label
for=
"antecedent"
>
EX1
</label>
</div
>
<div
class=
"piece-prerequires-prerequires-element"
>
<input
name=
"antecedent"
type=
"checkbox"
/
>
<
label
for=
"antecedent"
>
EX2
</label
>
</
div
>
<
ng-container
*
ngFor=
"let inlineTask of role.tasks
"
>
<
ng-container
*
ngFor=
"let element of inlineTask; let index = index"
>
<div
class=
"piece-prerequires-prerequires-element"
*
ngIf=
"element?.identifier && (task.identifier != element?.identifier) && index < j"
>
<input
name=
"antecedent"
type=
"checkbox"
[
checked
]="
isCheckedTask
(
element
)"
(
change
)="
checkboxChangedTask
($
event
,
element
)"
/
>
<label
for=
"antecedent"
>
{{element?.identifier}}
</label
>
</div
>
<
/ng-container
>
</
ng-container
>
</div>
</div>
<div
class=
"piece-prerequires-ressources"
>
<label
class=
"piece-prerequires-title"
>
Ressources
&
attributs
</label>
<div
class=
"piece-prerequires-form"
>
<div
class=
"piece-prerequires-ressources-element"
>
<div
class=
"piece-prerequires-ressources-element-checkbox"
>
<input
name=
"ressource"
type=
"checkbox"
/>
<label
for=
"ressource"
>
Pain
</label>
<ng-container
*
ngFor=
"let ressource of scenario.ressources"
>
<div
class=
"piece-prerequires-ressources-element"
*
ngIf=
"ressource.name"
>
<div
class=
"piece-prerequires-ressources-element-checkbox"
>
<input
name=
"ressource"
type=
"checkbox"
(
change
)="
checkboxChangedRessource
($
event
,
ressource
)"
[
checked
]="
isCheckedRessource
(
ressource
)"
/>
<label
for=
"ressource"
>
{{ressource.name}}
</label>
</div>
<div
class=
"piece-prerequires-ressources-element-quantity"
*
ngIf=
"isCheckedRessource(ressource)"
>
<select
name=
"ressource"
[(
ngModel
)]="
getAssociatePrerequireRessource
(
ressource
).
operator
"
>
<option><
</
option
>
<option><
=</
option
>
<option>
=
</option>
<option>
>=
</option>
<option>
>
</option>
</select>
<input
type=
"text"
value=
"1"
[(
ngModel
)]="
getAssociatePrerequireRessource
(
ressource
).
quantity
"
/>
</div>
</div>
<div
class=
"piece-prerequires-ressources-element-quantity"
>
<select
name=
"ressource"
>
<option><
</
option
>
<option><
=</
option
>
<option>
=
</option>
<option>
>=
</option>
<option>
>
</option>
</select>
<input
type=
"text"
value=
"1"
/>
</ng-container>
<ng-container
*
ngFor=
"let ressource of role.ressources"
>
<div
class=
"piece-prerequires-ressources-element"
*
ngIf=
"ressource.name"
>
<div
class=
"piece-prerequires-ressources-element-checkbox"
>
<input
name=
"ressource"
type=
"checkbox"
(
change
)="
checkboxChangedRessource
($
event
,
ressource
)"
[
checked
]="
isCheckedRessource
(
ressource
)"
/>
<label
for=
"ressource"
>
{{ressource.name}}
</label>
</div>
<div
class=
"piece-prerequires-ressources-element-quantity"
*
ngIf=
"isCheckedRessource(ressource)"
>
<select
name=
"ressource"
[(
ngModel
)]="
getAssociatePrerequireRessource
(
ressource
).
operator
"
>
<option><
</
option
>
<option><
=</
option
>
<option>
=
</option>
<option>
>=
</option>
<option>
>
</option>
</select>
<input
type=
"text"
value=
"1"
[(
ngModel
)]="
getAssociatePrerequireRessource
(
ressource
).
quantity
"
/>
</div>
</div>
</div>
<div
class=
"piece-prerequires-ressources-element"
>
<div
class=
"piece-prerequires-ressources-element-checkbox"
>
<input
name=
"ressource"
type=
"checkbox"
/>
<label
for=
"ressource"
>
Citron
</label>
</div>
<div
class=
"piece-prerequires-ressources-element-quantity"
>
<select
name=
"ressource"
>
<option><
</
option
>
<option><
=</
option
>
<option>
=
</option>
<option>
>=
</option>
<option>
>
</option>
</select>
<input
type=
"text"
value=
"1"
/>
</div>
</div>
</ng-container>
</div>
</div>
</div>
...
...
src/app/pieces/tasks/random-event/random-event.component.scss
View file @
e3968fae
...
...
@@ -102,6 +102,7 @@
border-left
:
none
;
display
:
flex
;
flex-direction
:
row
;
padding-left
:
2px
;
&
-title
{
margin-left
:
auto
;
...
...
src/app/pieces/tasks/random-event/random-event.component.ts
View file @
e3968fae
import
{
Component
,
Input
,
OnInit
}
from
'@angular/core'
;
import
{
Mission
}
from
'src/app/class/mission/mission'
;
import
{
PrerequireRessource
}
from
'src/app/class/prerequires/prerequire-ressource/prerequire-ressource'
;
import
{
PrerequireTask
}
from
'src/app/class/prerequires/prerequire-task/prerequire-task'
;
import
{
Ressource
}
from
'src/app/class/ressource/ressource'
;
import
{
Role
}
from
'src/app/class/role/role'
;
import
{
Scenario
}
from
'src/app/class/scenario/scenario'
;
import
{
Task
}
from
'src/app/class/task/task'
;
import
{
PieceDetailsService
}
from
'src/app/services/piece-details/piece-details.service'
;
...
...
@@ -18,6 +22,7 @@ export class RandomEventComponent implements OnInit {
pieceWidth
:
string
=
'400px'
;
@
Input
()
task
:
Task
=
new
Task
(
'normal'
);
@
Input
()
scenario
:
Scenario
=
new
Scenario
();
@
Input
()
mission
!
:
Mission
;
@
Input
()
role
!
:
Role
;
@
Input
()
i
!
:
number
;
...
...
@@ -62,6 +67,15 @@ export class RandomEventComponent implements OnInit {
}
onClickDelete
():
void
{
this
.
role
.
tasks
.
forEach
(
inlineTasks
=>
{
inlineTasks
.
forEach
(
task
=>
{
task
?.
prerequireTasks
.
forEach
((
prerequire
,
index
)
=>
{
if
(
prerequire
.
identifier
==
this
.
task
.
identifier
)
{
task
.
prerequireTasks
.
splice
(
index
,
1
);
}
});
});
});
this
.
role
.
removeTask
(
this
.
i
,
this
.
j
);
this
.
mission
.
equalizeLengths
();
}
...
...
@@ -119,5 +133,84 @@ export class RandomEventComponent implements OnInit {
}
}
return
[
0
,
0
];
}
}
changeIdentifier
(
event
:
any
):
void
{
let
value
:
string
=
event
.
target
.
value
;
if
(
value
!=
''
)
{
this
.
role
.
tasks
.
forEach
(
inlineTasks
=>
{
inlineTasks
.
forEach
(
task
=>
{
task
?.
prerequireTasks
.
forEach
(
prerequire
=>
{
if
(
prerequire
.
identifier
==
this
.
task
.
identifier
)
{
prerequire
.
identifier
=
value
;
}
});
});
});
}
else
{
this
.
role
.
tasks
.
forEach
(
inlineTasks
=>
{
inlineTasks
.
forEach
(
task
=>
{
task
?.
prerequireTasks
.
forEach
((
prerequire
,
index
)
=>
{
if
(
prerequire
.
identifier
==
this
.
task
.
identifier
)
{
task
.
prerequireTasks
.
splice
(
index
,
1
);
}
});
});
});
}
this
.
task
.
identifier
=
value
;
}
checkboxChangedTask
(
event
:
any
,
task
:(
Task
|
null
)):
void
{
if
(
task
instanceof
Task
)
{
if
(
event
.
target
.
checked
)
{
this
.
onCheckTask
(
task
);
}
else
{
this
.
onUncheckTask
(
task
);
}
}
}
isCheckedTask
(
task
:
(
Task
|
null
)):
boolean
{
if
(
task
instanceof
Task
)
{
return
this
.
task
.
prerequireTasks
.
some
(
element
=>
element
.
identifier
==
task
.
identifier
);
}
return
false
;
}
onCheckTask
(
task
:
Task
):
void
{
this
.
task
.
prerequireTasks
.
push
(
new
PrerequireTask
(
task
.
identifier
));
}
onUncheckTask
(
task
:
Task
):
void
{
let
i
:
number
=
this
.
task
.
prerequireTasks
.
findIndex
(
element
=>
element
.
identifier
==
task
.
identifier
);
this
.
task
.
prerequireTasks
.
splice
(
i
,
1
);
}
checkboxChangedRessource
(
event
:
any
,
ressource
:
Ressource
):
void
{
if
(
event
.
target
.
checked
)
{
this
.
onCheckRessource
(
ressource
);
}
else
{
this
.
onUncheckRessource
(
ressource
);
}
console
.
log
(
this
.
task
.
prerequireRessources
);
}
isCheckedRessource
(
ressource
:
Ressource
):
boolean
{
return
this
.
task
.
prerequireRessources
.
some
(
element
=>
element
.
ressource
==
ressource
);
}
onCheckRessource
(
ressource
:
Ressource
):
void
{
this
.
task
.
prerequireRessources
.
push
(
new
PrerequireRessource
(
ressource
));
}
onUncheckRessource
(
ressource
:
Ressource
):
void
{
let
i
:
number
=
this
.
task
.
prerequireRessources
.
findIndex
(
element
=>
ressource
==
element
.
ressource
);
this
.
task
.
prerequireRessources
.
splice
(
i
,
1
);
}
getAssociatePrerequireRessource
(
ressource
:
Ressource
):
PrerequireRessource
{
let
i
:
number
=
this
.
task
.
prerequireRessources
.
findIndex
(
element
=>
ressource
==
element
.
ressource
);
return
this
.
task
.
prerequireRessources
[
i
];
}
}
src/app/pieces/tasks/task/task.component.html
View file @
e3968fae
<div
class=
"piece"
[
ngStyle
]="{'
width
'
:
pieceWidth
}"
(
mouseover
)="
displayMenu=
'show'
"
(
mouseleave
)="
displayMenu=
'hide'
;
display
Prequires=
'hide'
;
display
SymbolChoice=
'hide'
"
<div
class=
"piece"
[
ngStyle
]="{'
width
'
:
pieceWidth
}"
(
mouseover
)="
displayMenu=
'show'
"
(
mouseleave
)="
displayMenu=
'hide'
;
displaySymbolChoice=
'hide'
"
[
style
.
background
]="
task
.
supplementaryRole
?
'
linear-gradient
(
140deg
,
var
(
--piece-background-color
)
0
%,
var
(
--piece-background-color
)
55
%,'+
task
.
supplementaryRole
.
color
+'
55
%,'+
task
.
supplementaryRole
.
color
+'
100
%)'
:
'
var
(
--piece-background-color
)'"
>
...
...
@@ -54,58 +54,62 @@
<div
class=
"piece-prerequires-prerequires"
>
<label
class=
"piece-prerequires-title"
>
Antécédents
</label>
<div
class=
"piece-prerequires-form"
>
<
div
class=
"piece-prerequires-prerequires-element
"
>
<
input
name=
"antecedent"
type=
"checkbox"
value=
"true"
/
>
<label
for=
"antecedent"
>
EX1
</label>
</div
>
<div
class=
"piece-prerequires-prerequires-element"
>
<input
name=
"antecedent"
type=
"checkbox"
/
>
<
label
for=
"antecedent"
>
EX2
</label
>
</
div
>
<
ng-container
*
ngFor=
"let inlineTask of role.tasks
"
>
<
ng-container
*
ngFor=
"let element of inlineTask; let index = index"
>
<div
class=
"piece-prerequires-prerequires-element"
*
ngIf=
"element?.identifier && (task.identifier != element?.identifier) && index < j"
>
<input
name=
"antecedent"
type=
"checkbox"
[
checked
]="
isCheckedTask
(
element
)"
(
change
)="
checkboxChangedTask
($
event
,
element
)"
/
>
<label
for=
"antecedent"
>
{{element?.identifier}}
</label
>
</div
>
<
/ng-container
>
</
ng-container
>
</div>
</div>
<div
class=
"piece-prerequires-ressources"
>
<label
class=
"piece-prerequires-title"
>
Ressources
&
attributs
</label>
<div
class=
"piece-prerequires-form"
>
<div
class=
"piece-prerequires-ressources-element"
>
<div
class=
"piece-prerequires-ressources-element-checkbox"
>
<input
name=
"ressource"
type=
"checkbox"
/>
<label
for=
"ressource"
>
Pain
</label>
<ng-container
*
ngFor=
"let ressource of scenario.ressources"
>
<div
class=
"piece-prerequires-ressources-element"
*
ngIf=
"ressource.name"
>
<div
class=
"piece-prerequires-ressources-element-checkbox"
>
<input
name=
"ressource"
type=
"checkbox"
(
change
)="
checkboxChangedRessource
($
event
,
ressource
)"
[
checked
]="
isCheckedRessource
(
ressource
)"
/>
<label
for=
"ressource"
>
{{ressource.name}}
</label>
</div>
<div
class=
"piece-prerequires-ressources-element-quantity"
*
ngIf=
"isCheckedRessource(ressource)"
>
<select
name=
"ressource"
[(
ngModel
)]="
getAssociatePrerequireRessource
(
ressource
).
operator
"
>
<option><
</
option
>
<option><
=</
option
>
<option>
=
</option>
<option>
>=
</option>
<option>
>
</option>
</select>
<input
type=
"text"
value=
"1"
[(
ngModel
)]="
getAssociatePrerequireRessource
(
ressource
).
quantity
"
/>
</div>
</div>
<div
class=
"piece-prerequires-ressources-element-quantity"
>
<select
name=
"ressource"
>
<option><
</
option
>
<option><
=</
option
>
<option>
=
</option>
<option>
>=
</option>
<option>
>
</option>
</select>
<input
type=
"text"
value=
"1"
/>
</ng-container>
<ng-container
*
ngFor=
"let ressource of role.ressources"
>
<div
class=
"piece-prerequires-ressources-element"
*
ngIf=
"ressource.name"
>
<div
class=
"piece-prerequires-ressources-element-checkbox"
>
<input
name=
"ressource"
type=
"checkbox"
(
change
)="
checkboxChangedRessource
($
event
,
ressource
)"
[
checked
]="
isCheckedRessource
(
ressource
)"
/>
<label
for=
"ressource"
>
{{ressource.name}}
</label>
</div>
<div
class=
"piece-prerequires-ressources-element-quantity"
*
ngIf=
"isCheckedRessource(ressource)"
>
<select
name=
"ressource"
[(
ngModel
)]="
getAssociatePrerequireRessource
(
ressource
).
operator
"
>
<option><
</
option
>
<option><
=</
option
>
<option>
=
</option>
<option>
>=
</option>
<option>
>
</option>
</select>
<input
type=
"text"
value=
"1"
[(
ngModel
)]="
getAssociatePrerequireRessource
(
ressource
).
quantity
"
/>
</div>
</div>
</div>
<div
class=
"piece-prerequires-ressources-element"
>
<div
class=
"piece-prerequires-ressources-element-checkbox"
>
<input
name=
"ressource"
type=
"checkbox"
/>
<label
for=
"ressource"
>
Citron
</label>
</div>
<div
class=
"piece-prerequires-ressources-element-quantity"
>
<select
name=
"ressource"
>
<option><
</
option
>
<option><
=</
option
>
<option>
=
</option>
<option>
>=
</option>
<option>
>
</option>
</select>
<input
type=
"text"
value=
"1"
/>
</div>
</div>
</ng-container>
</div>
</div>
</div>
<div
class=
"piece-form"
>
<div
class=
"piece-form-top"
>
<input
class=
"piece-form-top-identifier"
name=
"identifier"
type=
"text"
[
(
ngModel
)]="
task
.
identifier
"
placeholder=
"A"
min=
"1"
maxlength=
"5"
/>
<input
class=
"piece-form-top-identifier"
name=
"identifier"
type=
"text"
[
value
]="
task
.
identifier
"
(
change
)="
changeIdentifier
($
event
)
"
placeholder=
"A"
min=
"1"
maxlength=
"5"
/>
<div
class=
"piece-form-top-title"
>
Tâche
</div>
<mat-icon
class=
"piece-form-top-comment"
fontIcon=
"comment"
*
ngIf=
"task.comments.length > 0"
></mat-icon>
<mat-icon
class=
"piece-form-top-repeat"
fontIcon=
"refresh"
*
ngIf=
"task.repeat.iteration > 0 || task.repeat.while != ''"
></mat-icon>
...
...
src/app/pieces/tasks/task/task.component.scss
View file @
e3968fae
...
...
@@ -111,6 +111,7 @@
border-left
:
none
;
display
:
flex
;
flex-direction
:
row
;
padding-left
:
2px
;
&
-title
{
margin-left
:
auto
;
...
...
src/app/pieces/tasks/task/task.component.ts
View file @
e3968fae
import
{
Component
,
Input
,
OnInit
}
from
'@angular/core'
;
import
{
Mission
}
from
'src/app/class/mission/mission'
;
import
{
PrerequireRessource
}
from
'src/app/class/prerequires/prerequire-ressource/prerequire-ressource'
;
import
{
PrerequireTask
}
from
'src/app/class/prerequires/prerequire-task/prerequire-task'
;
import
{
Ressource
}
from
'src/app/class/ressource/ressource'
;
import
{
Role
}
from
'src/app/class/role/role'
;
import
{
Scenario
}
from
'src/app/class/scenario/scenario'
;
import
{
Task
}
from
'src/app/class/task/task'
;
import
{
PieceDetailsService
}
from
'src/app/services/piece-details/piece-details.service'
;
...
...
@@ -18,6 +22,7 @@ export class TaskComponent implements OnInit {
pieceWidth
:
string
=
'400px'
;
@
Input
()
task
:
Task
=
new
Task
(
'normal'
);
@
Input
()
scenario
:
Scenario
=
new
Scenario
();
@
Input
()
mission
:
Mission
=
new
Mission
();
@
Input
()
role
!
:
Role
;
@
Input
()
i
!
:
number
;
...
...
@@ -70,6 +75,15 @@ export class TaskComponent implements OnInit {
}
onClickDelete
():
void
{
this
.
role
.
tasks
.
forEach
(
inlineTasks
=>
{
inlineTasks
.
forEach
(
task
=>
{
task
?.
prerequireTasks
.
forEach
((
prerequire
,
index
)
=>
{
if
(
prerequire
.
identifier
==
this
.
task
.
identifier
)
{
task
.
prerequireTasks
.
splice
(
index
,
1
);
}
});
});
});
this
.
role
.
removeTask
(
this
.
i
,
this
.
j
);
this
.
mission
.
equalizeLengths
();
}
...
...
@@ -143,6 +157,83 @@ export class TaskComponent implements OnInit {
}
return
[
0
,
0
];
}
}
changeIdentifier
(
event
:
any
):
void
{
let
value
:
string
=
event
.
target
.
value
;
if
(
value
!=
''
)
{
this
.
role
.
tasks
.
forEach
(
inlineTasks
=>
{
inlineTasks
.
forEach
(
task
=>
{
task
?.
prerequireTasks
.
forEach
(
prerequire
=>
{
if
(
prerequire
.
identifier
==
this
.
task
.
identifier
)
{
prerequire
.
identifier
=
value
;
}
});
});
});
}
else
{
this
.
role
.
tasks
.
forEach
(
inlineTasks
=>
{
inlineTasks
.
forEach
(
task
=>
{
task
?.
prerequireTasks
.
forEach
((
prerequire
,
index
)
=>
{
if
(
prerequire
.
identifier
==
this
.
task
.
identifier
)
{
task
.
prerequireTasks
.
splice
(
index
,
1
);
}
});
});
});
}
this
.
task
.
identifier
=
value
;
}
checkboxChangedTask
(
event
:
any
,
task
:(
Task
|
null
)):
void
{
if
(
task
instanceof
Task
)
{
if
(
event
.
target
.
checked
)
{
this
.
onCheckTask
(
task
);
}
else
{
this
.
onUncheckTask
(
task
);
}
}
}
isCheckedTask
(
task
:
(
Task
|
null
)):
boolean
{
if
(
task
instanceof
Task
)
{
return
this
.
task
.
prerequireTasks
.
some
(
element
=>
element
.
identifier
==
task
.
identifier
);
}
return
false
;
}
onCheckTask
(
task
:
Task
):
void
{
this
.
task
.
prerequireTasks
.
push
(
new
PrerequireTask
(
task
.
identifier
));
}
onUncheckTask
(
task
:
Task
):
void
{
let
i
:
number
=
this
.
task
.
prerequireTasks
.
findIndex
(
element
=>
element
.
identifier
==
task
.
identifier
);
this
.
task
.
prerequireTasks
.
splice
(
i
,
1
);
}
checkboxChangedRessource
(
event
:
any
,
ressource
:
Ressource
):
void
{
if
(
event
.
target
.
checked
)
{
this
.
onCheckRessource
(
ressource
);
}
else
{
this
.
onUncheckRessource
(
ressource
);
}
console
.
log
(
this
.
task
.
prerequireRessources
);
}
isCheckedRessource
(
ressource
:
Ressource
):
boolean
{
return
this
.
task
.
prerequireRessources
.
some
(
element
=>
element
.
ressource
==
ressource
);
}
onCheckRessource
(
ressource
:
Ressource
):
void
{
this
.
task
.
prerequireRessources
.
push
(
new
PrerequireRessource
(
ressource
));
}
onUncheckRessource
(
ressource
:
Ressource
):
void
{
let
i
:
number
=
this
.
task
.
prerequireRessources
.
findIndex
(
element
=>
ressource
==
element
.
ressource
);
this
.
task
.
prerequireRessources
.
splice
(
i
,
1
);
}
getAssociatePrerequireRessource
(
ressource
:
Ressource
):
PrerequireRessource
{
let
i
:
number
=
this
.
task
.
prerequireRessources
.
findIndex
(
element
=>
ressource
==
element
.
ressource
);
return
this
.
task
.
prerequireRessources
[
i
];
}
}
\ No newline at end of file
src/app/sider-pieces/rules/rules.component.ts
View file @
e3968fae
...
...
@@ -21,7 +21,19 @@ export class RulesComponent implements OnInit {
}
removeRessource
(
index
:
number
):
void
{
this
.
scenario
.
missions
.
forEach
(
mission
=>
{
mission
.
roles
.
forEach
(
role
=>
{
role
.
tasks
.
forEach
(
inlineTasks
=>
{
inlineTasks
.
forEach
(
task
=>
{
task
?.
prerequireRessources
.
forEach
((
prerequire
,
j
)
=>
{
if
(
this
.
scenario
.
ressources
[
index
]
==
prerequire
.
ressource
)
{
task
.
prerequireRessources
.
splice
(
j
,
1
);
}
});
});
});
});
});
this
.
scenario
.
ressources
.
splice
(
index
,
1
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment