Changes for eveai_chat_client:

- Modal display of privacy statement & Terms & Conditions
- Consent-flag ==> check of privacy and Terms & Conditions
- customisation option added to show or hide DynamicForm titles
This commit is contained in:
Josako
2025-07-28 21:47:56 +02:00
parent ef138462d9
commit 5e81595622
28 changed files with 1609 additions and 2271 deletions

View File

@@ -99,7 +99,16 @@
:required="field.required"
style="margin-right: 8px;"
>
<span class="checkbox-text">{{ field.name }}</span>
<!-- Regular checkbox label -->
<span v-if="!isConsentField" class="checkbox-text">{{ field.name }}</span>
<!-- Consent field with privacy and terms links -->
<span v-else class="checkbox-text consent-text">
{{ texts.consentPrefix }}
<a href="#" @click="openPrivacyModal" class="consent-link">{{ texts.privacyLink }}</a>
{{ texts.consentMiddle }}
<a href="#" @click="openTermsModal" class="consent-link">{{ texts.termsLink }}</a>
{{ texts.consentSuffix }}
</span>
<span v-if="field.required" class="required" style="color: #d93025; margin-left: 2px;">*</span>
</label>
</div>
@@ -167,6 +176,8 @@
</template>
<script>
import { useComponentTranslations } from '../js/services/LanguageProvider.js';
export default {
name: 'FormField',
props: {
@@ -185,8 +196,57 @@ export default {
default: null
}
},
emits: ['update:modelValue'],
emits: ['update:modelValue', 'open-privacy-modal', 'open-terms-modal'],
setup() {
// Consent text constants (English base)
const consentTexts = {
consentPrefix: "I agree with the",
consentMiddle: "and",
consentSuffix: "of AskEveAI",
privacyLink: "privacy statement",
termsLink: "terms and conditions"
};
try {
// Initialize translations for this component
const { texts } = useComponentTranslations('FormField', consentTexts);
return {
translatedTexts: texts,
fallbackTexts: consentTexts
};
} catch (error) {
console.error('FormField setup(): Error in useComponentTranslations:', error);
// Return fallback texts if LanguageProvider fails
return {
translatedTexts: null,
fallbackTexts: consentTexts
};
}
},
computed: {
texts() {
// Robust consent texts that always return valid values
// Use translated texts if available and valid, otherwise use fallback
if (this.translatedTexts && typeof this.translatedTexts === 'object') {
const translated = this.translatedTexts;
// Check if translated texts have all required properties
if (translated.consentPrefix && translated.consentMiddle && translated.consentSuffix &&
translated.privacyLink && translated.termsLink) {
return translated;
}
}
// Fallback to English texts
return this.fallbackTexts || {
consentPrefix: "I agree with the",
consentMiddle: "and",
consentSuffix: "of AskEveAI",
privacyLink: "privacy statement",
termsLink: "terms and conditions"
};
},
value: {
get() {
// Gebruik default waarde als modelValue undefined is
@@ -239,6 +299,12 @@ export default {
},
description() {
return this.field.description || '';
},
isConsentField() {
// Detect consent fields by fieldId (key in dictionary) only, not by name (translated label)
return this.field.type === 'boolean' &&
(this.fieldId === 'consent' ||
this.fieldId.toLowerCase().includes('consent'));
}
},
methods: {
@@ -247,6 +313,14 @@ export default {
if (file) {
this.value = file;
}
},
openPrivacyModal(event) {
event.preventDefault();
this.$emit('open-privacy-modal');
},
openTermsModal(event) {
event.preventDefault();
this.$emit('open-terms-modal');
}
}
};
@@ -399,6 +473,29 @@ export default {
margin-left: 2px;
}
/* Consent field styling */
.consent-text {
line-height: 1.4;
}
.consent-link {
color: #007bff;
text-decoration: underline;
cursor: pointer;
transition: color 0.2s ease;
}
.consent-link:hover {
color: #0056b3;
text-decoration: underline;
}
.consent-link:focus {
outline: 2px solid #007bff;
outline-offset: 2px;
border-radius: 2px;
}
/* Responsive adjustments */
@media (max-width: 768px) {
.form-field {