diff --git a/src/app/form/form-view/form-view.component.ts b/src/app/form/form-view/form-view.component.ts index e7e262de277710613085d97a3cd2daac2e95cdc1..194e4a2b9c2c895805a7ad7386b53e71eae51183 100644 --- a/src/app/form/form-view/form-view.component.ts +++ b/src/app/form/form-view/form-view.component.ts @@ -97,9 +97,6 @@ export class FormViewComponent implements OnInit { if (this.profile.structuresLink.length) { // if register a new user as a new member structure, no structure to choose this.isRegisterNewMember = true; - this.structureService.getStructure(this.profile.structuresLink[0]).subscribe((structure) => { - this.structure = new Structure(structure); - }); } } }); @@ -340,7 +337,10 @@ export class FormViewComponent implements OnInit { // if register a new user as a new member structure, no structure to choose if (this.isRegisterNewMember) { if (this.profile.job && this.profile.job.hasPersonalOffer) { - this.router.navigateByUrl('form/personaloffer'); + this.structureService.getStructure(this.profile.structuresLink[0]).subscribe((structure) => { + this.structure = new Structure(structure); + this.router.navigateByUrl('form/personaloffer'); + }); } else { this.router.navigateByUrl('/profile'); } @@ -486,6 +486,7 @@ export class FormViewComponent implements OnInit { const exitPages: stepType[] = [ structureFormStep.noStructure, structureFormStep.structureCreationFinishedInfo, + structureFormStep.mailSentInfo, profileFormStep.profileJobSelection, personalOfferFormStep.personalOfferFinishedInfo, ]; @@ -496,7 +497,7 @@ export class FormViewComponent implements OnInit { this.isEditMode || exitPages.includes(this.currentPage) ) { - return new Promise((resolve) => resolve(true)); + return Promise.resolve(true); } else { return new Promise((resolve) => this.showModal(resolve)); } 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 f2670e67180eb49e85a80c5fa459e90078608048..099411e4bb3054199739b73e82a1039b82415687 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 @@ -404,13 +404,13 @@ export class StructureDetailsComponent implements OnInit { } public goToWebsite(): void { - if (!this.structure.website.includes('http')) { - const url = 'https://'.concat(this.structure.website); - window.open(url, '_blank'); - } else { - window.open(this.structure.website, '_blank'); + let url = this.structure.website; + if (!url.startsWith('http')) { + url = 'https://' + url; } + window.open(url, '_blank'); } + public displayJobEmployer(profile: User): string { return new Utils().getJobEmployer(profile); } diff --git a/src/app/utils/formUtils.ts b/src/app/utils/formUtils.ts index fe7956267cb3bc6430ef13efe5dae04b2315edf0..b153d835e1e96b4a1708749a2ae4bb7624b6d3df 100644 --- a/src/app/utils/formUtils.ts +++ b/src/app/utils/formUtils.ts @@ -79,7 +79,7 @@ export class formUtils { */ public createStructureForm(structure: Structure, isEditMode?: boolean): UntypedFormGroup { return new UntypedFormGroup({ - _id: new UntypedFormControl(structure._id), + _id: new UntypedFormControl(structure._id, Validators.required), coord: new UntypedFormControl(structure.coord), structureType: new UntypedFormControl(structure.structureType, Validators.required), structureName: new UntypedFormControl(structure.structureName, Validators.required),