Commit 670af832 authored by Romain DELEAU's avatar Romain DELEAU

Message in prerequire antecedent when there are no possible antecedents

parent b2e39105
...@@ -55,6 +55,8 @@ ...@@ -55,6 +55,8 @@
<div class="piece-prerequires-prerequires"> <div class="piece-prerequires-prerequires">
<label class="piece-prerequires-title">Antécédents</label> <label class="piece-prerequires-title">Antécédents</label>
<div class="piece-prerequires-form"> <div class="piece-prerequires-form">
<div style="text-align: center;" *ngIf="j == 0">La première tâche de la ligne ne peut pas avoir d'antécédent</div>
<ng-container *ngIf="hasPossibleAntecedents()">
<ng-container *ngFor="let inlineTask of role.tasks"> <ng-container *ngFor="let inlineTask of role.tasks">
<ng-container *ngFor="let element of inlineTask; let index = index"> <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"> <div class="piece-prerequires-prerequires-element" *ngIf="element?.identifier && (task.identifier != element?.identifier) && index < j">
...@@ -63,6 +65,8 @@ ...@@ -63,6 +65,8 @@
</div> </div>
</ng-container> </ng-container>
</ng-container> </ng-container>
</ng-container>
<div style="text-align: center;" *ngIf="!hasPossibleAntecedents() && j != 0">Veuillez d'abords entrer des identifiants aux tâches précédentes</div>
</div> </div>
</div> </div>
<div class="piece-prerequires-ressources"> <div class="piece-prerequires-ressources">
......
...@@ -33,6 +33,7 @@ export class AnnexeTaskComponent implements OnInit { ...@@ -33,6 +33,7 @@ export class AnnexeTaskComponent implements OnInit {
@Input() j!: number; @Input() j!: number;
urlIcon: string = 'url("../../../../assets/background-images/annexe.png")'; urlIcon: string = 'url("../../../../assets/background-images/annexe.png")';
antecedent: boolean = false;
constructor(protected pieceDetailsService: PieceDetailsService, protected tooltipService: TooltipService, public dialog: MatDialog) { } constructor(protected pieceDetailsService: PieceDetailsService, protected tooltipService: TooltipService, public dialog: MatDialog) { }
...@@ -287,4 +288,16 @@ export class AnnexeTaskComponent implements OnInit { ...@@ -287,4 +288,16 @@ export class AnnexeTaskComponent implements OnInit {
let i: number = this.task.prerequireRessources.findIndex(element => ressource == element.ressource); let i: number = this.task.prerequireRessources.findIndex(element => ressource == element.ressource);
return this.task.prerequireRessources[i]; return this.task.prerequireRessources[i];
} }
hasPossibleAntecedents(): boolean {
let res = false;
this.role.tasks.forEach(inlineTask => {
for(let i = 0; i < this.j; i++) {
if (inlineTask[i]?.identifier && (this.task.identifier != inlineTask[i]?.identifier)) {
res = true;
}
}
});
return res;
}
} }
...@@ -83,6 +83,8 @@ ...@@ -83,6 +83,8 @@
<div class="piece-prerequires-prerequires"> <div class="piece-prerequires-prerequires">
<label class="piece-prerequires-title">Antécédents</label> <label class="piece-prerequires-title">Antécédents</label>
<div class="piece-prerequires-form"> <div class="piece-prerequires-form">
<div style="text-align: center;" *ngIf="j == 0">La première tâche de la ligne ne peut pas avoir d'antécédent</div>
<ng-container *ngIf="hasPossibleAntecedents()">
<ng-container *ngFor="let inlineTask of role.tasks"> <ng-container *ngFor="let inlineTask of role.tasks">
<ng-container *ngFor="let element of inlineTask; let index = index"> <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"> <div class="piece-prerequires-prerequires-element" *ngIf="element?.identifier && (task.identifier != element?.identifier) && index < j">
...@@ -91,6 +93,8 @@ ...@@ -91,6 +93,8 @@
</div> </div>
</ng-container> </ng-container>
</ng-container> </ng-container>
</ng-container>
<div style="text-align: center;" *ngIf="!hasPossibleAntecedents() && j != 0">Veuillez d'abords entrer des identifiants aux tâches précédentes</div>
</div> </div>
</div> </div>
<div class="piece-prerequires-ressources"> <div class="piece-prerequires-ressources">
......
...@@ -33,6 +33,7 @@ export class FinalTaskComponent implements OnInit { ...@@ -33,6 +33,7 @@ export class FinalTaskComponent implements OnInit {
@Input() j!: number; @Input() j!: number;
urlIcon: string = 'url("../../../../assets/background-images/final.png")'; urlIcon: string = 'url("../../../../assets/background-images/final.png")';
antecedent: boolean = false;
constructor(protected pieceDetailsService: PieceDetailsService, protected tooltipService: TooltipService, public dialog: MatDialog) { } constructor(protected pieceDetailsService: PieceDetailsService, protected tooltipService: TooltipService, public dialog: MatDialog) { }
...@@ -289,4 +290,16 @@ export class FinalTaskComponent implements OnInit { ...@@ -289,4 +290,16 @@ export class FinalTaskComponent implements OnInit {
let i: number = this.task.prerequireRessources.findIndex(element => ressource == element.ressource); let i: number = this.task.prerequireRessources.findIndex(element => ressource == element.ressource);
return this.task.prerequireRessources[i]; return this.task.prerequireRessources[i];
} }
hasPossibleAntecedents(): boolean {
let res = false;
this.role.tasks.forEach(inlineTask => {
for(let i = 0; i < this.j; i++) {
if (inlineTask[i]?.identifier && (this.task.identifier != inlineTask[i]?.identifier)) {
res = true;
}
}
});
return res;
}
} }
...@@ -84,6 +84,8 @@ ...@@ -84,6 +84,8 @@
<div class="piece-prerequires-prerequires"> <div class="piece-prerequires-prerequires">
<label class="piece-prerequires-title">Antécédents</label> <label class="piece-prerequires-title">Antécédents</label>
<div class="piece-prerequires-form"> <div class="piece-prerequires-form">
<div style="text-align: center;" *ngIf="j == 0">La première tâche de la ligne ne peut pas avoir d'antécédent</div>
<ng-container *ngIf="hasPossibleAntecedents()">
<ng-container *ngFor="let inlineTask of role.tasks"> <ng-container *ngFor="let inlineTask of role.tasks">
<ng-container *ngFor="let element of inlineTask; let index = index"> <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"> <div class="piece-prerequires-prerequires-element" *ngIf="element?.identifier && (task.identifier != element?.identifier) && index < j">
...@@ -92,6 +94,8 @@ ...@@ -92,6 +94,8 @@
</div> </div>
</ng-container> </ng-container>
</ng-container> </ng-container>
</ng-container>
<div style="text-align: center;" *ngIf="!hasPossibleAntecedents() && j != 0">Veuillez d'abords entrer des identifiants aux tâches précédentes</div>
</div> </div>
</div> </div>
<div class="piece-prerequires-ressources"> <div class="piece-prerequires-ressources">
......
...@@ -33,6 +33,7 @@ export class OptionnalTaskComponent implements OnInit { ...@@ -33,6 +33,7 @@ export class OptionnalTaskComponent implements OnInit {
@Input() j!: number; @Input() j!: number;
urlIcon: string = 'url("../../../../assets/background-images/optionnal.png")'; urlIcon: string = 'url("../../../../assets/background-images/optionnal.png")';
antecedent: boolean = false;
constructor(protected pieceDetailsService: PieceDetailsService, protected tooltipService: TooltipService, public dialog: MatDialog) { } constructor(protected pieceDetailsService: PieceDetailsService, protected tooltipService: TooltipService, public dialog: MatDialog) { }
...@@ -306,4 +307,16 @@ export class OptionnalTaskComponent implements OnInit { ...@@ -306,4 +307,16 @@ export class OptionnalTaskComponent implements OnInit {
let i: number = this.task.prerequireRessources.findIndex(element => ressource == element.ressource); let i: number = this.task.prerequireRessources.findIndex(element => ressource == element.ressource);
return this.task.prerequireRessources[i]; return this.task.prerequireRessources[i];
} }
hasPossibleAntecedents(): boolean {
let res = false;
this.role.tasks.forEach(inlineTask => {
for(let i = 0; i < this.j; i++) {
if (inlineTask[i]?.identifier && (this.task.identifier != inlineTask[i]?.identifier)) {
res = true;
}
}
});
return res;
}
} }
...@@ -72,6 +72,8 @@ ...@@ -72,6 +72,8 @@
<div class="piece-prerequires-prerequires"> <div class="piece-prerequires-prerequires">
<label class="piece-prerequires-title">Antécédents</label> <label class="piece-prerequires-title">Antécédents</label>
<div class="piece-prerequires-form"> <div class="piece-prerequires-form">
<div style="text-align: center;" *ngIf="j == 0">La première tâche de la ligne ne peut pas avoir d'antécédent</div>
<ng-container *ngIf="hasPossibleAntecedents()">
<ng-container *ngFor="let inlineTask of role.tasks"> <ng-container *ngFor="let inlineTask of role.tasks">
<ng-container *ngFor="let element of inlineTask; let index = index"> <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"> <div class="piece-prerequires-prerequires-element" *ngIf="element?.identifier && (task.identifier != element?.identifier) && index < j">
...@@ -80,6 +82,8 @@ ...@@ -80,6 +82,8 @@
</div> </div>
</ng-container> </ng-container>
</ng-container> </ng-container>
</ng-container>
<div style="text-align: center;" *ngIf="!hasPossibleAntecedents() && j != 0">Veuillez d'abords entrer des identifiants aux tâches précédentes</div>
</div> </div>
</div> </div>
<div class="piece-prerequires-ressources"> <div class="piece-prerequires-ressources">
......
...@@ -33,6 +33,7 @@ export class RandomEventComponent implements OnInit { ...@@ -33,6 +33,7 @@ export class RandomEventComponent implements OnInit {
@Input() j!: number; @Input() j!: number;
urlIcon: string = 'url("../../../../assets/background-images/event.png")'; urlIcon: string = 'url("../../../../assets/background-images/event.png")';
antecedent: boolean = false;
constructor(protected pieceDetailsService: PieceDetailsService, protected tooltipService: TooltipService, public dialog: MatDialog) { } constructor(protected pieceDetailsService: PieceDetailsService, protected tooltipService: TooltipService, public dialog: MatDialog) { }
...@@ -284,4 +285,16 @@ export class RandomEventComponent implements OnInit { ...@@ -284,4 +285,16 @@ export class RandomEventComponent implements OnInit {
let i: number = this.task.prerequireRessources.findIndex(element => ressource == element.ressource); let i: number = this.task.prerequireRessources.findIndex(element => ressource == element.ressource);
return this.task.prerequireRessources[i]; return this.task.prerequireRessources[i];
} }
hasPossibleAntecedents(): boolean {
let res = false;
this.role.tasks.forEach(inlineTask => {
for(let i = 0; i < this.j; i++) {
if (inlineTask[i]?.identifier && (this.task.identifier != inlineTask[i]?.identifier)) {
res = true;
}
}
});
return res;
}
} }
...@@ -82,6 +82,8 @@ ...@@ -82,6 +82,8 @@
<div class="piece-prerequires-prerequires"> <div class="piece-prerequires-prerequires">
<label class="piece-prerequires-title">Antécédents</label> <label class="piece-prerequires-title">Antécédents</label>
<div class="piece-prerequires-form"> <div class="piece-prerequires-form">
<div style="text-align: center;" *ngIf="j == 0">La première tâche de la ligne ne peut pas avoir d'antécédent</div>
<ng-container *ngIf="hasPossibleAntecedents()">
<ng-container *ngFor="let inlineTask of role.tasks"> <ng-container *ngFor="let inlineTask of role.tasks">
<ng-container *ngFor="let element of inlineTask; let index = index"> <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"> <div class="piece-prerequires-prerequires-element" *ngIf="element?.identifier && (task.identifier != element?.identifier) && index < j">
...@@ -90,6 +92,8 @@ ...@@ -90,6 +92,8 @@
</div> </div>
</ng-container> </ng-container>
</ng-container> </ng-container>
</ng-container>
<div style="text-align: center;" *ngIf="!hasPossibleAntecedents() && j != 0">Veuillez d'abords entrer des identifiants aux tâches précédentes</div>
</div> </div>
</div> </div>
<div class="piece-prerequires-ressources"> <div class="piece-prerequires-ressources">
......
...@@ -33,6 +33,7 @@ export class TaskComponent implements OnInit { ...@@ -33,6 +33,7 @@ export class TaskComponent implements OnInit {
@Input() j!: number; @Input() j!: number;
urlIcon: string = 'url("../../../../assets/background-images/tache.png")'; urlIcon: string = 'url("../../../../assets/background-images/tache.png")';
antecedent: boolean = false;
constructor(protected pieceDetailsService: PieceDetailsService, protected tooltipService: TooltipService, public dialog: MatDialog) { } constructor(protected pieceDetailsService: PieceDetailsService, protected tooltipService: TooltipService, public dialog: MatDialog) { }
...@@ -317,4 +318,16 @@ export class TaskComponent implements OnInit { ...@@ -317,4 +318,16 @@ export class TaskComponent implements OnInit {
let i: number = this.task.prerequireRessources.findIndex(element => ressource == element.ressource); let i: number = this.task.prerequireRessources.findIndex(element => ressource == element.ressource);
return this.task.prerequireRessources[i]; return this.task.prerequireRessources[i];
} }
hasPossibleAntecedents(): boolean {
let res = false;
this.role.tasks.forEach(inlineTask => {
for(let i = 0; i < this.j; i++) {
if (inlineTask[i]?.identifier && (this.task.identifier != inlineTask[i]?.identifier)) {
res = true;
}
}
});
return res;
}
} }
\ No newline at end of file
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