From 7cf77c3272902d895e8db5a65401447d2bcfaf9f Mon Sep 17 00:00:00 2001 From: Jeremie BRISON <ext.sopra.jbrison@grandlyon.com> Date: Thu, 11 Feb 2021 10:47:12 +0100 Subject: [PATCH] fix(form) : fix wifi equipments --- src/app/form/form.component.html | 4 ++-- src/app/form/form.component.ts | 6 ++++-- src/app/models/structure.model.ts | 1 - src/app/structure-list/components/card/card.component.ts | 2 +- .../structure-details/structure-details.component.ts | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/app/form/form.component.html b/src/app/form/form.component.html index 58d7bafd0..22cf64f49 100644 --- a/src/app/form/form.component.html +++ b/src/app/form/form.component.html @@ -706,8 +706,8 @@ <h3>Proposez-vous le wifi en accès libre ?</h3> </div> <app-radio-form - [selectedOption]="getStructureControl('freeWifi').value" - (selectedEvent)="onRadioBtnChange('freeWifi', $event)" + [selectedOption]="isInArray('wifiEnAccesLibre', 'equipmentsAndServices')" + (selectedEvent)="onCheckChange($event, 'equipmentsAndServices', 'wifiEnAccesLibre')" > </app-radio-form> </div> diff --git a/src/app/form/form.component.ts b/src/app/form/form.component.ts index 29618ad4b..58d8f0d11 100644 --- a/src/app/form/form.component.ts +++ b/src/app/form/form.component.ts @@ -225,7 +225,6 @@ export class FormComponent implements OnInit { [Validators.required, Validators.pattern(Regex.noNullNumber)] //NOSONAR ), freeWorkShop: new FormControl(structure.freeWorkShop, Validators.required), - freeWifi: new FormControl(structure.freeWifi, Validators.required), }); return form; } @@ -425,7 +424,10 @@ export class FormComponent implements OnInit { name: 'Ateliers au numérique proposés', }; this.pagesValidation[16] = { valid: this.getStructureControl('freeWorkShop').valid, name: 'Gratuité des ateliers' }; - this.pagesValidation[17] = { valid: this.getStructureControl('freeWifi').valid, name: 'Gratuité du wifi' }; + this.pagesValidation[17] = { + valid: this.getStructureControl('equipmentsAndServices').valid, + name: 'Gratuité du wifi', + }; this.pagesValidation[18] = { valid: this.getStructureControl('equipmentsAndServices').valid && diff --git a/src/app/models/structure.model.ts b/src/app/models/structure.model.ts index 3c4569dc4..8ff53a5ee 100644 --- a/src/app/models/structure.model.ts +++ b/src/app/models/structure.model.ts @@ -37,7 +37,6 @@ export class Structure { public equipmentsAndServices: string[] = []; public hours: Week; public freeWorkShop: boolean = null; - public freeWifi: boolean = null; public otherDescription: string = null; public isOpen: boolean = false; diff --git a/src/app/structure-list/components/card/card.component.ts b/src/app/structure-list/components/card/card.component.ts index 3f3b6d5af..8a64274b6 100644 --- a/src/app/structure-list/components/card/card.component.ts +++ b/src/app/structure-list/components/card/card.component.ts @@ -37,7 +37,7 @@ export class CardComponent implements OnInit { } public filterOnlyEquipments(equipmentsAndServices: string[]): string[] { return equipmentsAndServices.filter((eqpt) => - ['ordinateurs', 'tablettes', 'bornesNumeriques', 'imprimantes', 'scanners'].includes(eqpt) + ['ordinateurs', 'tablettes', 'bornesNumeriques', 'imprimantes', 'scanners', 'wifiEnAccesLibre'].includes(eqpt) ); } } diff --git a/src/app/structure-list/components/structure-details/structure-details.component.ts b/src/app/structure-list/components/structure-details/structure-details.component.ts index 49633ddf7..2b4bb09e5 100644 --- a/src/app/structure-list/components/structure-details/structure-details.component.ts +++ b/src/app/structure-list/components/structure-details/structure-details.component.ts @@ -207,7 +207,7 @@ export class StructureDetailsComponent implements OnInit { } public filterOnlyEquipments(equipmentsAndServices: string[]): string[] { return equipmentsAndServices.filter((eqpt) => - ['ordinateurs', 'tablettes', 'bornesNumeriques', 'imprimantes', 'scanners'].includes(eqpt) + ['ordinateurs', 'tablettes', 'bornesNumeriques', 'imprimantes', 'scanners', 'wifiEnAccesLibre'].includes(eqpt) ); } } -- GitLab