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

Lechapt-Calmon : amélioration du sélecteur de matériau

parent 9a0d4563
No related branches found
No related tags found
1 merge request!36Resolve "Déplacer la (dé)dérialisation dans JalHyd"
......@@ -8,6 +8,9 @@
"id": "select_material",
"type": "select",
"select": [
{
"id": "select_material_0"
},
{
"id": "select_material_1"
},
......
{
"fs_materiau": "Type of material",
"select_material": "Choice of material",
"select_material_0": "",
"select_material_1": "Unlined cast iron - Coarse concrete (corrosive water)",
"select_material_2": "Cast steel or uncoated - Coarse concrete (somewhat corrosive water)",
"select_material_3": "Cast steel or cement coating",
......
{
"fs_materiau": "Type du matériau",
"select_material": "Choix du matériau",
"select_material_0": "",
"select_material_1": "Fonte ou acier non revêtus - Béton grossier (eau corrosive)",
"select_material_2": "Fonte ou acier non revêtus - Béton grossier (eau peu corrosive)",
"select_material_3": "Fonte ou acier revêtement ciment",
......
import { Observer } from "jalhyd";
import { SelectField } from "../../select-field";
import { FormulaireBase } from "./form-base";
import { NgParamInputComponent } from "../../../components/ngparam-input/ngparam-input.component";
export class FormulaireLechaptCalmon extends FormulaireBase implements Observer {
......@@ -8,6 +9,10 @@ export class FormulaireLechaptCalmon extends FormulaireBase implements Observer
super.completeParse(json);
// abonnement au changement de valeur du select de matériau
this.getFormulaireNodeById("select_material").addObserver(this);
// abonnement au changement de valeur de l'un dex trois champs affectés par le changement de matériau
this.getParamFromSymbol("L").addObserver(this);
this.getParamFromSymbol("M").addObserver(this);
this.getParamFromSymbol("N").addObserver(this);
}
// interface Observer
......@@ -19,5 +24,13 @@ export class FormulaireLechaptCalmon extends FormulaireBase implements Observer
this.reset();
}
}
if (sender instanceof NgParamInputComponent) {
if (data.action === "ngparamAfterValue") {
// value of L, M or N changed
const materialSelect = this.getFormulaireNodeById("select_material") as SelectField;
// reset material select field to "" (empty)
materialSelect.setValue(materialSelect.entries[0]);
}
}
}
}
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