From 88d2ffdc60c402403248439101fdbf0f667047a3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Grand?= <francois.grand@inrae.fr>
Date: Wed, 14 Dec 2022 17:13:57 +0100
Subject: [PATCH] refactor: application start page: rename Lechapt-Calmon
 calculator to Pressure loss

refs #585
---
 .../config.json                               | 21 ++++++++++++++-----
 .../{lechaptcalmon => pressureloss}/en.json   |  2 ++
 .../{lechaptcalmon => pressureloss}/fr.json   |  2 ++
 .../calculator-list.component.ts              |  3 ++-
 src/app/config.json                           |  2 +-
 src/locale/messages.en.json                   |  1 +
 src/locale/messages.fr.json                   |  1 +
 7 files changed, 25 insertions(+), 7 deletions(-)
 rename src/app/calculators/{lechaptcalmon => pressureloss}/config.json (54%)
 rename src/app/calculators/{lechaptcalmon => pressureloss}/en.json (91%)
 rename src/app/calculators/{lechaptcalmon => pressureloss}/fr.json (91%)

diff --git a/src/app/calculators/lechaptcalmon/config.json b/src/app/calculators/pressureloss/config.json
similarity index 54%
rename from src/app/calculators/lechaptcalmon/config.json
rename to src/app/calculators/pressureloss/config.json
index 1b440a6ae..00befe99f 100644
--- a/src/app/calculators/lechaptcalmon/config.json
+++ b/src/app/calculators/pressureloss/config.json
@@ -1,6 +1,21 @@
 [
     {
-        "id": "fs_materiau",
+        "id": "fs_pressureloss_law",
+        "type": "fieldset",
+        "fields": [
+            {
+                "id": "select_pressureloss_law",
+                "type": "select",
+                "property": "pressureLossType",
+                "default": "LechaptCalmon",
+                "help": {
+                    "0": "hyd_en_charge/lechapt-calmon.html"
+                }
+            }
+        ]
+    },
+    {
+        "id": "fs_lechaptcalmon",
         "type": "fieldset",
         "fields": [
             {
@@ -24,9 +39,5 @@
             "Lg",
             "Ks"
         ]
-    },
-    {
-        "type": "options",
-        "help": "hyd_en_charge/lechapt-calmon.html"
     }
 ]
\ No newline at end of file
diff --git a/src/app/calculators/lechaptcalmon/en.json b/src/app/calculators/pressureloss/en.json
similarity index 91%
rename from src/app/calculators/lechaptcalmon/en.json
rename to src/app/calculators/pressureloss/en.json
index 729994b0e..e93afd9bf 100644
--- a/src/app/calculators/lechaptcalmon/en.json
+++ b/src/app/calculators/pressureloss/en.json
@@ -1,4 +1,6 @@
 {
+    "fs_pressureloss_law": "Pressure loss",
+    "select_pressureloss_law": "Pressure loss law",
     "fs_materiau": "Type of material",
     "select_material": "Choice of material",
     "MATERIAL_0": "Unlined cast iron - Coarse concrete (corrosive water)",
diff --git a/src/app/calculators/lechaptcalmon/fr.json b/src/app/calculators/pressureloss/fr.json
similarity index 91%
rename from src/app/calculators/lechaptcalmon/fr.json
rename to src/app/calculators/pressureloss/fr.json
index 89884cabd..17965675c 100644
--- a/src/app/calculators/lechaptcalmon/fr.json
+++ b/src/app/calculators/pressureloss/fr.json
@@ -1,4 +1,6 @@
 {
+    "fs_pressureloss_law": "Perte de charge",
+    "select_pressureloss_law": "Loi de perte de charge",
     "fs_materiau": "Type du matériau",
     "select_material": "Choix du matériau",
     "MATERIAL_0": "Fonte ou acier non revêtus - Béton grossier (eau corrosive)",
diff --git a/src/app/components/calculator-list/calculator-list.component.ts b/src/app/components/calculator-list/calculator-list.component.ts
index ec0ec059a..b62c4f2e4 100644
--- a/src/app/components/calculator-list/calculator-list.component.ts
+++ b/src/app/components/calculator-list/calculator-list.component.ts
@@ -120,7 +120,8 @@ export class CalculatorListComponent implements OnInit {
                             CalculatorType.CloisonAval,
                             CalculatorType.YAXN,
                             CalculatorType.PbBassin,
-                            CalculatorType.PbCloison
+                            CalculatorType.PbCloison,
+                            CalculatorType.LechaptCalmon
                         ].includes(t)
                     ) {
                         unusedTheme.calculators.push({
diff --git a/src/app/config.json b/src/app/config.json
index 97f3c60d6..1bc488230 100644
--- a/src/app/config.json
+++ b/src/app/config.json
@@ -63,7 +63,7 @@
                 "path": "en-charge.jpg",
                 "credits": "Catherine Tailleux / Inrae"
             },
-            "calculators": [ 1, 0 ]
+            "calculators": [ 35, 0 ]
         },
         {
             "name": "LOIS_D_OUVRAGES",
diff --git a/src/locale/messages.en.json b/src/locale/messages.en.json
index 6ac8ce559..c88ae52e5 100755
--- a/src/locale/messages.en.json
+++ b/src/locale/messages.en.json
@@ -261,6 +261,7 @@
     "INFO_LECHAPTCALMON_DESCRIPTION": "pipe flow circular headloss",
     "INFO_LECHAPTCALMON_TITRE_COURT": "Lechapt-C.",
     "INFO_LECHAPTCALMON_TITRE": "Lechapt-Calmon",
+    "INFO_PRESSURELOSS_TITRE": "Pressure loss",
     "INFO_LIB_ABSCISSE": "Abscissa (m)",
     "INFO_LIB_ALTITUDE": "Altitude (m)",
     "INFO_LIB_LENGTHS": "Every length",
diff --git a/src/locale/messages.fr.json b/src/locale/messages.fr.json
index 241353236..70fd109ee 100755
--- a/src/locale/messages.fr.json
+++ b/src/locale/messages.fr.json
@@ -261,6 +261,7 @@
     "INFO_LECHAPTCALMON_DESCRIPTION": "Hydraulique en charge conduite colebrook",
     "INFO_LECHAPTCALMON_TITRE_COURT": "Lechapt-C.",
     "INFO_LECHAPTCALMON_TITRE": "Lechapt-Calmon",
+    "INFO_PRESSURELOSS_TITRE": "Perte de charge",
     "INFO_LIB_ABSCISSE": "Abscisse (m)",
     "INFO_LIB_ALTITUDE": "Altitude (m)",
     "INFO_LIB_LENGTHS": "Toutes les longueurs",
-- 
GitLab