diff --git a/src/app/components/generic-calculator/calculator.component.html b/src/app/components/generic-calculator/calculator.component.html index d1f8ae99204287d80272af1c6d54b9448d94440f..d9f3b2650147b8fb0487566d69928d95d0b5755d 100644 --- a/src/app/components/generic-calculator/calculator.component.html +++ b/src/app/components/generic-calculator/calculator.component.html @@ -38,7 +38,18 @@ </mat-card-header> - <quicknav [fxHide.gt-sm]="! isWide" [items]="quicknavItems" [currentItem]="'input'" [align]="'left'"></quicknav> + <quicknav *ngIf="! isPB" [fxHide.gt-sm]="! isWide" [items]="quicknavItems" [currentItem]="'input'" [align]="'left'"></quicknav> + + <div *ngIf="isPB" class="fake-quicknav" id="pb-data-results-selector"> + <div class="drs-row"> + <div class="drs-item" [class.current]="showPBInputData"> + <a (click)="showPBInputData = true;">{{ uitextInputData }}</a> + </div> + <div class="drs-item" [class.current]="! showPBInputData"> + <a (click)="showPBInputData = false;">{{ uitextResults }}</a> + </div> + </div> + </div> <form> @@ -61,7 +72,8 @@ <div id="calc-card-field-sets-container" [fxLayout]="isPB ? 'row wrap' : 'column'"> <ng-template ngFor let-fe [ngForOf]="formElements"> - <field-set *ngIf="isFieldset(fe)" [style.display]="getElementStyleDisplay(fe.id)" [fieldSet]=fe + <field-set *ngIf="isFieldset(fe)" + [hidden]="isPB && ! showPBInputData" [style.display]="getElementStyleDisplay(fe.id)" [fieldSet]=fe (radio)=onRadioClick($event) (validChange)=onElementValid() (inputChange)=onInputChange($event) (tabPressed)="onTabPressed($event)" [fxFlex.gt-sm]="isPB ? '1 0 400px' : '1 0 auto'" @@ -69,7 +81,8 @@ [fxFlex.lt-sm]="isPB ? '1 0 300px' : '1 0 auto'"> </field-set> - <fieldset-container *ngIf="isFieldsetContainer(fe)" [style.display]="getElementStyleDisplay(fe.id)" [_container]=fe + <fieldset-container *ngIf="isFieldsetContainer(fe)" + [hidden]="isPB && ! showPBInputData" [style.display]="getElementStyleDisplay(fe.id)" [_container]=fe (radio)=onRadioClick($event) (validChange)=onElementValid() (inputChange)=onInputChange($event) (tabPressed)="onTabPressed($event)" fxFlex="1 0 auto"> @@ -105,14 +118,14 @@ <!-- résultats --> <mat-card id="calc-card-results" - [class.pab-results]="isWide" + [class.pab-results]="isWide" [hidden]="isPB && showPBInputData" [fxFlex.gt-sm]="isWide ? '1 0 auto' : '1 0 400px'" [fxFlex.lt-md]="isWide ? '1 0 auto' : '1 0 500px'" [fxFlex.lt-sm]="isWide ? '1 0 auto' : '1 0 300px'"> <div id="fake-results-anchor"></div> - <quicknav [ngClass.lt-xs]="'extraSmall'" [fxHide.gt-sm]="! isWide" [items]="quicknavItems" [currentItem]="'results'" [align]="'left'"></quicknav> + <quicknav *ngIf="! isPB" [ngClass.lt-xs]="'extraSmall'" [fxHide.gt-sm]="! isWide" [items]="quicknavItems" [currentItem]="'results'" [align]="'left'"></quicknav> <mat-card-header *ngIf="! isWide" [fxHide.lt-md]="! isWide"> <mat-card-title> diff --git a/src/app/components/generic-calculator/calculator.component.scss b/src/app/components/generic-calculator/calculator.component.scss index 4430eb11fa5570697488dc8a538adb4e06fc834e..6c19dd011dd7be1129dcac07abcfdc8bfa272821 100644 --- a/src/app/components/generic-calculator/calculator.component.scss +++ b/src/app/components/generic-calculator/calculator.component.scss @@ -26,6 +26,55 @@ display: block; } +/** copy of quicknav style */ +#pb-data-results-selector { + + @import "../../../theme.scss"; + + display: block; + margin-bottom: .5em; + width: 100%; + + .drs-item { + display: inline; + padding: 0 .5em 3px .5em; + text-transform: uppercase; + font-size: 18px; + font-weight: normal; + + &.current { + @extend .border-accent; + border-bottom-width: 2px; + border-bottom-style: solid; + font-size: 24px; + + a { + // font-weight: bold; + @extend .color-accent; + } + } + + a { + cursor: pointer; + color: #cbcbcb; + &:focus { + outline: none; + } + &:hover { + color: #707070; + } + } + } + + .drs-item:first-of-type { + padding-left: 0; + } + + .drs-item:last-of-type { + padding-right: 0; + } +} + mat-card { margin-bottom: 2em; diff --git a/src/app/components/generic-calculator/calculator.component.ts b/src/app/components/generic-calculator/calculator.component.ts index e5724beaa4802b3b1c70716785fb891ab4a7fe4a..433de67f6cf6f98c4659eb3e9b2db2e151012c6d 100644 --- a/src/app/components/generic-calculator/calculator.component.ts +++ b/src/app/components/generic-calculator/calculator.component.ts @@ -121,6 +121,9 @@ export class GenericCalculatorComponent implements OnInit, DoCheck, AfterViewChe /** Allows trigerring afterFirstViewChecked() just after calculator is loaded */ private firstViewChecked = false; + /** For PreBarrage only: if true, show input data in the right panel, else show results */ + public showPBInputData = true; + public get ID() { if (this._formulaire) { return this._formulaire.uid; @@ -254,6 +257,14 @@ export class GenericCalculatorComponent implements OnInit, DoCheck, AfterViewChe return this.intlService.localizeText("INFO_CALCULATOR_USED_BY"); } + public get uitextInputData() { + return this.intlService.localizeText("INFO_QUICKNAV_INPUT"); + } + + public get uitextResults() { + return this.intlService.localizeText("INFO_QUICKNAV_RESULTS"); + } + public get quicknavItems() { const elts = [ "input", "results" ]; if (this.isWide && this.hasResults) { @@ -580,7 +591,7 @@ export class GenericCalculatorComponent implements OnInit, DoCheck, AfterViewChe // for "one wide column" layout public get isWide() { - return (this.isPAB || this.isMRC || this.isPB); + return (this.isPAB || this.isMRC || (this.isPB && this.showPBInputData)); } // true if current Nub is Solveur diff --git a/src/app/components/pb-schema/pb-schema.component.html b/src/app/components/pb-schema/pb-schema.component.html index 42f056be83d6baf9160d4e9770ca7bfc5a60c20f..1ac51ca737cb4602b3031dbf1aa57747febfbad2 100644 --- a/src/app/components/pb-schema/pb-schema.component.html +++ b/src/app/components/pb-schema/pb-schema.component.html @@ -1,4 +1,4 @@ -<mat-card-header class="mat-card-header-text-margin-0 bg-accent-light"> +<mat-card-header class="mat-card-header-text-margin-0 bg-accent-light" [ngClass]="{'side': ! showInputData}"> <mat-card-title> {{ title }} </mat-card-title> @@ -20,11 +20,6 @@ <span class="related-entity-title"> {{ prefixedItemDescription }} </span> - <!-- <mat-select id="add-many-children" [(value)]="childrenToAdd"> - <mat-option *ngFor="let i of addManyOptionsList" [value]="i"> - {{ i }} - </mat-option> - </mat-select> --> <button type="button" mat-icon-button color="primary" [disabled]="! enableCopyButton" (click)="onCopyClick()" [title]="uitextCopy"> <mat-icon>content_copy</mat-icon> @@ -44,6 +39,6 @@ <div id="schema" #schema></div> - <pre id="debug">{{ graphDef }} </pre> + <!-- <pre id="debug">{{ graphDef }} </pre> --> </mat-card-content> diff --git a/src/app/components/pb-schema/pb-schema.component.scss b/src/app/components/pb-schema/pb-schema.component.scss index f7b1167f4ad16883e0203ecacbeb6f5820da3a46..a398740b8c1394eef1b61ff173dfa7af3eb18f2c 100644 --- a/src/app/components/pb-schema/pb-schema.component.scss +++ b/src/app/components/pb-schema/pb-schema.component.scss @@ -12,6 +12,10 @@ mat-card-header { padding-top: 8px; color: white; + &.side { + margin-right: -32px; + } + mat-card-title { font-size: 16px !important; margin-bottom: 8px; @@ -53,7 +57,3 @@ mat-card-content { margin-bottom: .5em; text-align: center; } - -#debug { - /* display: none; */ -} diff --git a/src/app/components/pb-schema/pb-schema.component.ts b/src/app/components/pb-schema/pb-schema.component.ts index d9fc50026721b5fb84b773405dfaf5b35df111fb..4e2f6952f1563685114c52fbd0b8b98cb3ef60f1 100644 --- a/src/app/components/pb-schema/pb-schema.component.ts +++ b/src/app/components/pb-schema/pb-schema.component.ts @@ -1,4 +1,4 @@ -import { Component, Input, Output, EventEmitter, OnInit, AfterViewInit, ViewChild } from "@angular/core"; +import { Component, Input, Output, EventEmitter, OnInit, AfterViewInit, ViewChild, Inject, forwardRef } from "@angular/core"; import { MatDialog } from '@angular/material/dialog'; import { @@ -12,6 +12,7 @@ import { ApplicationSetupService } from "../../services/app-setup.service"; import { NotificationsService } from "../../services/notifications.service"; import { PbSchema } from "../../formulaire/elements/pb-schema"; import { DialogNewPbCloisonComponent } from "../dialog-new-pb-cloison/dialog-new-pb-cloison.component"; +import { GenericCalculatorComponent } from '../generic-calculator/calculator.component'; /** * The interactive schema for calculator type "PreBarrage" (component) @@ -62,6 +63,7 @@ export class PbSchemaComponent implements AfterViewInit, OnInit { private wallsSuffixes: { [key: string]: number }; public constructor( + @Inject(forwardRef(() => GenericCalculatorComponent)) private calculatorComponent: GenericCalculatorComponent, private i18nService: I18nService, private newPbCloisonDialog: MatDialog, private appSetupService: ApplicationSetupService, @@ -269,6 +271,10 @@ export class PbSchemaComponent implements AfterViewInit, OnInit { return this._isValid; } + public get showInputData(): boolean { + return this.calculatorComponent.showPBInputData; + } + /** * Checks that input value is a valid number, according to input[type="number"] algorithm, * and stores it in cell.uiValidity, so that the <td> element can access it and get angry