diff --git a/src/app/components/fixedvar-results/fixed-results.component.ts b/src/app/components/fixedvar-results/fixed-results.component.ts index 5d676ff58a6c1cd83ee93042e48aca5179695aa9..ab00d23500b5ffc722e01a3bcae00b68a843ccd4 100644 --- a/src/app/components/fixedvar-results/fixed-results.component.ts +++ b/src/app/components/fixedvar-results/fixed-results.component.ts @@ -8,7 +8,7 @@ import { FormulaireService } from "../../services/formulaire.service"; import { ResultsComponent } from "./results.component"; import { AppComponent } from "../../app.component"; -import { Structure, capitalize } from "jalhyd"; +import { capitalize } from "jalhyd"; import { sprintf } from "sprintf-js"; @@ -95,10 +95,14 @@ export class FixedResultsComponent extends ResultsComponent { for (const fp of this.fixedParams) { if (fp.symbol === symbol) { let label = this.formattedLabel(fp); - // add structure position before label - if (fp.paramDefinition.parentNub instanceof Structure) { - const pos = fp.paramDefinition.parentNub.findPositionInParent(); - label = this.intlService.localizeText("INFO_OUVRAGE") + " n°" + (pos + 1) + ": " + label; + const nub = fp.paramDefinition.parentNub; + // add child type and position before label + if (nub && nub.parent && nub.parent.childrenType) { + const pos = nub.findPositionInParent(); + // label = this.intlService.localizeText("INFO_OUVRAGE") + " n°" + (pos + 1) + ": " + label; + const cn = capitalize(this.intlService.childName(nub.parent)); + label = sprintf(this.intlService.localizeText("INFO_STUFF_N"), cn) + + (pos + 1) + ": " + label; } label += this._fixedResults.getHelpLink(symbol); data.push({ @@ -189,10 +193,14 @@ export class FixedResultsComponent extends ResultsComponent { // 1. fixed parameters for (const fp of this.fixedParams) { let label = this.formattedLabel(fp); - // add structure position before label - if (fp.paramDefinition.parentNub instanceof Structure) { - const pos = fp.paramDefinition.parentNub.findPositionInParent(); - label = this.intlService.localizeText("INFO_OUVRAGE") + " n°" + (pos + 1) + ": " + label; + const nub = fp.paramDefinition.parentNub; + // add child type and position before label + if (nub && nub.parent && nub.parent.childrenType) { + const pos = nub.findPositionInParent(); + // label = this.intlService.localizeText("INFO_OUVRAGE") + " n°" + (pos + 1) + ": " + label; + const cn = capitalize(this.intlService.childName(nub.parent)); + label = sprintf(this.intlService.localizeText("INFO_STUFF_N"), cn) + + (pos + 1) + ": " + label; } label += this._fixedResults.getHelpLink(fp.symbol); data.push({ diff --git a/src/app/components/generic-input/generic-input.component.ts b/src/app/components/generic-input/generic-input.component.ts index f49b62c0e4ebdfc7d6f8815b6266a017f9db1ae6..0e946cfed7e85da247d361a39223b2c21dee94e4 100644 --- a/src/app/components/generic-input/generic-input.component.ts +++ b/src/app/components/generic-input/generic-input.component.ts @@ -1,6 +1,6 @@ import { Input, Output, EventEmitter, ChangeDetectorRef, OnChanges, ViewChild } from "@angular/core"; import { NgModel } from "@angular/forms"; -import { isNumeric, Structure, Pab, MacrorugoCompound } from "jalhyd"; +import { isNumeric, Structure, Pab, MacrorugoCompound, SPP } from "jalhyd"; import { FormulaireDefinition } from "../../formulaire/definition/form-definition"; import { NgParameter } from "../../formulaire/ngparam"; import { I18nService } from "../../services/internationalisation.service"; @@ -42,10 +42,9 @@ export abstract class GenericInputComponent implements OnChanges { if (this._model instanceof NgParameter) { const param = this._model as NgParameter; id = param.symbol; - // if inside a nested Structure, prefix with Structure position - // to disambiguate + // if inside a child Nub, prefix with child position to disambiguate const nub = param.paramDefinition.parentNub; - if (nub && (nub instanceof Structure || nub.parent instanceof Pab || nub.parent instanceof MacrorugoCompound)) { + if (nub && nub.parent && nub.parent.childrenType) { id = nub.findPositionInParent() + "_" + id; } } diff --git a/src/app/components/param-computed/param-computed.component.ts b/src/app/components/param-computed/param-computed.component.ts index b6779c083d1b94e387982d52039ecf76caa40851..54bbe75fb9a94dcd6d9c9e3b8046aae442fbc1ae 100644 --- a/src/app/components/param-computed/param-computed.component.ts +++ b/src/app/components/param-computed/param-computed.component.ts @@ -25,10 +25,9 @@ export class ParamComputedComponent { */ public get inputId() { let id = "calc_" + this.param.symbol; - // if inside a nested Structure, prefix with Structure position - // to disambiguate + // if inside a child Nub, prefix with child position to disambiguate const nub = this.param.paramDefinition.parentNub; - if (nub && nub instanceof Structure) { + if (nub && nub.parent && nub.parent.childrenType) { id = nub.findPositionInParent() + "_" + id; } return id; diff --git a/src/app/components/param-link/param-link.component.ts b/src/app/components/param-link/param-link.component.ts index ab7b72c470193eb6142cba906fac41e843b88170..f12c7cb64085395a19b6c06b89527167bbe538c7 100644 --- a/src/app/components/param-link/param-link.component.ts +++ b/src/app/components/param-link/param-link.component.ts @@ -41,10 +41,9 @@ export class ParamLinkComponent implements OnChanges, Observer, OnDestroy { public get selectId() { let id = "linked_" + this.param.symbol; - // if inside a nested Structure, prefix with Structure position - // to disambiguate + // if inside a child Nub, prefix with child position to disambiguate const nub = this.param.paramDefinition.parentNub; - if (nub && nub instanceof Structure) { + if (nub && nub.parent && nub.parent.childrenType) { id = nub.findPositionInParent() + "_" + id; } return id; diff --git a/src/app/components/param-values/param-values.component.ts b/src/app/components/param-values/param-values.component.ts index a22cc098c9f4c24ac26af7f548a5473baf3e2c58..6246b682532bdbb0ae75c66e2926be2b2934aec3 100644 --- a/src/app/components/param-values/param-values.component.ts +++ b/src/app/components/param-values/param-values.component.ts @@ -45,10 +45,9 @@ export class ParamValuesComponent implements AfterViewInit, Observer { public get inputId() { let id = "var_" + this.param.symbol; - // if inside a nested Structure, prefix with Structure position - // to disambiguate + // if inside a child Nub, prefix with child position to disambiguate const nub = this.param.paramDefinition.parentNub; - if (nub && nub instanceof Structure) { + if (nub && nub.parent && nub.parent.childrenType) { id = nub.findPositionInParent() + "_" + id; } return id; diff --git a/src/app/formulaire/fieldset.ts b/src/app/formulaire/fieldset.ts index 64d33ddf1062056b3554792c1a2fc49da219da59..9865597dd405b2f59898bac55c471544d2f03951 100644 --- a/src/app/formulaire/fieldset.ts +++ b/src/app/formulaire/fieldset.ts @@ -297,8 +297,8 @@ export class FieldSet extends FormulaireElement implements Observer { this.setSelectValueFromProperty("select_unit", "trigoUnit"); break; - case "spp_operation": // SPP - this.setSelectValueFromProperty("spp_operation", "sppOperation"); + case "fs_spp": // SPP + this.setSelectValueFromProperty("select_spp_operation", "sppOperation"); break; } }