diff --git a/src/app/form/orientation-form/component/structure-print-header/structure-print-header.component.ts b/src/app/form/orientation-form/component/structure-print-header/structure-print-header.component.ts index 5e6ed970b3949748b02b48e2c53e859c73ea9170..20c827dec9dac2a4ce7f091ed254cea05685aac9 100644 --- a/src/app/form/orientation-form/component/structure-print-header/structure-print-header.component.ts +++ b/src/app/form/orientation-form/component/structure-print-header/structure-print-header.component.ts @@ -36,7 +36,7 @@ export class StructurePrintHeaderComponent implements OnInit { minute: 'numeric', }); - this.filters.map((elem) => { + this.filters.forEach((elem) => { switch (elem.name) { case 'proceduresAccompaniment': this.assistances.push(elem); diff --git a/src/app/form/orientation-form/orientation-form.component.html b/src/app/form/orientation-form/orientation-form.component.html index ec209f99268528638f436fdf46cff94d17a9e182..bcb1bfd7dde2a0689dfea68a9f9938665545f09f 100644 --- a/src/app/form/orientation-form/orientation-form.component.html +++ b/src/app/form/orientation-form/orientation-form.component.html @@ -229,15 +229,18 @@ (selectedAddress)="setAddressBeneficiary($event)" ></app-address-autocomplete> <app-svg-icon - *ngIf="getOrientationControl('address').valid" + *ngIf="getOrientationControl('address').valid && !isLoading" [iconClass]="'validation'" [type]="'form'" [icon]="'validate'" class="validateIcon" ></app-svg-icon> - <div *ngIf="!getOrientationControl('address').valid" (click)="getAddress()"> + <div *ngIf="!getOrientationControl('address').valid && !isLoading" (click)="getAddress()"> <app-svg-icon [type]="'ico'" [icon]="'locateMe'" class="markerIcon"></app-svg-icon> </div> + <div *ngIf="isLoading"> + <img class="loader-gif" src="/assets/gif/loader_circle.gif" alt /> + </div> </div> </div> <div class="title"> diff --git a/src/app/form/orientation-form/orientation-form.component.scss b/src/app/form/orientation-form/orientation-form.component.scss index 7fd2cb3dfca7a8e3505ad728d13369fc40b0dfce..315456fee06cf48d679ae14f2ff04936fb83b1b1 100644 --- a/src/app/form/orientation-form/orientation-form.component.scss +++ b/src/app/form/orientation-form/orientation-form.component.scss @@ -136,3 +136,7 @@ @media #{$large-phone} { } } + +.loader-gif { + width: 20%; +} diff --git a/src/app/form/orientation-form/orientation-form.component.ts b/src/app/form/orientation-form/orientation-form.component.ts index e2563d09f7f680f099c0330c79fa0e025a8da20a..c5c8c8d3562083826a72078a42c2bd9216b460a6 100644 --- a/src/app/form/orientation-form/orientation-form.component.ts +++ b/src/app/form/orientation-form/orientation-form.component.ts @@ -27,6 +27,7 @@ export class OrientationFormComponent implements OnInit { public locate = false; public noPassNumeric = false; public isMapPhone = false; + public isLoading = false; public orientationForm: FormGroup; @@ -372,7 +373,7 @@ export class OrientationFormComponent implements OnInit { } public removeDoublonFilters(): void { - this.uncheckedFilters.map((elem) => { + this.uncheckedFilters.forEach((elem) => { this.filters = this.filters.filter((filter) => filter.value != elem.value); }); this.setStructuresAndCoord(); @@ -380,7 +381,7 @@ export class OrientationFormComponent implements OnInit { public findEquipmentName(equipment): string { let name; - this.equipmentReferentiel.modules.map((elem) => { + this.equipmentReferentiel.modules.forEach((elem) => { if (elem.id === equipment) { name = elem.text; } @@ -390,7 +391,7 @@ export class OrientationFormComponent implements OnInit { public findAssistanceName(skill): string { let name; - this.assistanceReferentiel.modules.map((elem) => { + this.assistanceReferentiel.modules.forEach((elem) => { if (elem.id === skill) { name = elem.text; } @@ -401,31 +402,31 @@ export class OrientationFormComponent implements OnInit { public findTrainingCategoryForSkill(skill): any { let infos = { categ: '', name: '' }; - this.baseSkillssReferentiel.modules.map((elem) => { + this.baseSkillssReferentiel.modules.forEach((elem) => { if (elem.id === skill) { infos.categ = this.baseSkillssReferentiel.id; infos.name = elem.text; } }); - this.accessRightsReferentiel.modules.map((elem) => { + this.accessRightsReferentiel.modules.forEach((elem) => { if (elem.id === skill) { infos.categ = this.accessRightsReferentiel.id; infos.name = elem.text; } }); - this.parentingHelpsReferentiel.modules.map((elem) => { + this.parentingHelpsReferentiel.modules.forEach((elem) => { if (elem.id === skill) { infos.categ = this.parentingHelpsReferentiel.id; infos.name = elem.text; } }); - this.socialAndProfessionalsReferentiel.modules.map((elem) => { + this.socialAndProfessionalsReferentiel.modules.forEach((elem) => { if (elem.id === skill) { infos.categ = this.socialAndProfessionalsReferentiel.id; infos.name = elem.text; } }); - this.digitalCultureSecuritysReferentiel.modules.map((elem) => { + this.digitalCultureSecuritysReferentiel.modules.forEach((elem) => { if (elem.id === skill) { infos.categ = this.digitalCultureSecuritysReferentiel.id; infos.name = elem.text; @@ -510,16 +511,19 @@ export class OrientationFormComponent implements OnInit { public getAddress(): void { navigator.geolocation.getCurrentPosition((position) => { + this.isLoading = true; this.geoJsonService.getAddressByCoord(position.coords.longitude, position.coords.latitude).subscribe( (location) => { - location.properties.housenumber - ? this.getOrientationControl('address').get('numero').setValue(location.properties.housenumber) - : null; + if (location.properties.housenumber) { + this.getOrientationControl('address').get('numero').setValue(location.properties.housenumber); + } this.getOrientationControl('address').get('street').setValue(location.properties.street); this.getOrientationControl('address').get('commune').setValue(location.properties.city); this.setValidationsForm(); + this.isLoading = false; }, (err) => { + this.isLoading = false; throw new Error(err); } );