|
|
|
@ -1,6 +1,8 @@
|
|
|
|
|
import {Component, input, OnInit} from '@angular/core';
|
|
|
|
|
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
|
|
|
|
import {ValidatorService} from "angular-iban";
|
|
|
|
|
import {StudentRegistration} from "../../../models/student-registration";
|
|
|
|
|
import {RegisterService} from "../../../services/register/register.service";
|
|
|
|
|
|
|
|
|
|
export const MY_DATE_FORMAT= {
|
|
|
|
|
parse: {
|
|
|
|
@ -20,8 +22,6 @@ export const MY_DATE_FORMAT= {
|
|
|
|
|
styleUrls: ['./student-register.component.scss'],
|
|
|
|
|
})
|
|
|
|
|
export class StudentRegisterComponent implements OnInit {
|
|
|
|
|
inputText: string = '';
|
|
|
|
|
masterFormGroup!: FormGroup;
|
|
|
|
|
firstFormGroup!: FormGroup;
|
|
|
|
|
secondFormGroup!: FormGroup;
|
|
|
|
|
thirdFormGroup!: FormGroup;
|
|
|
|
@ -62,41 +62,9 @@ export class StudentRegisterComponent implements OnInit {
|
|
|
|
|
'Ein späterer rückwirkender Widerruf für aktuell stattfindende bzw. bereits stattgefundene\n' +
|
|
|
|
|
'Veranstaltungen ist ausgeschlossen.';
|
|
|
|
|
|
|
|
|
|
constructor(private _formBuilder: FormBuilder) {}
|
|
|
|
|
constructor(private _formBuilder: FormBuilder, private registerService: RegisterService) {}
|
|
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
|
//TODO Test to group all forms into one master form
|
|
|
|
|
// this.masterFormGroup = this._formBuilder.group({
|
|
|
|
|
// zeroFormGroup: this._formBuilder.group({
|
|
|
|
|
// danceTraining: [''],
|
|
|
|
|
// karateTraining: [''],
|
|
|
|
|
// freeTraining: [''],
|
|
|
|
|
// }, {
|
|
|
|
|
// validators: [this.requireAtLeastOne]
|
|
|
|
|
// }),
|
|
|
|
|
// firstFormGroup: this._formBuilder.group({
|
|
|
|
|
// firstName: ['', Validators.required],
|
|
|
|
|
// lastName: ['', Validators.required],
|
|
|
|
|
// birthdate: ['', Validators.required],
|
|
|
|
|
// postalCode: ['', [Validators.required, Validators.pattern(/^\d+$/)]],
|
|
|
|
|
// address: ['', Validators.required],
|
|
|
|
|
// phone: ['', [Validators.required, Validators.pattern(/^\d+$/)]],
|
|
|
|
|
// email: ['', [Validators.required, Validators.email]],
|
|
|
|
|
// }),
|
|
|
|
|
// secondFormGroup: this._formBuilder.group({
|
|
|
|
|
// accountHolder: ['', Validators.required],
|
|
|
|
|
// iban: ['', [Validators.required, Validators.pattern(/^\d+$/)]],
|
|
|
|
|
// bic: ['', Validators.required],
|
|
|
|
|
// nameOfFinancialInstitute: ['', Validators.required],
|
|
|
|
|
// amount: ['', [Validators.required, Validators.pattern(/^\d+$/)]],
|
|
|
|
|
// einzugsermaechtigung: ['', Validators.required],
|
|
|
|
|
// }),
|
|
|
|
|
// thirdFormGroup: this._formBuilder.group({
|
|
|
|
|
// einwilligung: ['', Validators.required],
|
|
|
|
|
// einverstaendniserklaerung: ['', Validators.required],
|
|
|
|
|
// }),
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
this.firstFormGroup = this._formBuilder.group({
|
|
|
|
|
firstName: ['', Validators.required],
|
|
|
|
@ -136,4 +104,31 @@ export class StudentRegisterComponent implements OnInit {
|
|
|
|
|
},{emitEvent:false}) //Prevent circular change detection
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
submit() {
|
|
|
|
|
const studentRegistration: StudentRegistration = {
|
|
|
|
|
// First Form Group
|
|
|
|
|
firstName: this.firstFormGroup.get('firstName')?.value,
|
|
|
|
|
lastName: this.firstFormGroup.get('lastName')?.value,
|
|
|
|
|
birthdate: this.firstFormGroup.get('birthdate')?.value,
|
|
|
|
|
postalCode: this.firstFormGroup.get('postalCode')?.value,
|
|
|
|
|
address: this.firstFormGroup.get('address')?.value,
|
|
|
|
|
phone: this.firstFormGroup.get('phone')?.value,
|
|
|
|
|
email: this.firstFormGroup.get('email')?.value,
|
|
|
|
|
|
|
|
|
|
// Second Form Group
|
|
|
|
|
accountHolder: this.secondFormGroup.get('accountHolder')?.value,
|
|
|
|
|
iban: this.secondFormGroup.get('iban')?.value,
|
|
|
|
|
bic: this.secondFormGroup.get('bic')?.value,
|
|
|
|
|
nameOfFinancialInstitute: this.secondFormGroup.get('nameOfFinancialInstitute')?.value,
|
|
|
|
|
einzugsermaechtigung: this.secondFormGroup.get('einzugsermaechtigung')?.value,
|
|
|
|
|
|
|
|
|
|
// Third Form Group
|
|
|
|
|
einwilligung: this.thirdFormGroup.get('einwilligung')?.value,
|
|
|
|
|
einverstaendniserklaerung: this.thirdFormGroup.get('einverstaendniserklaerung')?.value
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
this.registerService.set(studentRegistration);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|