diff --git a/src/app/calculators/lechapt-calmon/lechapt-calmon.config.json b/src/app/calculators/lechapt-calmon/lechapt-calmon.config.json index 35f9c27fd4852e6c4597e1455d4e993e57cfc6f0..302bf06a1a66ca150165395f844bd589bb5ce53b 100644 --- a/src/app/calculators/lechapt-calmon/lechapt-calmon.config.json +++ b/src/app/calculators/lechapt-calmon/lechapt-calmon.config.json @@ -27,6 +27,7 @@ { "type": "options", "idCal": "J", + "lcMaterialSelectId": "select_material", "help": "hyd_en_charge/lechapt-calmon" } ] \ No newline at end of file diff --git a/src/app/formulaire/definition/concrete/form-lechapt-calmon.ts b/src/app/formulaire/definition/concrete/form-lechapt-calmon.ts new file mode 100644 index 0000000000000000000000000000000000000000..0bdda676d2eaa94ff25e59316a075aba46c2fcc2 --- /dev/null +++ b/src/app/formulaire/definition/concrete/form-lechapt-calmon.ts @@ -0,0 +1,38 @@ +import { IObservable } from "jalhyd"; + +import { FormulaireBase } from "./form-base"; +import { FieldSet } from "../../fieldset"; + +/** + * Formulaire pour Lechapt et Calmon + */ +export class FormulaireLechaptCalmon extends FormulaireBase { + + /** id of select configuring material */ + private _lcMaterialSelectId: string; + + protected parseOptions(json: {}) { + super.parseOptions(json); + this._lcMaterialSelectId = this.getOption(json, "lcMaterialSelectId"); + } + + public afterParseFieldset(fs: FieldSet) { + if (this._lcMaterialSelectId) { + const sel = fs.getFormulaireNodeById(this._lcMaterialSelectId); + if (sel) { + fs.properties.addObserver(this); + } + } + } + + // interface Observer + + public update(sender: IObservable, data: any) { + super.update(sender, data); + if (data.action === "propertyChange") { + if (data.name === "material") { + this.reset(); + } + } + } +} diff --git a/src/app/services/formulaire.service.ts b/src/app/services/formulaire.service.ts index 9dc42709448f856e7651565605c6bd39fbac08bb..c7ec3a6facc47dc85f2679d88fbf1045e9a47eaf 100644 --- a/src/app/services/formulaire.service.ts +++ b/src/app/services/formulaire.service.ts @@ -36,6 +36,7 @@ import { NgParameter } from "../formulaire/ngparam"; import { FieldsetContainer } from "../formulaire/fieldset-container"; import { FormulairePab } from "../formulaire/definition/concrete/form-pab"; import { FormulaireMacrorugoCompound } from "../formulaire/definition/concrete/form-macrorugo-compound"; +import { FormulaireLechaptCalmon } from "../formulaire/definition/concrete/form-lechapt-calmon"; @Injectable() export class FormulaireService extends Observable { @@ -297,6 +298,10 @@ export class FormulaireService extends Observable { f = new FormulaireCourbeRemous(); break; + case CalculatorType.LechaptCalmon: + f = new FormulaireLechaptCalmon(); + break; + case CalculatorType.ParallelStructure: case CalculatorType.Dever: case CalculatorType.Cloisons: