wip: booking process

This commit is contained in:
Björn Fromme committed 2025-07-16 11:55:49 +02:00
1 parent bef18971c3
commit 47faa6b08e
26 files changed
+1123 -271

No files matched your search

+35
View File
@@ -16,8 +16,20 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
/**
* Controller for managing customer personal data operations.
*
* Provides functionality for viewing and updating customer profile information
* through integration with the BusProNet API system. Handles personal data
* management and newsletter subscription preferences for authenticated users.
*/
class PersonalDataController extends AbstractController
{
/**
* @param ApiClient $apiClient BusProNet API client for data operations
* @param Crypt $crypt Encryption service for password handling
* @param LoggerInterface $logger Logger for audit trails and debugging
*/
public function __construct(
private readonly ApiClient $apiClient,
private readonly Crypt $crypt,
@@ -25,6 +37,18 @@ class PersonalDataController extends AbstractController
) {
}
/**
* Display and handle updates to customer personal data.
*
* Fetches current personal data from BusProNet API and displays an editable form.
* Handles form submission to update personal information including address and
* communication details. Uses the Post-Redirect-Get pattern for form processing.
*
* @param Request $request The HTTP request containing form data
* @return Response The rendered personal data page or redirect response
*
* @throws ApiClientException When BusProNet API communication fails
*/
#[Route('/personal-data', name: 'app_personal_data')]
#[IsGranted('ROLE_USER')]
public function index(Request $request): Response
@@ -79,6 +103,17 @@ class PersonalDataController extends AbstractController
]);
}
/**
* Toggle newsletter subscription status for the authenticated user.
*
* Retrieves current personal data, toggles the newsletter subscription flag,
* and updates the preference via BusProNet API. Designed for HTMX AJAX
* requests to provide immediate feedback without full page reload.
*
* @return Response Redirect response to personal data page
*
* @throws ApiClientException When BusProNet API communication fails
*/
#[Route('/personal-data/newsletter', name: 'app_personal_data_newsletter', methods: ['POST'])]
#[IsGranted('ROLE_USER')]
public function newsletter(): Response