Skip to content
Snippets Groups Projects
Commit 52ab94a3 authored by mathias.chouet's avatar mathias.chouet
Browse files

Fix #291 - Lechapt-Calmon: reset results when material changes

parent 003f2150
No related branches found
No related tags found
No related merge requests found
Pipeline #137571 failed
......@@ -27,6 +27,7 @@
{
"type": "options",
"idCal": "J",
"lcMaterialSelectId": "select_material",
"help": "hyd_en_charge/lechapt-calmon"
}
]
\ No newline at end of file
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();
}
}
}
}
......@@ -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:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment