Skip to content
Snippets Groups Projects
Commit 7c9a65a7 authored by Angapay Divin's avatar Angapay Divin
Browse files

display familly output category label on the dataset configuration

parent 0503acd8
No related branches found
No related tags found
2 merge requests!72Develop,!61Resolve "Affichage famille + output category dans la configuration d'un dataset (output)"
This commit is part of merge request !61. Comments created here will be created in the context of that merge request.
...@@ -3,20 +3,25 @@ ...@@ -3,20 +3,25 @@
<input type="text" class="form-control" name="name" formControlName="name"> <input type="text" class="form-control" name="name" formControlName="name">
</td> </td>
<td> <td>
<select class="form-control" name="id_output_category" (change)="outputCategoryOnChange()" formControlName="id_output_category"> <select class="form-control" name="id_output_category" (change)="outputCategoryOnChange()"
formControlName="id_output_category">
<option value=""></option> <option value=""></option>
<option *ngFor="let category of outputCategoryList" [ngValue]="category.id">{{category.label}}</option> <option *ngFor="let category of outputCategoryList" [ngValue]="category.id">
{{getOutputFamilyLabel(category.id_output_family)}}/{{category.label}}
</option>
</select> </select>
</td> </td>
<td> <td>
<input *ngIf="form.controls.id_output_category.value" type="number" class="form-control" name="output_display" formControlName="output_display"> <input *ngIf="form.controls.id_output_category.value" type="number" class="form-control" name="output_display"
formControlName="output_display">
</td> </td>
<td> <td>
<input *ngIf="form.controls.id_output_category.value" type="checkbox" class="form-control" name="selected" formControlName="selected"> <input *ngIf="form.controls.id_output_category.value" type="checkbox" class="form-control" name="selected"
formControlName="selected">
</td> </td>
<td class="text-center align-middle"> <td class="text-center align-middle">
<button (click)="submit()" [disabled]="form.invalid || form.pristine" class="btn btn-outline-primary"> <button (click)="submit()" [disabled]="form.invalid || form.pristine" class="btn btn-outline-primary">
<span class="fas fa-save"></span> <span class="fas fa-save"></span>
</button> </button>
</td> </td>
</ng-container> </ng-container>
\ No newline at end of file
...@@ -10,17 +10,18 @@ ...@@ -10,17 +10,18 @@
import { Component, Input, Output, EventEmitter, ChangeDetectionStrategy, OnInit } from '@angular/core'; import { Component, Input, Output, EventEmitter, ChangeDetectionStrategy, OnInit } from '@angular/core';
import { UntypedFormControl, UntypedFormGroup } from '@angular/forms'; import { UntypedFormControl, UntypedFormGroup } from '@angular/forms';
import { Attribute, OutputCategory } from 'src/app/metamodel/models'; import { Attribute, OutputCategory, OutputFamily } from 'src/app/metamodel/models';
@Component({ @Component({
selector: '[output]', selector: '[output]',
templateUrl: 'tr-output.component.html', templateUrl: 'tr-output.component.html',
styleUrls: [ '../tr.component.scss' ], styleUrls: ['../tr.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush changeDetection: ChangeDetectionStrategy.OnPush
}) })
export class TrOutputComponent implements OnInit { export class TrOutputComponent implements OnInit {
@Input() attribute: Attribute; @Input() attribute: Attribute;
@Input() outputCategoryList: OutputCategory[]; @Input() outputCategoryList: OutputCategory[];
@Input() outputFamilyList: OutputFamily[];
@Output() save: EventEmitter<Attribute> = new EventEmitter(); @Output() save: EventEmitter<Attribute> = new EventEmitter();
public form = new UntypedFormGroup({ public form = new UntypedFormGroup({
...@@ -48,4 +49,8 @@ export class TrOutputComponent implements OnInit { ...@@ -48,4 +49,8 @@ export class TrOutputComponent implements OnInit {
...this.form.value ...this.form.value
}); });
} }
getOutputFamilyLabel(idOutputFamilly: number): string {
return this.outputFamilyList.find(outputFamilly => outputFamilly.id === idOutputFamilly).label;
}
} }
...@@ -120,6 +120,7 @@ ...@@ -120,6 +120,7 @@
<tr *ngFor="let attribute of (attributeList | async)" <tr *ngFor="let attribute of (attributeList | async)"
output output
[attribute]="attribute" [attribute]="attribute"
[outputFamilyList]="outputFamilyList | async"
[outputCategoryList]="outputCategoryList | async" [outputCategoryList]="outputCategoryList | async"
(save)="editAttribute($event)"> (save)="editAttribute($event)">
</tr> </tr>
......
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