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

Message in prerequire antecedent when there are no possible antecedents

parent b2e39105
......@@ -55,14 +55,18 @@
<div class="piece-prerequires-prerequires">
<label class="piece-prerequires-title">Antécédents</label>
<div class="piece-prerequires-form">
<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>
<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 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>
</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 class="piece-prerequires-ressources">
......
......@@ -33,6 +33,7 @@ export class AnnexeTaskComponent implements OnInit {
@Input() j!: number;
urlIcon: string = 'url("../../../../assets/background-images/annexe.png")';
antecedent: boolean = false;
constructor(protected pieceDetailsService: PieceDetailsService, protected tooltipService: TooltipService, public dialog: MatDialog) { }
......@@ -287,4 +288,16 @@ export class AnnexeTaskComponent implements OnInit {
let i: number = this.task.prerequireRessources.findIndex(element => ressource == element.ressource);
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,14 +83,18 @@
<div class="piece-prerequires-prerequires">
<label class="piece-prerequires-title">Antécédents</label>
<div class="piece-prerequires-form">
<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>
<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 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>
</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 class="piece-prerequires-ressources">
......
......@@ -33,6 +33,7 @@ export class FinalTaskComponent implements OnInit {
@Input() j!: number;
urlIcon: string = 'url("../../../../assets/background-images/final.png")';
antecedent: boolean = false;
constructor(protected pieceDetailsService: PieceDetailsService, protected tooltipService: TooltipService, public dialog: MatDialog) { }
......@@ -289,4 +290,16 @@ export class FinalTaskComponent implements OnInit {
let i: number = this.task.prerequireRessources.findIndex(element => ressource == element.ressource);
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,14 +84,18 @@
<div class="piece-prerequires-prerequires">
<label class="piece-prerequires-title">Antécédents</label>
<div class="piece-prerequires-form">
<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>
<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 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>
</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 class="piece-prerequires-ressources">
......
......@@ -33,6 +33,7 @@ export class OptionnalTaskComponent implements OnInit {
@Input() j!: number;
urlIcon: string = 'url("../../../../assets/background-images/optionnal.png")';
antecedent: boolean = false;
constructor(protected pieceDetailsService: PieceDetailsService, protected tooltipService: TooltipService, public dialog: MatDialog) { }
......@@ -306,4 +307,16 @@ export class OptionnalTaskComponent implements OnInit {
let i: number = this.task.prerequireRessources.findIndex(element => ressource == element.ressource);
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,14 +72,18 @@
<div class="piece-prerequires-prerequires">
<label class="piece-prerequires-title">Antécédents</label>
<div class="piece-prerequires-form">
<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>
<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 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>
</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 class="piece-prerequires-ressources">
......
......@@ -33,6 +33,7 @@ export class RandomEventComponent implements OnInit {
@Input() j!: number;
urlIcon: string = 'url("../../../../assets/background-images/event.png")';
antecedent: boolean = false;
constructor(protected pieceDetailsService: PieceDetailsService, protected tooltipService: TooltipService, public dialog: MatDialog) { }
......@@ -284,4 +285,16 @@ export class RandomEventComponent implements OnInit {
let i: number = this.task.prerequireRessources.findIndex(element => ressource == element.ressource);
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,14 +82,18 @@
<div class="piece-prerequires-prerequires">
<label class="piece-prerequires-title">Antécédents</label>
<div class="piece-prerequires-form">
<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>
<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 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>
</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 class="piece-prerequires-ressources">
......
......@@ -33,6 +33,7 @@ export class TaskComponent implements OnInit {
@Input() j!: number;
urlIcon: string = 'url("../../../../assets/background-images/tache.png")';
antecedent: boolean = false;
constructor(protected pieceDetailsService: PieceDetailsService, protected tooltipService: TooltipService, public dialog: MatDialog) { }
......@@ -317,4 +318,16 @@ export class TaskComponent implements OnInit {
let i: number = this.task.prerequireRessources.findIndex(element => ressource == element.ressource);
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