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

Pab: changement de type d'ouvrages

parent 35dd5460
No related branches found
No related tags found
1 merge request!49Resolve "Ajout du module de calcul d'une passe à bassins"
...@@ -80,12 +80,11 @@ ...@@ -80,12 +80,11 @@
<input matInput *ngIf="isNumberInput(cell)" type="number" [(ngModel)]="cell.model.singleValue"> <input matInput *ngIf="isNumberInput(cell)" type="number" [(ngModel)]="cell.model.singleValue">
<mat-select *ngIf="isSelect(cell)" [(value)]="cell.model"> <mat-select *ngIf="isSelect(cell)" [value]="cell.modelValue"
<!-- <mat-option *ngFor="let opt of cell.options | keyvalue" [value]="l.key"> (selectionChange)="loiDebitSelected($event, cell)">
{{ l.value }}
</mat-option> --> <mat-option *ngFor="let opt of cell.options" [value]="opt.value">
<mat-option *ngFor="let opt of cell.options" [value]="opt"> {{ opt.label }}
{{ opt }}
</mat-option> </mat-option>
</mat-select> </mat-select>
......
...@@ -10,7 +10,8 @@ import { ...@@ -10,7 +10,8 @@ import {
Cloisons, Cloisons,
Nub, Nub,
Structure, Structure,
ParallelStructure ParallelStructure,
LoiDebit
} from "jalhyd"; } from "jalhyd";
import { sprintf } from "sprintf-js"; import { sprintf } from "sprintf-js";
...@@ -377,6 +378,13 @@ export class PabTableComponent implements /* DoCheck, AfterViewInit, */ OnInit { ...@@ -377,6 +378,13 @@ export class PabTableComponent implements /* DoCheck, AfterViewInit, */ OnInit {
// B.1 many rows for each wall // B.1 many rows for each wall
let childIndex = 0; let childIndex = 0;
for (const cloison of this.model.children) { for (const cloison of this.model.children) {
// admissible LoiDebit
const loisCloisons = cloison.getLoisAdmissiblesArray().map(l => { // @TODO move up ? (same for all cloisons)
return {
label: LoiDebit[l],
value: l
};
});
// as much rows as the greatest number of parameters among its devices // as much rows as the greatest number of parameters among its devices
const maxNbParams = this.findMaxNumberOfDeviceParameters(cloison); const maxNbParams = this.findMaxNumberOfDeviceParameters(cloison);
// console.log(">>> max nb params: ", maxNbParams); // console.log(">>> max nb params: ", maxNbParams);
...@@ -406,9 +414,9 @@ export class PabTableComponent implements /* DoCheck, AfterViewInit, */ OnInit { ...@@ -406,9 +414,9 @@ export class PabTableComponent implements /* DoCheck, AfterViewInit, */ OnInit {
// cell 1 : device type // cell 1 : device type
if (i === 0) { // 1st row if (i === 0) { // 1st row
deviceParamRow.cells.push({ deviceParamRow.cells.push({
model: ouvrage.properties.getPropValue("loiDebit"), model: ouvrage,
// options: StructureProperties.findCompatibleLoiDebit(ouvrage) modelValue: ouvrage.properties.getPropValue("loiDebit"),
options: [ "salut", "coucou", "pouet" ], options: loisCloisons,
selectable: ouvrage selectable: ouvrage
}); });
} }
...@@ -491,6 +499,13 @@ export class PabTableComponent implements /* DoCheck, AfterViewInit, */ OnInit { ...@@ -491,6 +499,13 @@ export class PabTableComponent implements /* DoCheck, AfterViewInit, */ OnInit {
} }
// B.2 many rows for downwall // B.2 many rows for downwall
// admissible LoiDebit
const loisAval = this.model.downWall.getLoisAdmissiblesArray().map(l => {
return {
label: LoiDebit[l],
value: l
};
});
// as much rows as the greatest number of parameters among its devices // as much rows as the greatest number of parameters among its devices
const maxNbParamsDW = this.findMaxNumberOfDeviceParameters(this.model.downWall); const maxNbParamsDW = this.findMaxNumberOfDeviceParameters(this.model.downWall);
for (let i = 0; i < maxNbParamsDW; i++) { for (let i = 0; i < maxNbParamsDW; i++) {
...@@ -519,9 +534,9 @@ export class PabTableComponent implements /* DoCheck, AfterViewInit, */ OnInit { ...@@ -519,9 +534,9 @@ export class PabTableComponent implements /* DoCheck, AfterViewInit, */ OnInit {
// cell 1 : device type // cell 1 : device type
if (i === 0) { // 1st row if (i === 0) { // 1st row
deviceParamRowDW.cells.push({ deviceParamRowDW.cells.push({
model: ouvrage.properties.getPropValue("loiDebit"), model: ouvrage,
// options: StructureProperties.findCompatibleLoiDebit(ouvrage) modelValue: ouvrage.properties.getPropValue("loiDebit"),
options: [ "salut", "coucou", "pouet" ] options: loisAval
}); });
} }
// fill space // fill space
...@@ -841,6 +856,22 @@ export class PabTableComponent implements /* DoCheck, AfterViewInit, */ OnInit { ...@@ -841,6 +856,22 @@ export class PabTableComponent implements /* DoCheck, AfterViewInit, */ OnInit {
this.refresh(); this.refresh();
} }
/** Replace device Nub when LoiDebit is changed */
public loiDebitSelected($event: any, cell: any) {
const device = cell.model as Nub;
const pos = device.findPositionInParent();
// create new child device
const newDevice = Session.getInstance().createNub(
new Props({
calcType: CalculatorType.Structure,
loiDebit: $event.value
})
);
// replace the current one
device.parent.replaceChildInplace(device, newDevice);
this.refresh();
}
// show modal dialog for values edition // show modal dialog for values edition
public showEditPab() { public showEditPab() {
if (this.selectedItems.length > 0) { if (this.selectedItems.length > 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