Skip to content
Snippets Groups Projects
Commit 32553a58 authored by Hugo SUBTIL's avatar Hugo SUBTIL
Browse files

Merge branch '31-creation-de-structure-ces-formations-sont-elles-gratuites' into 'V2.0'

Resolve "[Création de structure] - Ces formations sont-elles gratuites ?"

Closes #31

See merge request web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_client!321
parents 443d8d88 da0b9386
No related branches found
No related tags found
4 merge requests!418V2.1.0,!400V2.0,!321Resolve "[Création de structure] - Ces formations sont-elles gratuites ?",!230V2.0
......@@ -16,7 +16,7 @@ import { structureFormStep } from '../form-view/structure-form/structureFormStep
@Component({
selector: 'app-footer-form',
templateUrl: './footer-form.component.html',
styleUrls: ['./footer-form.component.scss'],
styleUrls: ['./footer-form.component.scss']
})
export class FooterFormComponent implements OnChanges {
@Input() currentForm: formType;
......@@ -73,8 +73,7 @@ export class FooterFormComponent implements OnChanges {
}
if (
this.currentForm === formType.structure &&
(this.currentStep === structureFormStep.noStructure ||
this.currentStep === structureFormStep.StructureInfoUnknown)
(this.currentStep === structureFormStep.noStructure || this.currentStep === structureFormStep.StructureInfoUnknown)
) {
this.isLastFormStep = true;
}
......@@ -96,17 +95,39 @@ export class FooterFormComponent implements OnChanges {
this.router.navigateByUrl('news');
}
/**
* Check if trainings are selected in order to ask for pricing
*/
public isTrainingsSelected(): boolean {
return (
this.form.value.accessRight.length > 0 ||
this.form.value.baseSkills.length > 0 ||
this.form.value.digitalCultureSecurity.length > 0 ||
this.form.value.parentingHelp.length > 0 ||
this.form.value.socialAndProfessional.length > 0
);
}
public prevPage(): void {
if (!this.isEditMode) {
if (this.currentForm === formType.structure && this.currentStep === structureFormStep.structureType) {
if (!this.isEditMode && this.currentForm === formType.structure) {
if (this.currentStep === structureFormStep.structureType) {
this.changeCurrentStep.emit(structureFormStep.structureFormTime);
return;
}
if (this.currentStep === structureFormStep.structureWifi) {
if (this.isTrainingsSelected()) {
this.changeCurrentStep.emit(structureFormStep.structureTrainingPrice);
} else {
this.changeCurrentStep.emit(structureFormStep.structureTrainingType);
}
return;
}
this.goToPreviousPage();
} else {
history.back();
}
}
public async nextPage(): Promise<void> {
if (this.currentForm === formType.account && this.currentStep === accountFormStep.accountNewsletter) {
const user = new User(this.form.value);
......@@ -139,6 +160,15 @@ export class FooterFormComponent implements OnChanges {
this.changeCurrentStep.emit(structureFormStep.structureType);
return;
}
// Check if trainings are selected in order to ask for pricing
if (this.currentStep === structureFormStep.structureTrainingType) {
if (this.isTrainingsSelected()) {
this.changeCurrentStep.emit(structureFormStep.structureTrainingPrice);
} else {
this.changeCurrentStep.emit(structureFormStep.structureWifi);
}
return;
}
if (this.currentStep === structureFormStep.structureContactCompletion) {
//TODO Go to send mail page and send the mail
return;
......@@ -164,9 +194,7 @@ export class FooterFormComponent implements OnChanges {
private isStructureChoiceValid(): boolean {
return (
this.currentForm === formType.structure &&
this.currentStep === structureFormStep.structureChoice &&
this.form.value._id
this.currentForm === formType.structure && this.currentStep === structureFormStep.structureChoice && this.form.value._id
);
}
......@@ -186,8 +214,7 @@ export class FooterFormComponent implements OnChanges {
private isPersonalOfferpage(): boolean {
return (
this.currentForm === formType.personaloffer &&
this.currentStep === personalOfferFormStep.personalOfferStructureChoice
this.currentForm === formType.personaloffer && this.currentStep === personalOfferFormStep.personalOfferStructureChoice
);
}
public isPersonalOfferFirstPage(): boolean {
......
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