feat: improved handling of fields to be rendered as static text

This commit is contained in:
Björn Fromme
2025-10-27 13:38:40 +01:00
parent eee7be0c1e
commit 51dbf20118
8 changed files with 211 additions and 82 deletions
+11 -11
View File
@@ -45,11 +45,11 @@ class EditFieldStateProvider extends AbstractFieldStateProvider
$pickupsMutabilityCondition = new PickupsMutabilityCondition();
// Authenticated user personal data protection
// Hide personal data fields for participants linked to BPN accounts (prevents duplicate records)
// Render personal data fields as static text for participants linked to BPN accounts (prevents duplicate records)
$authenticatedUserCondition = new AuthenticatedUserPersonalDataCondition();
// Make all personal data fields readonly if participant not mutable
// OR hidden if participant is linked to BPN account (authenticated user)
// OR static text if participant is linked to BPN account (authenticated user)
// Note: First participant is now treated as independent from applicant and can be edited
$personalDataFields = [
'firstName',
@@ -62,36 +62,36 @@ class EditFieldStateProvider extends AbstractFieldStateProvider
];
foreach ($personalDataFields as $field) {
$this->fieldStateConditions[$field] = [
'hidden' => $authenticatedUserCondition,
'static_text' => $authenticatedUserCondition,
'readonly' => CompositeCondition::not(new MutabilityCondition()),
];
}
// Address fields - hidden for authenticated users, readonly if participant not mutable
// Address fields - static text for authenticated users, readonly if participant not mutable
$this->fieldStateConditions['address'] = [
'hidden' => $authenticatedUserCondition,
'static_text' => $authenticatedUserCondition,
'readonly' => CompositeCondition::not(new MutabilityCondition()),
];
// Address subfields - must be hidden to prevent creating duplicate BPN records
// Address subfields - must render as static text to prevent creating duplicate BPN records
$this->fieldStateConditions['address.street'] = [
'hidden' => $authenticatedUserCondition,
'static_text' => $authenticatedUserCondition,
];
$this->fieldStateConditions['address.postCode'] = [
'hidden' => $authenticatedUserCondition,
'static_text' => $authenticatedUserCondition,
];
$this->fieldStateConditions['address.city'] = [
'hidden' => $authenticatedUserCondition,
'static_text' => $authenticatedUserCondition,
];
$this->fieldStateConditions['address.country'] = [
'hidden' => $authenticatedUserCondition,
'static_text' => $authenticatedUserCondition,
];
$this->fieldStateConditions['address.district'] = [
'hidden' => $authenticatedUserCondition,
'static_text' => $authenticatedUserCondition,
];
// Conditional visibility for service fields (same as create flow)