- TRA-89 - Problem solved where connection could get lost in sync between client and backend
- TRA-98 - End user could continue without accepting dpa & terms - TRA-96 - Multiple-choice questions in mobile client not scrolling -> Solved by introducing new client layout - TRA-101 - DPA-link was not working - TRA-102 - Wrong responses when looking for affirmative answers.
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
:field-id="field.id || field.name"
|
||||
:model-value="localFormValues[field.id || field.name]"
|
||||
@update:model-value="updateFieldValue(field.id || field.name, $event)"
|
||||
@open-privacy-modal="openPrivacyModal"
|
||||
@open-dpa-modal="openDpaModal"
|
||||
@open-terms-modal="openTermsModal"
|
||||
@keydown-enter="handleEnterKey"
|
||||
/>
|
||||
@@ -32,7 +32,7 @@
|
||||
:field-id="fieldId"
|
||||
:model-value="localFormValues[fieldId]"
|
||||
@update:model-value="updateFieldValue(fieldId, $event)"
|
||||
@open-privacy-modal="openPrivacyModal"
|
||||
@open-dpa-modal="openDpaModal"
|
||||
@open-terms-modal="openTermsModal"
|
||||
@keydown-enter="handleEnterKey"
|
||||
/>
|
||||
@@ -199,12 +199,19 @@ export default {
|
||||
// Basic validation - check required fields
|
||||
const missingFields = [];
|
||||
|
||||
// Extra consent-validatie: detecteer consent velden en controleer of alle consents geaccepteerd zijn.
|
||||
// We maken dit toekomstvast voor meerdere consent-velden.
|
||||
let hasConsentField = false;
|
||||
let allConsentsAccepted = true;
|
||||
|
||||
if (Array.isArray(this.formData.fields)) {
|
||||
// Valideer array-gebaseerde velden
|
||||
this.formData.fields.forEach(field => {
|
||||
const fieldId = field.id || field.name;
|
||||
const value = this.localFormValues[fieldId];
|
||||
|
||||
// Basis required-validatie
|
||||
if (field.required) {
|
||||
const value = this.localFormValues[fieldId];
|
||||
// Voor boolean velden is false een geldige waarde
|
||||
if (field.type === 'boolean') {
|
||||
// Boolean velden zijn altijd geldig als ze een boolean waarde hebben
|
||||
@@ -220,12 +227,21 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Consent-detectie en -validatie (ongeacht required-vlag)
|
||||
if (field.type === 'boolean' && field.meta && field.meta.kind === 'consent') {
|
||||
hasConsentField = true;
|
||||
if (value !== true) {
|
||||
allConsentsAccepted = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Valideer object-gebaseerde velden
|
||||
Object.entries(this.formData.fields).forEach(([fieldId, field]) => {
|
||||
const value = this.localFormValues[fieldId];
|
||||
|
||||
if (field.required) {
|
||||
const value = this.localFormValues[fieldId];
|
||||
// Voor boolean velden is false een geldige waarde
|
||||
if (field.type === 'boolean') {
|
||||
// Boolean velden zijn altijd geldig als ze een boolean waarde hebben
|
||||
@@ -241,10 +257,27 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Consent-detectie en -validatie (ongeacht required-vlag)
|
||||
if (field.type === 'boolean' && field.meta && field.meta.kind === 'consent') {
|
||||
hasConsentField = true;
|
||||
if (value !== true) {
|
||||
allConsentsAccepted = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return missingFields.length === 0;
|
||||
const isBaseValid = missingFields.length === 0;
|
||||
|
||||
if (!hasConsentField) {
|
||||
// Geen speciale consentvelden: behoud bestaand gedrag
|
||||
return isBaseValid;
|
||||
}
|
||||
|
||||
// Als er één of meer consentvelden zijn, zijn we alleen geldig als
|
||||
// zowel de basisvalidatie als alle consents geaccepteerd zijn.
|
||||
return isBaseValid && allConsentsAccepted;
|
||||
},
|
||||
// Title display mode configuration
|
||||
titleDisplayMode() {
|
||||
@@ -479,11 +512,13 @@ export default {
|
||||
},
|
||||
|
||||
// Modal handling methods
|
||||
openPrivacyModal() {
|
||||
openDpaModal() {
|
||||
console.log('[DynamicForm] openDpaModal called');
|
||||
this.loadContent('dpa');
|
||||
},
|
||||
|
||||
openTermsModal() {
|
||||
console.log('[DynamicForm] openTermsModal called');
|
||||
this.loadContent('terms');
|
||||
},
|
||||
|
||||
@@ -504,6 +539,8 @@ export default {
|
||||
async loadContent(contentType) {
|
||||
const title = contentType === 'dpa' ? 'Data Privacy Agreement' : 'Terms & Conditions';
|
||||
const contentUrl = `${this.apiPrefix}/${contentType}`;
|
||||
|
||||
console.log('[DynamicForm] Loading content from:', contentUrl);
|
||||
|
||||
// Use the composable to show modal and load content
|
||||
await this.contentModal.showModal({
|
||||
@@ -514,11 +551,19 @@ export default {
|
||||
|
||||
// Handle Enter key press in form fields
|
||||
handleEnterKey(event) {
|
||||
console.log('DynamicForm: Enter event received, emitting form-enter-pressed');
|
||||
console.log('DynamicForm: Enter event received');
|
||||
// Prevent default form submission
|
||||
event.preventDefault();
|
||||
// Emit event to parent (ChatInput) to trigger send
|
||||
this.$emit('form-enter-pressed');
|
||||
|
||||
// Alleen submit toelaten als het formulier (inclusief consentvelden)
|
||||
// geldig is. Hiermee worden keyboard-shortcuts uitgeschakeld zolang
|
||||
// consent niet is gegeven of andere vereiste velden ontbreken.
|
||||
if (this.isFormValid && !this.isSubmittingForm && !this.isSubmitting) {
|
||||
// Emit event to parent (ChatInput) to trigger send
|
||||
this.$emit('form-enter-pressed');
|
||||
} else {
|
||||
console.log('DynamicForm: Enter ignored because form is not valid or is submitting');
|
||||
}
|
||||
},
|
||||
|
||||
// Focus management - auto-focus on first form field
|
||||
|
||||
Reference in New Issue
Block a user