Skip to content

Commit

Permalink
fix: add missing chips filters on widget (#341)
Browse files Browse the repository at this point in the history
* fix: add missing chips filters on widget

* fix: display full name of cnfs in chips filter

* fix: refactor display cnfs labels chips
  • Loading branch information
abelkhay committed Sep 5, 2023
1 parent a4f6a7e commit 6cc629b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,30 @@
(click)="resetForm(modaliteAccompagnement, 'modalites_accompagnement')">
× {{ getLabelFromValue(modaliteAccompagnement) }}
</button>
<button
*ngFor="let labelNational of filter.labels_nationaux"
class="btn btn-chip btn-chip-trim btn-sm btn-tertiary text-primary me-2 mb-2"
(click)="resetForm(labelNational, 'labels_nationaux')">
&times; {{ labelMap.get(labelNational) ?? labelNational }}
</button>
<button
*ngFor="let labelAutre of filter.labels_autres"
class="btn btn-chip btn-chip-trim btn-sm btn-tertiary text-primary me-2 mb-2"
(click)="resetForm(labelAutre, 'labels_autres')">
&times; {{ labelAutre }}
</button>
<button
*ngIf="filter.prise_rdv"
class="btn btn-chip btn-chip-trim btn-sm btn-tertiary text-primary me-2 mb-2"
(click)="resetForm(filter.prise_rdv, 'prise_rdv')">
&times; Prise de RDV
</button>
<button
*ngIf="filter.accessibilite"
class="btn btn-chip btn-chip-trim btn-sm btn-tertiary text-primary me-2 mb-2"
(click)="resetForm(filter.accessibilite, 'accessibilite')">
&times; Accessibilite
</button>
<button
*ngIf="filter.horaires_ouverture"
class="btn btn-chip btn-chip-trim btn-sm btn-tertiary text-primary me-2 mb-2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { FormGroup } from '@angular/forms';
import { FilterFormPresentation } from '../../../core/presenters';
import conditionAcces from '../../pages/accessibilite/condition-acces.json';
import publicSpecifiqueAcceuilli from '../../pages/accessibilite/public-specifique-accueilli.json';
import { LabelNational } from '@gouvfr-anct/lieux-de-mediation-numerique';

@Component({
changeDetection: ChangeDetectionStrategy.OnPush,
Expand All @@ -22,6 +23,10 @@ export class SelectedFiltersComponent {
this.filterForm.get('longitude')?.setValue(undefined);
} else if (key === 'horaires_ouverture') {
this.filterForm.get('horaires_ouverture')?.setValue(undefined);
} else if (key === 'prise_rdv') {
this.filterForm.get('prise_rdv')?.setValue(false);
} else if (key === 'accessibilite') {
this.filterForm.get('accessibilite')?.setValue(false);
} else {
const keyArrayCoppy = [...this.filterForm.value[key]];
const indexOfValue = keyArrayCoppy.indexOf(value);
Expand All @@ -37,4 +42,6 @@ export class SelectedFiltersComponent {
})?.label ?? ''
);
}

public labelMap: Map<string, string> = new Map<LabelNational, string>([[LabelNational.CNFS, 'Conseillers Numériques']]);
}

0 comments on commit 6cc629b

Please sign in to comment.