Skip to content
Snippets Groups Projects
Commit 90a0656d authored by Tifenn Guillas's avatar Tifenn Guillas
Browse files

gestion des types d'attribute dans la creation des criterions => DONE

parent b8b7078c
No related branches found
No related tags found
2 merge requests!68Develop,!19gestion des types d'attribute dans la creation des criterions => DONE
......@@ -2,7 +2,7 @@
<div [ngSwitch]="attribute.search_type">
<div *ngSwitchCase="'fd'">
<app-field class="criteria" [id]="attribute.id" [label]="attribute.form_label"
[placeholder]="attribute.placeholder_min" [criterion]="getCriterion(attribute.id)" (add)="add($event)">
[placeholder]="attribute.placeholder_min" [attributeType]="attribute.type" [criterion]="getCriterion(attribute.id)" (add)="add($event)">
</app-field>
</div>
<div *ngSwitchCase="'bw'">
......
<div class="form-group row">
<label class="col-3 col-form-label">{{label}}</label>
<div class="col">
<input type="text" class="form-control" [placeholder]="getPlaceholder()" [formControl]="field" autocomplete="off">
<input [type]="getType()" class="form-control" [placeholder]="getPlaceholder()" [formControl]="field"
autocomplete="off">
</div>
<div class="col-2 align-self-center text-center">
<button class="btn btn-outline-success" *ngIf="!field.disabled" [hidden]="!field.value" (click)="addCriterion()"><i class="fas fa-plus-circle"></i></button>
<button class="btn btn-outline-success" *ngIf="!field.disabled" [hidden]="!field.value"
(click)="addCriterion()"><i class="fas fa-plus-circle"></i></button>
</div>
</div>
\ No newline at end of file
......@@ -12,6 +12,7 @@ export class FieldComponent {
@Input() id: number;
@Input() label: string;
@Input() placeholder: string;
@Input() attributeType: string;
@Input()
set criterion(criterion: Criterion) {
this.getDefault(criterion);
......@@ -36,6 +37,14 @@ export class FieldComponent {
}
}
getType(): string {
const numberTypeList = ['smallint', 'integer', 'decimal', 'float'];
if (numberTypeList.includes(this.attributeType)) {
return 'number';
}
return 'text';
}
getPlaceholder(): string {
if (!this.placeholder) {
return '';
......
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