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

Work on #431 - make QA variable in PAB

parent eab3c3af
No related branches found
No related tags found
No related merge requests found
Pipeline #138290 passed
204-ajout-de-la-fonctionnalite-respect-des-criteres-2
261-pab-pouvoir-lier-et-varier-le-debit-d-attrait
......@@ -96,6 +96,15 @@
</mat-option>
</mat-select>
<div *ngIf="isQA(cell)" class="qaFieldLineContainer">
<div class="qaLabel">
{{ cell.title }}
</div>
<param-field-line class="qaFieldLine" [param]="cell.model" (radio)="inputValueChanged($event, cell)"
(input)="inputValueChanged($event, cell)">
</param-field-line>
</div>
<span *ngIf="! hasModel(cell)">{{ cellValue(cell) }}</span>
</td>
</tr>
......
......@@ -47,3 +47,13 @@ mat-card-content {
}
}
}
.qaFieldLineContainer {
padding: 0 10px;
}
.qaLabel {
margin-top: 13px;
margin-right: 10px;
font-weight: bold;
}
import { Component, Input, Output, EventEmitter, OnInit, AfterViewInit } from "@angular/core";
import { LoiDebit } from "jalhyd";
import { LoiDebit, ParamCalculability } from "jalhyd";
import { MatDialog } from "@angular/material/dialog";
......@@ -27,6 +27,7 @@ import { NotificationsService } from "../../services/notifications.service";
import { PabTable } from "../../formulaire/elements/pab-table";
import { DialogEditPabComponent } from "../dialog-edit-pab/dialog-edit-pab.component";
import { AppComponent } from "../../app.component";
import { NgParameter, ParamRadioConfig } from "../../formulaire/elements/ngparam";
/**
* The big editable data grid for calculator type "Pab" (component)
......@@ -101,7 +102,7 @@ export class PabTableComponent implements AfterViewInit, OnInit {
/** returns true if the cell is an editable number */
public isNumberInput(cell: any): boolean {
return this.hasModel(cell) && ! this.isSelect(cell);
return this.hasModel(cell) && ! this.isSelect(cell) && ! this.isQA(cell);
}
/** returns true if the cell is a select box */
......@@ -109,6 +110,11 @@ export class PabTableComponent implements AfterViewInit, OnInit {
return this.hasModel(cell) && (cell.options !== undefined);
}
/** returns true if the cell is a QA (Attraction flow) editor */
public isQA(cell: any): boolean {
return this.hasModel(cell) && cell.qa;
}
/** value to display in a cell, if it is not editable */
public cellValue(cell: any) {
if (cell === undefined) {
......@@ -166,8 +172,12 @@ export class PabTableComponent implements AfterViewInit, OnInit {
*/
public isInvalid(cell: any): boolean {
let valid = true;
if (this.hasModel(cell) && cell.model instanceof ParamDefinition) {
valid = valid && cell.model.isValid;
if (this.hasModel(cell)) {
if (cell.model instanceof ParamDefinition) {
valid = valid && cell.model.isValid;
} else if (cell.model instanceof NgParameter) { // for QA (currently has domain ANY but that might change)
valid = valid && cell.model.paramDefinition.isValid;
}
}
if (cell.uiValidity !== undefined) {
valid = valid && cell.uiValidity;
......@@ -443,7 +453,7 @@ export class PabTableComponent implements AfterViewInit, OnInit {
const nDigits = this.appSetupService.displayPrecision;
for (const c of this.model.children) {
for (const p of c.parameterIterator) {
if (p.visible) {
if (p.visible && p.symbol !== "QA") { // QA might vary !
p.singleValue = round(p.singleValue, nDigits);
}
}
......@@ -461,7 +471,7 @@ export class PabTableComponent implements AfterViewInit, OnInit {
bs = bs.concat(this.model.downWall);
this.headers.push({
title: this.i18nService.localizeText("INFO_PAB_BASSIN"),
colspan: 6,
colspan: 5,
selectable: bs
});
// 1 header for each device of the wall having the most devices (including downwall)
......@@ -476,7 +486,7 @@ export class PabTableComponent implements AfterViewInit, OnInit {
// A. build columns set
this.cols = [];
// 6 cols for basin
// 5 cols for basin
this.cols.push({
title: this.i18nService.localizeText("INFO_PAB_NUM_BASSIN"),
selectable: bs
......@@ -489,10 +499,10 @@ export class PabTableComponent implements AfterViewInit, OnInit {
title: this.formService.expandVariableNameAndUnit(CalculatorType.Pab, "BB"),
selectable: bs
});
this.cols.push({
/* this.cols.push({
title: this.formService.expandVariableNameAndUnit(CalculatorType.Pab, "QA"),
selectable: bs
});
}); */
this.cols.push({
title: this.formService.expandVariableNameAndUnit(CalculatorType.Pab, "ZRMB"),
selectable: bs
......@@ -543,14 +553,14 @@ export class PabTableComponent implements AfterViewInit, OnInit {
// basin number
deviceParamRow.cells.push({
value: childIndex + 1,
rowspan: maxNbParams + 1,
rowspan: maxNbParams + 2,
class: "basin_number",
selectable: cloison
});
// 4 empty cells
// 3 empty cells
deviceParamRow.cells.push({
colspan: 4,
rowspan: maxNbParams ,
colspan: 3,
rowspan: maxNbParams,
selectable: cloison
});
// ZRAM
......@@ -562,7 +572,7 @@ export class PabTableComponent implements AfterViewInit, OnInit {
// 1 empty cell
if (i === 1) {
deviceParamRow.cells.push({
rowspan: maxNbParams,
rowspan: maxNbParams + 1,
selectable: cloison
});
}
......@@ -639,10 +649,6 @@ export class PabTableComponent implements AfterViewInit, OnInit {
model: cloison.prms.BB,
title: this.formService.expandVariableNameAndUnit(CalculatorType.Pab, "BB")
},
{
model: cloison.prms.QA,
title: this.formService.expandVariableNameAndUnit(CalculatorType.Pab, "QA")
},
{
model: cloison.prms.ZRMB,
title: this.formService.expandVariableNameAndUnit(CalculatorType.Pab, "ZRMB")
......@@ -652,11 +658,29 @@ export class PabTableComponent implements AfterViewInit, OnInit {
// fill horizontal space
for (let i = 0; i < maxNbDevices; i++) {
basinRow.cells.push({
colspan: 3
colspan: 3,
rowspan: 2
});
}
// done !
this.rows.push(basinRow);
// 1 row for QA editor
const qaParam = new NgParameter(cloison.prms.QA, this.pabTable.form);
qaParam.radioConfig = ParamRadioConfig.VAR;
const qaRow: { selectable: any, cells: any[] } = {
selectable: undefined,
cells: [
{
model: qaParam,
colspan: 3,
qa: true,
title: this.formService.expandVariableNameAndUnit(CalculatorType.Pab, "QA")
}
]
};
this.rows.push(qaRow);
// done !
childIndex ++;
}
......@@ -681,9 +705,9 @@ export class PabTableComponent implements AfterViewInit, OnInit {
class: "basin_number",
selectable: this.model.downWall
});
// 4 empty cells
// 3 empty cells
deviceParamRowDW.cells.push({
colspan: 4,
colspan: 3,
rowspan: maxNbParamsDW ,
selectable: this.model.downWall
});
......
......@@ -4,7 +4,7 @@ import { I18nService } from "../../services/internationalisation.service";
import { NgParameter, ParamRadioConfig } from "../../formulaire/elements/ngparam";
import { NgParamInputComponent } from "../ngparam-input/ngparam-input.component";
import { ServiceFactory } from "../../services/service-factory";
import { ParamValueMode, ParallelStructure, ParamCalculability } from "jalhyd";
import { ParamValueMode, ParallelStructure, ParamCalculability, Pab } from "jalhyd";
import { FormulaireService } from "../../services/formulaire.service";
import { ParamLinkComponent } from "../param-link/param-link.component";
import { ParamValuesComponent } from "../param-values/param-values.component";
......@@ -173,7 +173,7 @@ export class ParamFieldLineComponent implements OnChanges {
return this._formService.getLinkableValues(this.param).length > 0;
}
// ou un seul module de calcul "ouvrages parallèles"
// ou un seul module de calcul "ouvrages parallèles" avec au moins 2 ouvrages
if (this._formService.formulaires[0].currentNub instanceof ParallelStructure) {
const ps: ParallelStructure = this._formService.formulaires[0].currentNub;
if (ps.structures.length > 1) {
......@@ -181,6 +181,14 @@ export class ParamFieldLineComponent implements OnChanges {
}
}
// ou un seul module de calcul "PAB" avec au mois 2 ouvrages
if (this._formService.formulaires[0].currentNub instanceof Pab) {
const pab: Pab = this._formService.formulaires[0].currentNub;
if (pab.children.length > 1) {
return this._formService.getLinkableValues(this.param).length > 0;
}
}
}
return false;
}
......
......@@ -136,6 +136,55 @@ field-set {
}
}
.qaFieldLineContainer {
.qaFieldLine {
.mat-button-toggle-label-content {
line-height: 24px !important;
}
}
ngparam-input {
height: 38px;
margin-top: 0;
}
param-values {
margin-top: 0;
}
param-link {
margin-top: 0;
.status-icons-container {
display: none;
}
}
mat-form-field {
.mat-form-field-wrapper {
padding-bottom: 5px;
}
input.form-control.mat-input-element {
width: 100%;
}
button.param-values-more {
display: none;
}
.mat-form-field-underline {
display: none;
}
mat-error.mat-error {
display: none;
}
}
}
.pab-data-table {
.editable-cell-bg {
......
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