diff --git a/src/app/components/generic-calculator/calculator.component.html b/src/app/components/generic-calculator/calculator.component.html index f3fb61d6c1b179a8c58c4054dad4386e8820b78a..f94d21d49c1b4d86244131ce3de674a7dcf9940f 100644 --- a/src/app/components/generic-calculator/calculator.component.html +++ b/src/app/components/generic-calculator/calculator.component.html @@ -74,7 +74,8 @@ <h1 [innerHTML]="uitextResultsTitle"></h1> </mat-card-title> <div fxFlex></div> - <button mat-raised-button color="accent" id="generate-pab" *ngIf="isPABCloisons" (click)="generatePAB()"> + <button mat-raised-button color="accent" id="generate-pab" *ngIf="isPABCloisons" (click)="generatePAB()" + [disabled]="! generatePABEnabled" [title]="uitextGeneratePabTitle"> {{ uitextGeneratePAB }} </button> </mat-card-header> diff --git a/src/app/components/generic-calculator/calculator.component.ts b/src/app/components/generic-calculator/calculator.component.ts index e662fc4374cffa447e16fb5a092cc031d63d6ebb..ea5c95b41199118efc6bf6e70a87b53b3842e23a 100644 --- a/src/app/components/generic-calculator/calculator.component.ts +++ b/src/app/components/generic-calculator/calculator.component.ts @@ -455,6 +455,22 @@ export class GenericCalculatorComponent extends BaseComponent implements OnInit, ); } + // PAB generation is enabled only if no parameter is varying + public get generatePABEnabled(): boolean { + let ret = true; + for (const p of this._formulaire.currentNub.parameterIterator) { + ret = ret && (! p.hasMultipleValues); + } + return ret; + } + + public get uitextGeneratePabTitle() { + if (! this.generatePABEnabled) { + return this.intlService.localizeText("INFO_PAB_PARAMETRES_FIXES"); + } + return ""; + } + /** * Génère une passe à bassins à partir du modèle de cloisons en cours */ diff --git a/src/locale/messages.en.json b/src/locale/messages.en.json index 1fce8bfcdaf8e786cedf0587d7ed2a18410e0617..cbd1869b35c80d863f7bc5bba1d1b983f062e291 100644 --- a/src/locale/messages.en.json +++ b/src/locale/messages.en.json @@ -253,6 +253,7 @@ "INFO_PAB_HEADER_PARAMETERS": "Parameters", "INFO_PAB_HEADER_VALUES": "Values", "INFO_PAB_CLOISON_OUVRAGE_N": "Wall : device #%s", + "INFO_PAB_PARAMETRES_FIXES": "All parameters must be fixed", "INFO_PAB_TITRE_COURT": "Fish ladder", "INFO_PAB_TITRE": "Fish ladder", "INFO_PAB_TITRE_PROFIL": "Fish ladder longitudinal profile", diff --git a/src/locale/messages.fr.json b/src/locale/messages.fr.json index 1c4ace04cc51b24cf453797047f00db14128cc2e..a789665c678ed1bc9fb742a69275b3d904bb9617 100644 --- a/src/locale/messages.fr.json +++ b/src/locale/messages.fr.json @@ -253,6 +253,7 @@ "INFO_PAB_HEADER_PARAMETERS": "Paramètres", "INFO_PAB_HEADER_VALUES": "Valeurs", "INFO_PAB_CLOISON_OUVRAGE_N": "Cloison : ouvrage n° %s", + "INFO_PAB_PARAMETRES_FIXES": "Tous les paramètres doivent être fixés", "INFO_PAB_TITRE_COURT": "PAB", "INFO_PAB_TITRE": "Passe à bassins", "INFO_PAB_TITRE_PROFIL": "Profil en long de la passe",