Skip to content

Commit

Permalink
Merge pull request #75 from naturalsolutions/feat/improve-zh-search-c…
Browse files Browse the repository at this point in the history
…omponent

feat: make zh-search-input multiplable + update river basin and knowledge behavior
  • Loading branch information
edelclaux authored Aug 7, 2024
2 parents d590a28 + ffd7e7b commit 815d54b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
8 changes: 4 additions & 4 deletions backend/gn_module_zh/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,16 +193,16 @@ def filter_hydro(query, json):
return query


def filter_basin(query, json):
codes = [area.get("code", None) for area in json]
def filter_basin(query, basin):
code = basin.get("code", None)

if codes is not None:
if code is not None:
subquery = (
select(
TRiverBasin.id_rb,
TRiverBasin.geom,
)
.where(TRiverBasin.id_rb.in_(codes))
.where(TRiverBasin.id_rb == code)
.subquery()
)
# SET_SRID does not return a valid geom...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<span class="mr-1">OU</span>
<mat-slide-toggle
[formControl]="form.controls.and"
matTooltip="Si OU est choisi, les zones humides recherchées respecteront au moins 1 critère listé ci-dessous.
matTooltip="Si OU est choisi, les zones humides recherchées respecteront au moins 1 critère listé ci-dessous.
Si ET est choisi: elles respecteront tous les critères"
>
</mat-slide-toggle>
Expand Down Expand Up @@ -39,7 +39,7 @@ <h5>Rubrique</h5>
</div>
<div class="pr-0 col-lg-3 col-6">
<h5>Attribut</h5>
<zh-multiselect
<zh-multiselect
[values]="attributes"
[parentFormControl]="localForm.controls.attributes"
keyLabel="attribut"
Expand All @@ -49,11 +49,12 @@ <h5>Attribut</h5>
</div>
<div class="pr-0 col-lg-3 col-6">
<h5>Connaissance</h5>
<zh-multiselect
<zh-multiselect
[values]="knowledges"
[parentFormControl]="localForm.controls.knowledges"
keyLabel="note_type"
(onChange)="attributesChanged($event)"
[multiple]="false"
/>
</div>
<div class="pr-0 col-lg-2 col-6">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<zh-label [label]="label"> </zh-label>
</div>
<div class="form-group col-md-7 customselect">
<zh-multiselect
<zh-multiselect
[values]="data"
[parentFormControl]="form"
[multiple]="false"
[multiple]="multiple"
keyLabel="name"
(change)="onSelected.emit($event)"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export class ZhSearchInputComponent implements OnInit {
@Input() label: string = '';
@Input() displayCode: boolean = false;
@Input() form: FormGroup;
@Input() multiple: boolean = false;
@Output() onSelected = new EventEmitter<object>();

public dropdownSettings = {
Expand Down
1 change: 1 addition & 0 deletions frontend/app/zh-search/zh-search.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ <h4>Recherche multi-critères</h4>
[form]="_searchService.searchForm.get('basin')"
[data]="basins"
(onSelected)="onBasinSelected($event)"
[multiple]="false"
>
</zh-search-input>
<zh-search-dependant
Expand Down

0 comments on commit 815d54b

Please sign in to comment.