From e10d1d3821fe8495ff819c0c4ad5fa61cf48c5fc Mon Sep 17 00:00:00 2001 From: Mathias Chouet <mathias.chouet@irstea.fr> Date: Thu, 25 Jun 2020 16:53:57 +0200 Subject: [PATCH] PreBarrage: add default structure when adding wall --- src/app/formulaire/definition/form-prebarrage.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/app/formulaire/definition/form-prebarrage.ts b/src/app/formulaire/definition/form-prebarrage.ts index 063d37ecf..0199451c3 100644 --- a/src/app/formulaire/definition/form-prebarrage.ts +++ b/src/app/formulaire/definition/form-prebarrage.ts @@ -106,7 +106,6 @@ export class FormulairePrebarrage extends FormulaireFixedVar { wallForm.addObserver(this); // @TODO why not this.form ? wallForm is just a dummy form to extract elements from… ServiceFactory.instance.formulaireService.loadUpdateFormulaireLocalisation(wallForm); // add fieldsets for existing Structures - console.log(`Node ${node.uid} : ${node.structures.length} structures, Form ${this.uid} : ${this._kids.length} form elements`); if (node.structures.length > 0) { for (const struct of node.structures) { for (const e of wallForm.allFormElements) { @@ -116,8 +115,13 @@ export class FormulairePrebarrage extends FormulaireFixedVar { } } } else { - // if there was no existing structure, add a default one ! @TODO - console.log("TODO add default structure"); + // if there was no existing structure, add a default one + for (const e of wallForm.allFormElements) { + if (e instanceof FieldsetContainer) { + e.addFromTemplate(0); + break; + } + } } this.showFormElements(wallForm); } -- GitLab