From 07131f57c68cf6b048bdcbfb4166a7daa6d9963e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Grand?= <francois.grand@inrae.fr>
Date: Mon, 20 Mar 2023 08:59:58 +0100
Subject: [PATCH] refactor: backwater curve in PAM: fill
 generateBackwaterInPAM()

refs #609
---
 .../generic-calculator/calculator.component.ts           | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/app/components/generic-calculator/calculator.component.ts b/src/app/components/generic-calculator/calculator.component.ts
index cf9b82d60..68aea17bc 100644
--- a/src/app/components/generic-calculator/calculator.component.ts
+++ b/src/app/components/generic-calculator/calculator.component.ts
@@ -25,7 +25,8 @@ import {
     PbCloison,
     Espece,
     VariatedDetails,
-    ParallelStructure
+    ParallelStructure,
+    MacroRugoRemous
 } from "jalhyd";
 
 import { generateValuesCombination, getUnformattedIthResult, getUnformattedIthValue } from "../../util/util";
@@ -1264,7 +1265,11 @@ export class GenericCalculatorComponent implements OnInit, DoCheck, AfterViewChe
         this.router.navigate(["/calculator", f.uid]);
     }
 
-    public generateBackwaterInPAM() {
+    public async generateBackwaterInPAM() {
+        const f: FormulaireDefinition = await this.formulaireService.createFormulaire(CalculatorType.MacroRugoRemous);
+        const mrr = (f.currentNub as MacroRugoRemous);
+        mrr.setPropValue("nubMacroRugo", this.formulaire.currentNub.uid);
+        this.router.navigate(["/calculator", f.uid]);
     }
 
     /**
-- 
GitLab