Skip to content
Snippets Groups Projects

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

1 file
+ 37
10
Compare changes
  • Side-by-side
  • Inline
@@ -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 {
Loading