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

Calculator page: list other calculators using the current one, below title

parent dfe603e0
No related branches found
No related tags found
No related merge requests found
......@@ -25,6 +25,15 @@
<!-- on utilise [innerHTML] pour que les codes HTML comme &nbsp; soient interprétés correctement -->
<mat-card-title>
<h1 [innerHTML]="uitextTitre"></h1>
<div id="calculator-used-by" *ngIf="calculatorsUsingThisOne.length > 0">
{{ uitextUsedBy }}
<span *ngFor="let c of calculatorsUsingThisOne; let i = index" >
<a class="used-by-item" (click)="toCalc(c.uid)">
{{ c.label }}
</a>
<span *ngIf="i < calculatorsUsingThisOne.length - 1">, </span>
</span>
</div>
</mat-card-title>
</mat-card-header>
......
......@@ -77,6 +77,16 @@ mat-card {
mat-card-title {
font-size: 16px;
margin-bottom: 8px;
#calculator-used-by {
font-weight: normal;
margin-top: -8px;
font-size: .9em;
a.used-by-item {
cursor: pointer;
}
}
}
}
......
......@@ -211,6 +211,10 @@ export class GenericCalculatorComponent implements OnInit, DoCheck, AfterViewChe
return this.intlService.localizeText("INFO_CALCULATOR_CLOSE");
}
public get uitextUsedBy() {
return this.intlService.localizeText("INFO_CALCULATOR_USED_BY");
}
public get quicknavItems() {
const elts = [ "input", "results" ];
if (this.isWide && this.hasResults) {
......@@ -294,6 +298,22 @@ export class GenericCalculatorComponent implements OnInit, DoCheck, AfterViewChe
}
}
/** open calculator identified by given UID */
public toCalc(id: string) {
this.appComponent.toCalc(id);
}
/** list of calculators having a link pointing to the current calculator */
public get calculatorsUsingThisOne(): any {
const sources = Session.getInstance().getDependingNubs(this._formulaire.currentNub.uid, undefined, true);
return sources.map((s) => {
return {
label: this.formulaireService.getFormulaireFromNubId(s.uid).calculatorName,
uid: s.uid
};
});
}
/**
* Moves the view to the start of the "Results" section
*/
......
......@@ -59,6 +59,7 @@
"INFO_CALCULATOR_RESULTS_GENERATE_PAB": "Generate a fish ladder",
"INFO_CALCULATOR_RESULTS_TITLE": "Results",
"INFO_CALCULATOR_SAVE": "Save",
"INFO_CALCULATOR_USED_BY": "Used by",
"INFO_CALCULATOR_VALEURS": "Values",
"INFO_CLOISONS_TITRE_COURT": "Cross walls",
"INFO_CLOISONS_TITRE": "Fish ladder: Cross walls",
......
......@@ -59,6 +59,7 @@
"INFO_CALCULATOR_RESULTS_GENERATE_PAB": "Générer une passe à bassins",
"INFO_CALCULATOR_RESULTS_TITLE": "Résultats",
"INFO_CALCULATOR_SAVE": "Enregistrer",
"INFO_CALCULATOR_USED_BY": "Utilisé par",
"INFO_CALCULATOR_VALEURS": "Valeurs",
"INFO_CLOISONS_TITRE_COURT": "Cloisons",
"INFO_CLOISONS_TITRE": "Passe à bassins&nbsp;: 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