diff --git a/backend/api/registrations/set.php b/backend/api/registrations/set.php
index d921937..b531cdc 100644
--- a/backend/api/registrations/set.php
+++ b/backend/api/registrations/set.php
@@ -27,22 +27,24 @@
$phone = escape($connection, $_POST["phone"]);
$email = escape($connection, $_POST["email"]);
- $accountHolder = escape($connection, $_POST["accountHolder"]);
+ $accountholder = escape($connection, $_POST["accountHolder"]);
$iban = escape($connection, $_POST["iban"]);
$bic = escape($connection, $_POST["bic"]);
$bank = escape($connection, $_POST["bank"]);
- $applicationConsent = intval($_POST["applicationConsent"]);
- $dataChangeConsent = intval($_POST["dataChangeConsent"]);
- $privacyPolicyConsent = intval($_POST["privacyPolicyConsent"]);
- $directDebitConsent = intval($_POST["directDebitConsent"]);
- $returnDebitConsent = intval($_POST["returnDebitConsent"]);
- $dataStorageConsent = intval($_POST["dataStorageConsent"]);
- $multimediaConsent = intval($_POST["multimediaConsent"]);
+ $applicationconsent = $_POST["applicationConsent"] === "true";
+ $datachangeconsent = $_POST["dataChangeConsent"] === "true";
+ $privacypolicyconsent = $_POST["privacyPolicyConsent"] === "true";
+ $directdebitconsent = $_POST["directDebitConsent"] === "true";
+ $returndebitconsent = $_POST["returnDebitConsent"] === "true";
+ $datastorageconsent = $_POST["dataStorageConsent"] === "true";
+ $multimediaconsent = $_POST["multimediaConsent"] === "true";
+
+ $registrationfrom = registrationDate()->format('Y-m-d');
$querystr = "SELECT * FROM li_registrations
WHERE li_registrations.rid = ${rid}";
-
+
$result = mysqli_query($connection, $querystr);
if($result->num_rows !== 0) {
$querystr = "UPDATE li_registrations SET firstname='${firstname}', lastname='${lastname}', birthday='${birthday}',
@@ -50,18 +52,20 @@
zip='${zip}', city='${city}', phone='${phone}', email='${email}',
accountholder='${accountHolder}', iban='${iban}', bic='${bic}', bank='${bank}',
applicationconsent=${applicationconsent}, datachangeconsent=${datachangeconsent}, privacypolicyconsent=${privacypolicyconsent},
- returndebitconsent=${returndebitconsent}, datastorageconsent=${datastorageconsent}, multimediaconsent=${multimediaconsent},
+ directdebitconsent=${directdebitconsent}, returndebitconsent=${returndebitconsent}, datastorageconsent=${datastorageconsent}, multimediaconsent=${multimediaconsent},
WHERE rid=${rid}";
} else {
$querystr = "INSERT INTO li_registrations (firstname, lastname, birthday, gender, street, house, zip, city, phone, email,
accountholder, iban, bic, bank,
- applicationconsent, datachangeconsent, privacypolicyconsent,
- returndebitconsent, datastorageconsent, multimediaconsent)
+ applicationconsent, datachangeconsent, privacypolicyconsent, directdebitconsent,
+ returndebitconsent, datastorageconsent, multimediaconsent, registrationfrom)
- VALUES('{$firstname}', '{$lastname}', '{$birthday}', {$gender}, '{$street}', {$house}, '{$house_suffix}', '{$zip}', '{$city}', '{$phone}', '{$email}'.
- '${accountHolder}', '${iban}', '${bic}', '${bank}',
- ${applicationconsent}, ${datachangeconsent}, ${privacypolicyconsent},
- ${returndebitconsent}, ${datastorageconsent}, ${multimediaconsent})";
+ VALUES('{$firstname}', '{$lastname}', '{$birthday}', {$gender}, '{$street}', {$house}, '{$zip}', '{$city}', '{$phone}', '{$email}',
+ '{$accountholder}', '{$iban}', '{$bic}', '{$bank}',
+ {$applicationconsent}, {$datachangeconsent}, {$privacypolicyconsent}, {$directdebitconsent},
+ {$returndebitconsent}, {$datastorageconsent}, {$multimediaconsent}, '{$registrationfrom}')";
+
+ echo json_encode('{ "result": "' . $querystr . '" }');
}
$result = mysqli_query($connection, $querystr);
diff --git a/backend/utils/tools.php b/backend/utils/tools.php
index 3d31543..ba36088 100644
--- a/backend/utils/tools.php
+++ b/backend/utils/tools.php
@@ -43,4 +43,20 @@ function login( $token ) {
return ($expectedToken === $token);
}
+function registrationDate() {
+ $today = new DateTime();
+ $currentYear = $today->format('Y');
+ $currentMonth = $today->format('m');
+ $currentDate = $today->format('d');
+
+ if ($currentDate === 1) {
+ return new DateTime("$currentYear-$currentMonth-01"); // Today is the 1st of the month.
+ } elseif ($currentDate <= 20) {
+ return new DateTime("$currentYear-$currentMonth-15"); // Return the 15th of the current month.
+ } else {
+ $nextMonth = $today->modify('first day of next month'); // Advance to the first day of the next month.
+ return $nextMonth;
+ }
+}
+
?>
\ No newline at end of file
diff --git a/frontend/src/app/components/students/student-register/student-register.component.html b/frontend/src/app/components/students/student-register/student-register.component.html
index bf3d5cd..c1ea870 100644
--- a/frontend/src/app/components/students/student-register/student-register.component.html
+++ b/frontend/src/app/components/students/student-register/student-register.component.html
@@ -28,15 +28,15 @@
Geburtstag
+ [for]="birthdayPicker">
@@ -67,7 +67,7 @@
Postleitzahl
-
+
@@ -81,6 +81,9 @@
+
+
Sie melden sich zum {{registrationDate | date:'dd.MM.yyyy' }} an
+
@@ -123,7 +126,7 @@
Name der Bank
-
+
diff --git a/frontend/src/app/components/students/student-register/student-register.component.scss b/frontend/src/app/components/students/student-register/student-register.component.scss
index 05c2b7c..5a688e6 100644
--- a/frontend/src/app/components/students/student-register/student-register.component.scss
+++ b/frontend/src/app/components/students/student-register/student-register.component.scss
@@ -1,6 +1,8 @@
.stepperContainer {
display: flex;
justify-content: space-around;
+ max-width: 1024px;
+ margin: auto;
}
.mat-stepper-horizontal {
@@ -54,6 +56,15 @@
p {
text-align: justify;
}
+
+}
+
+.big {
+ font-size: 1.9em;
+
+ p {
+ text-align: center;
+ }
}
textarea {
diff --git a/frontend/src/app/components/students/student-register/student-register.component.ts b/frontend/src/app/components/students/student-register/student-register.component.ts
index 3822d31..8668084 100644
--- a/frontend/src/app/components/students/student-register/student-register.component.ts
+++ b/frontend/src/app/components/students/student-register/student-register.component.ts
@@ -1,8 +1,8 @@
import {Component, input, OnInit} from '@angular/core';
-import { FormBuilder, FormGroup, Validators } from '@angular/forms';
+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";
+import {RegistrationsService} from "../../../services/registrations/registrations.service";
export const MY_DATE_FORMAT= {
parse: {
@@ -70,16 +70,16 @@ export class StudentRegisterComponent implements OnInit {
'Ein späterer rückwirkender Widerruf für aktuell stattfindende bzw. bereits stattgefundene ' +
'Veranstaltungen ist ausgeschlossen.';
- constructor(private _formBuilder: FormBuilder, private registerService: RegisterService) {}
+ constructor(private _formBuilder: FormBuilder, private registrationsService: RegistrationsService) {}
ngOnInit() {
this.firstFormGroup = this._formBuilder.group({
firstName: ['', Validators.required],
lastName: ['', Validators.required],
- birthdate: ['', Validators.required],
+ birthday: ['', Validators.required],
street: ['', Validators.required],
- house: ['', Validators.required, Validators.pattern("^[0-9]*$")],
+ house: ['', Validators.required, Validators.pattern("^[0-9]$")],
zip: ['', [Validators.required, Validators.pattern(/^\d+$/)]], //^: Asserts the start of the string. \d+: Matches one or more digits.$: Asserts the end of the string.
city: ['', Validators.required],
phone: ['', [Validators.required, Validators.pattern(/^(\+?\d{1,3})?[ ]*\d{9,}$/)]],
@@ -94,7 +94,7 @@ export class StudentRegisterComponent implements OnInit {
accountHolder: ['', Validators.required],
iban: ['', [Validators.required, ValidatorService.validateIban]],
bic: ['', [Validators.required, Validators.pattern(/^[A-Z]{6}[A-Z0-9]{2}([A-Z0-9]{3})?$/)]],
- nameOfFinancialInstitute: ['', Validators.required],
+ bank: ['', Validators.required],
directDebitConsent: ['', Validators.required],
returnDebitConsent: ['', Validators.required],
});
@@ -111,6 +111,21 @@ export class StudentRegisterComponent implements OnInit {
})
}
+ get registrationDate(): Date {
+ const today = new Date();
+ const currentYear = today.getFullYear();
+ const currentMonth = today.getMonth();
+ const currentDate = today.getDate();
+
+ if (currentDate === 1) {
+ return new Date(currentYear, currentMonth, 1); // Today is the 1st of the month.
+ } else if (currentDate <= 20) {
+ return new Date(currentYear, currentMonth, 15); // Return the 15th of the current month.
+ } else {
+ return new Date(currentYear, currentMonth + 1, 1); // Return the 1st of the next month.
+ }
+ }
+
capitalizeFirstTwoLetters() {
let ibanValue = this.secondFormGroup.get("iban")?.value
if(ibanValue.length >= 2) {
@@ -129,7 +144,7 @@ export class StudentRegisterComponent implements OnInit {
// First Form Group
firstName: this.firstFormGroup.get('firstName')?.value,
lastName: this.firstFormGroup.get('lastName')?.value,
- birthdate: this.firstFormGroup.get('birthdate')?.value,
+ birthday: this.firstFormGroup.get('birthday')?.value,
gender: this.firstFormGroup.get('gender')?.value,
street: this.firstFormGroup.get('street')?.value,
house: this.firstFormGroup.get('house')?.value,
@@ -155,6 +170,6 @@ export class StudentRegisterComponent implements OnInit {
multimediaConsent: this.thirdFormGroup.get('multimediaConsent')?.value
};
- this.registerService.set(studentRegistration);
+ this.registrationsService.set(studentRegistration).subscribe();
}
}
diff --git a/frontend/src/app/models/student-registration.ts b/frontend/src/app/models/student-registration.ts
index 8d053ce..e984332 100644
--- a/frontend/src/app/models/student-registration.ts
+++ b/frontend/src/app/models/student-registration.ts
@@ -1,7 +1,7 @@
export interface StudentRegistration {
firstName: string;
lastName: string;
- birthdate: Date;
+ birthday: Date;
gender: number;
street: string;
house: number;
diff --git a/frontend/src/app/services/register/register.service.ts b/frontend/src/app/services/register/register.service.ts
deleted file mode 100644
index 0cde0f8..0000000
--- a/frontend/src/app/services/register/register.service.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-import { Injectable } from '@angular/core';
-import {HttpClient} from "@angular/common/http";
-import {StudentRegistration} from "../../models/student-registration";
-import {Observable} from "rxjs";
-import { environment } from 'src/environments/environment';
-
-@Injectable({
- providedIn: 'root'
-})
-export class RegisterService {
- private readonly serviceName = 'register';
- constructor(private http: HttpClient) { }
-
- public set(registration: StudentRegistration): Observable {
- const payload = JSON.stringify(registration);
-
- return this.http.post(`${environment.apiUrl}${this.serviceName}/set.php`,
- payload
- );
- }
-}
diff --git a/frontend/src/app/services/registrations/registrations.service.ts b/frontend/src/app/services/registrations/registrations.service.ts
new file mode 100644
index 0000000..64ce364
--- /dev/null
+++ b/frontend/src/app/services/registrations/registrations.service.ts
@@ -0,0 +1,44 @@
+import { Injectable } from '@angular/core';
+import { HttpClient } from "@angular/common/http";
+import { StudentRegistration } from "../../models/student-registration";
+import { Observable } from "rxjs";
+import { environment } from 'src/environments/environment';
+
+@Injectable({
+ providedIn: 'root'
+})
+export class RegistrationsService {
+ private readonly serviceName = 'registrations';
+ constructor(private http: HttpClient) { }
+
+ public set(registration: StudentRegistration): Observable {
+ const formatDate = (date: Date): string => date.toISOString().split('T')[0];
+
+ const payload = `firstname=${encodeURIComponent(registration.firstName)}&` +
+ `lastname=${encodeURIComponent(registration.lastName)}&` +
+ `birthday=${encodeURIComponent(formatDate(registration.birthday))}&` +
+ `gender=${encodeURIComponent(registration.gender)}&` +
+ `street=${encodeURIComponent(registration.street)}&` +
+ `house=${encodeURIComponent(registration.house)}&` +
+ `zip=${encodeURIComponent(registration.zip)}&` +
+ `city=${encodeURIComponent(registration.city)}&` +
+ `phone=${encodeURIComponent(registration.phone)}&` +
+ `email=${encodeURIComponent(registration.email)}&` +
+ `accountHolder=${encodeURIComponent(registration.accountHolder)}&` +
+ `iban=${encodeURIComponent(registration.iban)}&` +
+ `bic=${encodeURIComponent(registration.bic)}&` +
+ `bank=${encodeURIComponent(registration.bank)}&` +
+ `applicationConsent=${encodeURIComponent(registration.applicationConsent)}&` +
+ `dataChangeConsent=${encodeURIComponent(registration.dataChangeConsent)}&` +
+ `privacyPolicyConsent=${encodeURIComponent(registration.privacyPolicyConsent)}&` +
+ `directDebitConsent=${encodeURIComponent(registration.directDebitConsent)}&` +
+ `returnDebitConsent=${encodeURIComponent(registration.returnDebitConsent)}&` +
+ `dataStorageConsent=${encodeURIComponent(registration.dataStorageConsent)}&` +
+ `multimediaConsent=${encodeURIComponent(registration.multimediaConsent)}`;
+
+
+ return this.http.post(`${environment.apiUrl}${this.serviceName}/set.php`,
+ payload
+ );
+ }
+}