From a525cb617ea5c7ae82f3363a57799f51a55689f4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Grand?= <francois.grand@inrae.fr>
Date: Fri, 17 Mar 2023 10:32:00 +0100
Subject: [PATCH] feat: rock-ramp fish pass: add button to generate a backwater
 curve in PAM module

refs #609
---
 .../generic-calculator/calculator.component.html   |  5 +++++
 .../generic-calculator/calculator.component.ts     | 14 +++++++++++++-
 src/locale/messages.en.json                        |  1 +
 src/locale/messages.fr.json                        |  3 ++-
 4 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/src/app/components/generic-calculator/calculator.component.html b/src/app/components/generic-calculator/calculator.component.html
index 1a816d5c8..79dec21bc 100644
--- a/src/app/components/generic-calculator/calculator.component.html
+++ b/src/app/components/generic-calculator/calculator.component.html
@@ -213,6 +213,11 @@
                         {{ uitextExportAllPbResults }}
                     </button>
 
+                    <button mat-raised-button color="accent" id="generate-backwater-curve" *ngIf="isPAM"
+                        (click)="generateBackwaterInPAM()">
+                        {{ uitextGenerateBackwaterInPAM }}
+                    </button>
+
                     <mat-card-content>
                         <calc-results id="resultsComp" [formulaire]="formulaire" (afterViewChecked)="onCalcResultsViewChecked()"></calc-results>
                     </mat-card-content>
diff --git a/src/app/components/generic-calculator/calculator.component.ts b/src/app/components/generic-calculator/calculator.component.ts
index 9d5a06dff..cf9b82d60 100644
--- a/src/app/components/generic-calculator/calculator.component.ts
+++ b/src/app/components/generic-calculator/calculator.component.ts
@@ -318,6 +318,10 @@ export class GenericCalculatorComponent implements OnInit, DoCheck, AfterViewChe
         return this.intlService.localizeText("INFO_CALCULATOR_RESULTS_EXPORT_ALL_PB_RESULTS");
     }
 
+    public get uitextGenerateBackwaterInPAM() {
+        return this.intlService.localizeText("INFO_MACRORUGO_GENERATE_BACKWATER_CURVE");
+    }
+
     public get uitextLoadPredefinedEspece(): string {
         return this.intlService.localizeText("INFO_CALCULATOR_LOAD_PREDEFINED_ESPECE");
     }
@@ -700,6 +704,11 @@ export class GenericCalculatorComponent implements OnInit, DoCheck, AfterViewChe
         return this.is(CalculatorType.MacroRugoCompound);
     }
 
+    // true if current Nub is MacroRugoCompound
+    public get isPAM() {
+        return this.is(CalculatorType.MacroRugo);
+    }
+
     // true if current Nub is PreBarrage
     public get isPB() {
         return this.is(CalculatorType.PreBarrage);
@@ -750,7 +759,7 @@ export class GenericCalculatorComponent implements OnInit, DoCheck, AfterViewChe
         return this.is(CalculatorType.SectionParametree);
     }
 
-    // true if current Nub is PAR
+    // true if current Nub is CourbeRemous
     public get isRemous() {
         return this.is(CalculatorType.CourbeRemous);
     }
@@ -1255,6 +1264,9 @@ export class GenericCalculatorComponent implements OnInit, DoCheck, AfterViewChe
         this.router.navigate(["/calculator", f.uid]);
     }
 
+    public generateBackwaterInPAM() {
+    }
+
     /**
      * Opens a modal that allows to choose a predefined Espece
      * and load its values in current Espece module
diff --git a/src/locale/messages.en.json b/src/locale/messages.en.json
index 49d04bcaa..99760ce8b 100755
--- a/src/locale/messages.en.json
+++ b/src/locale/messages.en.json
@@ -428,6 +428,7 @@
     "INFO_MACRORUGO_DESCRIPTION": "natural block",
     "INFO_MACRORUGO_TITRE_COURT": "Rock-ramp",
     "INFO_MACRORUGO_TITRE": "Rock-ramp fishpasses",
+    "INFO_MACRORUGO_GENERATE_BACKWATER_CURVE":"Generate backwater curve",
     "INFO_MENU_DIAGRAM_TITLE": "Modules diagram",
     "INFO_MACRORUGOCOMPOUND_TITRE": "Compound rock-ramp fishpasses",
     "INFO_MACRORUGOCOMPOUND_DESCRIPTION": "natural multiple inclined block aprons",
diff --git a/src/locale/messages.fr.json b/src/locale/messages.fr.json
index 764dfbbbf..5166d6b76 100755
--- a/src/locale/messages.fr.json
+++ b/src/locale/messages.fr.json
@@ -429,6 +429,7 @@
     "INFO_MACRORUGO_DESCRIPTION": "poisson naturelle bloc",
     "INFO_MACRORUGO_TITRE_COURT": "Macro-rugo.",
     "INFO_MACRORUGO_TITRE": "Passe à macro-rugosités",
+    "INFO_MACRORUGO_GENERATE_BACKWATER_CURVE": "Générer une courbe de remous",
     "INFO_MENU_DIAGRAM_TITLE": "Diagramme des modules",
     "INFO_MACRORUGOCOMPOUND_TITRE": "Passe à macro-rugosités complexe",
     "INFO_MACRORUGOCOMPOUND_DESCRIPTION": "poisson naturelle bloc radiers multiples incliné",
@@ -774,4 +775,4 @@
     "ERROR_VERIF_PAB_WALL_NOT_CROSSABLE": "La cloison n°%N% n'est pas franchissable",
     "ERROR_VERIF_PAB_DW_NOT_CROSSABLE": "La cloison aval n'est pas franchissable",
     "WARNING_VERIF_PAR_SPECIES_GROUP": "Les groupes d'espèces 3a, 3b et 7b sont déconseillés pour ce type de passe"
-}
+}
\ No newline at end of file
-- 
GitLab