59 lines
1.3 KiB
TypeScript
59 lines
1.3 KiB
TypeScript
import {Component, OnInit} from '@angular/core';
|
|
import {ProgressionService} from '../progression.service';
|
|
|
|
// import {PollConfig} from '../config/PollConfig';
|
|
|
|
@Component({
|
|
selector: 'framadate-form-container',
|
|
templateUrl: './form-container.component.html',
|
|
styleUrls: ['./form-container.component.scss']
|
|
})
|
|
/**
|
|
* gestion de la progression dans le formulaire.
|
|
* à chaque étape correspond un composant de page
|
|
*/
|
|
export class FormContainerComponent implements OnInit {
|
|
|
|
// todo make a class in the config folder of this
|
|
private pollConfig: any = {
|
|
poll_type: 'classic',
|
|
title: '',
|
|
description: '',
|
|
allow_stuff: true,
|
|
};
|
|
private progressionStep = 0;
|
|
private progressionStepMax = 0;
|
|
private formIsValid = true;
|
|
|
|
constructor(private progression: ProgressionService) {
|
|
|
|
}
|
|
|
|
ngOnInit() {
|
|
}
|
|
|
|
nextPage() {
|
|
if (this.checkValidity()) {
|
|
this.progressionStep++;
|
|
} else {
|
|
this.displayErrorMessage();
|
|
}
|
|
}
|
|
|
|
selectOption(key: string, val: any) {
|
|
this.pollConfig[key] = val;
|
|
|
|
return true;
|
|
}
|
|
|
|
checkValidity() {
|
|
// TODO with form controls
|
|
return true;
|
|
}
|
|
|
|
displayErrorMessage() {
|
|
// TODO
|
|
return true;
|
|
}
|
|
}
|