diff --git a/src/app/form/footer-form/footer-form.component.ts b/src/app/form/footer-form/footer-form.component.ts
index 38c50043420baa856360de5f8257cc08ceda8bd3..9d2d104a17a18195a073984478d15b7fbcc42940 100644
--- a/src/app/form/footer-form/footer-form.component.ts
+++ b/src/app/form/footer-form/footer-form.component.ts
@@ -30,6 +30,7 @@ export class FooterFormComponent implements OnChanges {
@Input() acceptNewsletter: boolean;
@Input() currentStep: stepType;
@Input() hasOtherPersonalOffer: boolean;
+ @Input() isPersonalOfferProfile: boolean;
@Input() isEditMode: boolean;
@Output() goNext = new EventEmitter<any>();
@Output() goPrev = new EventEmitter<any>();
@@ -223,10 +224,11 @@ export class FooterFormComponent implements OnChanges {
}
private isPersonalOfferPage(): boolean {
- return (
- this.currentForm === formType.personaloffer &&
- this.currentStep === personalOfferFormStep.personalOfferStructureChoice
- );
+ // If the user is creating structure personalOffer from his profile, we don't ask if he has another structure and the last step is before the structure choice step
+ const lastStep = this.isPersonalOfferProfile
+ ? personalOfferFormStep.personalOfferStructureChoice - 1
+ : personalOfferFormStep.personalOfferStructureChoice;
+ return this.currentForm === formType.personaloffer && this.currentStep === lastStep;
}
public isPersonalOfferFirstPage(): boolean {
return this.currentStep === personalOfferFormStep.personalOfferAccompaniment;
diff --git a/src/app/form/form-view/form-view.component.html b/src/app/form/form-view/form-view.component.html
index 0c0bf2c9a2089d5987af9e09e3609f290ee171f3..881f9c02a2fd955518b167de089fa53146839ad6 100644
--- a/src/app/form/form-view/form-view.component.html
+++ b/src/app/form/form-view/form-view.component.html
@@ -64,6 +64,7 @@
[isValid]="isPageValid"
[acceptNewsletter]="userAcceptNewsletter"
[hasOtherPersonalOffer]="hasOtherPersonalOffer"
+ [isPersonalOfferProfile]="isPersonalOfferProfile"
[isEditMode]="isEditMode"
(goNext)="nextPage()"
(goPrev)="prevPage()"
diff --git a/src/app/form/form-view/form-view.component.ts b/src/app/form/form-view/form-view.component.ts
index 4f16a52de1952f0001c1ee90a2001bc701602b4e..5a1b64fdaea07428ceaed13e5fcf77438deb75a6 100644
--- a/src/app/form/form-view/form-view.component.ts
+++ b/src/app/form/form-view/form-view.component.ts
@@ -40,7 +40,7 @@ export class FormViewComponent implements OnInit, AfterViewInit {
public userAcceptNewsletter: boolean;
// Profile Form
public profileForm: UntypedFormGroup;
- public isPersonalOfferProfile: boolean;
+ public isPersonalOfferProfile: boolean = false;
// Structure from
public structureForm: UntypedFormGroup;
@@ -98,6 +98,7 @@ export class FormViewComponent implements OnInit, AfterViewInit {
// Get structure from history (this is used to create personal offer from profile)
if (history.state.structure) {
this.structure = history.state.structure;
+ this.isPersonalOfferProfile = true;
}
this.routeParam = this.router.routerState.snapshot.url.split('/')[2];
@@ -247,6 +248,15 @@ export class FormViewComponent implements OnInit, AfterViewInit {
public nextPage(): void {
this.isPageValid = false;
+ // If the user is creating personalOffer for one of his structure from his profile, we skip the structure choice step
+ if (
+ this.isPersonalOfferProfile &&
+ this.currentFormType == formType.personaloffer &&
+ this.currentPage === personalOfferFormStep.personalOfferStructureChoice - 1
+ ) {
+ this.setHasOtherPersonalOffer(false);
+ this.currentPage++;
+ }
if (this.currentPage < this.nbSteps) {
this.currentPage++;
}