Skip to content
Snippets Groups Projects
Commit 2031dd33 authored by Bastien DUMONT's avatar Bastien DUMONT :angel:
Browse files

fix: Offre personnel back button form

parent 4b8a4b04
No related branches found
No related tags found
3 merge requests!418V2.1.0,!412Resolve "[Onboarding] BT précédent inopérant",!400V2.0
......@@ -31,18 +31,19 @@
"cSpell.words": [
"covid",
"facebook",
"friday",
"instagram",
"linkedin",
"monday",
"onespace",
"personaloffer",
"Rés'in",
"saturday",
"sunday",
"thursday",
"toastr",
"ultrawide",
"monday",
"tuesday",
"wednesday",
"thursday",
"friday",
"saturday",
"sunday"
"ultrawide",
"wednesday"
]
}
......@@ -77,7 +77,7 @@ export class FooterFormComponent implements OnChanges {
}
public hasFinishButton(): boolean {
return this.btnName.length == 3;
return this.btnName.length === 3;
}
public finishedModal(): void {
this.endPage.emit();
......@@ -95,7 +95,11 @@ export class FooterFormComponent implements OnChanges {
}
public prevPage(): void {
if (!this.isEditMode && this.currentForm === formType.structure) {
if (this.isEditMode) {
history.back();
}
if (this.currentForm === formType.structure) {
if (this.currentStep === structureFormStep.structureType) {
this.changeCurrentStep.emit(structureFormStep.structureFormTime);
return;
......@@ -116,10 +120,9 @@ export class FooterFormComponent implements OnChanges {
}
return;
}
this.goToPreviousPage();
} else {
history.back();
}
this.goToPreviousPage();
}
public async nextPage(): Promise<void> {
......@@ -176,11 +179,11 @@ export class FooterFormComponent implements OnChanges {
return;
}
if (this.currentStep === structureFormStep.structureContactCompletion) {
//TODO Go to send mail page and send the mail
// TODO Go to send mail page and send the mail
return;
}
}
if (this.isPersonalOfferpage()) {
if (this.isPersonalOfferPage()) {
this.endForm.emit({ formType: this.currentForm });
return;
}
......@@ -220,7 +223,7 @@ export class FooterFormComponent implements OnChanges {
return this.currentForm === formType.profile && this.currentStep === profileFormStep.profileJobSelection;
}
private isPersonalOfferpage(): boolean {
private isPersonalOfferPage(): boolean {
return (
this.currentForm === formType.personaloffer &&
this.currentStep === personalOfferFormStep.personalOfferStructureChoice
......
......@@ -11,53 +11,50 @@
[nbSteps]="nbSteps"
></app-progress-bar>
<div class="page">
<ng-container *ngIf="formType[routeParam] === formType.account || formType[this.routeParam] === formType.register">
<app-account-form
[nbSteps]="nbSteps"
[accountForm]="accountForm"
[hoursForm]="hoursForm"
[currentStep]="currentPage"
[isAccountMode]="isAccountMode"
(goNext)="nextPage()"
(pageValid)="validatePage($event)"
(acceptNewsletter)="acceptReceiveNewsletter($event)"
></app-account-form>
</ng-container>
<ng-container *ngIf="formType[routeParam] === formType.profile">
<app-profile-form
[nbSteps]="nbSteps"
[profileForm]="profileForm"
[currentStep]="currentPage"
(goNext)="nextPage()"
(pageValid)="validatePage($event)"
></app-profile-form>
</ng-container>
<ng-container *ngIf="formType[routeParam] === formType.structure">
<app-structure-form
[nbSteps]="nbSteps"
[structure]="structure"
[structureForm]="structureForm"
[hoursForm]="hoursForm"
[currentStep]="currentPage"
[isEditMode]="isEditMode"
(goNext)="nextPage()"
(isNotExistingStructure)="nextPage()"
(pageValid)="validatePage($event)"
(updateHoursForm)="updateHours($event)"
(setEditStep)="setCurrentStep($event)"
></app-structure-form>
</ng-container>
<ng-container *ngIf="formType[routeParam] === formType.personaloffer">
<app-personal-offer-form
[nbSteps]="nbSteps"
[personalOfferForm]="personalOfferForm"
[currentStep]="currentPage"
[structureName]="structure.structureName"
(setHasOtherOffer)="setHasOtherPersonalOffer($event)"
(pageValid)="validatePage($event)"
></app-personal-offer-form>
</ng-container>
<app-account-form
*ngIf="formType[routeParam] === formType.account || formType[this.routeParam] === formType.register"
[nbSteps]="nbSteps"
[accountForm]="accountForm"
[hoursForm]="hoursForm"
[currentStep]="currentPage"
[isAccountMode]="isAccountMode"
(goNext)="nextPage()"
(pageValid)="validatePage($event)"
(acceptNewsletter)="acceptReceiveNewsletter($event)"
></app-account-form>
<app-profile-form
*ngIf="formType[routeParam] === formType.profile"
[nbSteps]="nbSteps"
[profileForm]="profileForm"
[currentStep]="currentPage"
(goNext)="nextPage()"
(pageValid)="validatePage($event)"
></app-profile-form>
<app-structure-form
*ngIf="formType[routeParam] === formType.structure"
[nbSteps]="nbSteps"
[structure]="structure"
[structureForm]="structureForm"
[hoursForm]="hoursForm"
[currentStep]="currentPage"
[isEditMode]="isEditMode"
(goNext)="nextPage()"
(isNotExistingStructure)="nextPage()"
(pageValid)="validatePage($event)"
(updateHoursForm)="updateHours($event)"
(setEditStep)="setCurrentStep($event)"
></app-structure-form>
<app-personal-offer-form
*ngIf="formType[routeParam] === formType.personaloffer"
[nbSteps]="nbSteps"
[personalOfferForm]="personalOfferForm"
[currentStep]="currentPage"
[structureName]="structure.structureName"
(setHasOtherOffer)="setHasOtherPersonalOffer($event)"
(pageValid)="validatePage($event)"
></app-personal-offer-form>
</div>
<app-footer-form
*ngIf="displayFooterForm()"
[currentStep]="currentPage"
......
......@@ -183,8 +183,7 @@ export class FormViewComponent implements OnInit, AfterViewInit {
this.nbSteps = totalFormSteps;
this.currentPage = personalOfferFormStep.personalOfferAccompaniment;
this.currentFormType = formType.personaloffer;
const newPersonalOffer: PersonalOffer = new PersonalOffer();
this.createPersonalOfferForm(newPersonalOffer);
this.createPersonalOfferForm(new PersonalOffer());
this.currentForm = this.personalOfferForm;
}
}
......@@ -332,17 +331,17 @@ export class FormViewComponent implements OnInit, AfterViewInit {
forkJoin({
employer: this.profileService.createEmployer(this.profileForm.get('employer').value).pipe(
map((res) => res),
catchError((_e) => of(this.profileForm.get('employer').value))
catchError(() => of(this.profileForm.get('employer').value))
),
job: this.profileService.createJob(this.profileForm.get('job').value).pipe(
map((res) => res),
catchError((_e) => of(this.profileForm.get('job').value))
catchError(() => of(this.profileForm.get('job').value))
),
profile: this.profileService
.updateProfile(this.profileForm.get('employer').value.name, this.profileForm.get('job').value.name)
.pipe(
map((res) => (this.profile = res)),
catchError((_e) => of())
catchError(() => of())
),
}).subscribe(async () => {
// if register a new user as a new member structure, no structure to choose
......
import { CanDeactivate } from '@angular/router';
import { Injectable } from '@angular/core';
import { CanDeactivate } from '@angular/router';
import { Observable } from 'rxjs';
export interface IDeactivateComponent {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment