diff --git a/.vscode/settings.json b/.vscode/settings.json index 69da0c29d8f2f45212a95a509d9aff1c6c6fd0d8..98b4f69e923baeb5c740a6dab0f66e5bc24121e2 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -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" ] } diff --git a/src/app/form/footer-form/footer-form.component.ts b/src/app/form/footer-form/footer-form.component.ts index deb0bf57766f1c5e27b298d85b65c8ac3dd1bd99..60e8f5f3edad27ca09e24fce1d125c3b062cc505 100644 --- a/src/app/form/footer-form/footer-form.component.ts +++ b/src/app/form/footer-form/footer-form.component.ts @@ -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 diff --git a/src/app/form/form-view/form-view.component.html b/src/app/form/form-view/form-view.component.html index 0469aec2eed2c60f43eb280c91b8d98c7ac4c488..6b5bf067715bebe7ff30713ad2449cd17dcd45cc 100644 --- a/src/app/form/form-view/form-view.component.html +++ b/src/app/form/form-view/form-view.component.html @@ -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" diff --git a/src/app/form/form-view/form-view.component.ts b/src/app/form/form-view/form-view.component.ts index 0de5140bde1760f528233fe0dd54cc863b0370ae..8c71adcc1ea42b08fa7ed537eb2f71984a5ea655 100644 --- a/src/app/form/form-view/form-view.component.ts +++ b/src/app/form/form-view/form-view.component.ts @@ -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 diff --git a/src/app/guards/deactivate.guard.ts b/src/app/guards/deactivate.guard.ts index e9f65a50aa83049329bbd7587b9c3ed4d795b249..a0e8f3d14fc5fe715bc76d69d16215687362a0e9 100644 --- a/src/app/guards/deactivate.guard.ts +++ b/src/app/guards/deactivate.guard.ts @@ -1,5 +1,5 @@ -import { CanDeactivate } from '@angular/router'; import { Injectable } from '@angular/core'; +import { CanDeactivate } from '@angular/router'; import { Observable } from 'rxjs'; export interface IDeactivateComponent {