From 02266d59b246474f7929cab7685de87118b28f25 Mon Sep 17 00:00:00 2001 From: Jean-Pascal MILCENT Date: Sat, 9 Oct 2021 00:55:23 +0200 Subject: [PATCH] Feat frontend/synthese: improve display of form fields used Resolve #1492. --- .../synthese-advanced-form-component.ts | 44 +++++++++ .../synthese-advanced-form.component.html | 11 +++ .../synthese-form.component.html | 97 ++++++++++++++----- .../synthese-form.component.scss | 7 +- .../synthese-form/synthese-form.component.ts | 3 + .../synthese-form/synthese-form.service.ts | 33 ++++++- .../app/syntheseModule/synthese.component.ts | 3 + 7 files changed, 171 insertions(+), 27 deletions(-) diff --git a/frontend/src/app/GN2CommonModule/form/synthese-form/advanced-form/synthese-advanced-form-component.ts b/frontend/src/app/GN2CommonModule/form/synthese-form/advanced-form/synthese-advanced-form-component.ts index 3aab6eda6c..c17f9588a0 100644 --- a/frontend/src/app/GN2CommonModule/form/synthese-form/advanced-form/synthese-advanced-form-component.ts +++ b/frontend/src/app/GN2CommonModule/form/synthese-form/advanced-form/synthese-advanced-form-component.ts @@ -95,6 +95,50 @@ export class TaxonAdvancedModalComponent implements OnInit, AfterContentInit { this.formService.searchForm.controls.taxon_rank.reset(); } + onStatusCheckboxChanged(event) { + if (event.target.checked == true) { + this.formService.selectedStatus.push(event.target.value); + } else if (event.target.checked == false) { + this.formService.selectedStatus.splice( + this.formService.selectedStatus.indexOf(event.target.value), + 1 + ); + } + } + + onStatusSelected(event) { + this.formService.selectedStatus.push(event); + } + + onStatusDeleted(event) { + this.formService.selectedStatus.splice( + this.formService.selectedStatus.indexOf(event), + 1 + ); + } + + onRedListsSelected(event) { + this.formService.selectedRedLists.push(event); + } + + onRedListsDeleted(event) { + this.formService.selectedRedLists.splice( + this.formService.selectedRedLists.indexOf(event), + 1 + ); + } + + onTaxRefAttributsSelected(event) { + this.formService.selectedTaxRefAttributs.push(event); + } + + onTaxRefAttributsDeleted(event) { + this.formService.selectedTaxRefAttributs.splice( + this.formService.selectedTaxRefAttributs.indexOf(event), + 1 + ); + } + // algo recursif pour retrouver tout les cd_ref sélectionné à partir de l'arbre searchSelectedId(node, depth): Array { if (node.children) { diff --git a/frontend/src/app/GN2CommonModule/form/synthese-form/advanced-form/synthese-advanced-form.component.html b/frontend/src/app/GN2CommonModule/form/synthese-form/advanced-form/synthese-advanced-form.component.html index 2a4298286e..735402b22e 100644 --- a/frontend/src/app/GN2CommonModule/form/synthese-form/advanced-form/synthese-advanced-form.component.html +++ b/frontend/src/app/GN2CommonModule/form/synthese-form/advanced-form/synthese-advanced-form.component.html @@ -140,6 +140,8 @@
Statuts
keyLabel="display" keyValue="code" [label]="status.display_name" + (onChange)="onStatusSelected($event)" + (onDelete)="onStatusDeleted($event.code)" > @@ -154,6 +156,7 @@
Statuts
class="custom-control-input" [formControl]="status.control" [value]="status.status_types[0]" + (change)="onStatusCheckboxChanged($event)" />