diff --git a/Layout/default/Preordercampaign/Form.php b/Layout/default/Preordercampaign/Form.php index 50eea4278..4482513bd 100644 --- a/Layout/default/Preordercampaign/Form.php +++ b/Layout/default/Preordercampaign/Form.php @@ -305,18 +305,27 @@
- +
-
- +
+
+ +
+
+
+
+ +
+ + + Zustimmungen für verschiedene Bereiche konfigurieren + +
+
- - - - Zusätzliche Custom Zustimmungen mit Verlinkung -
@@ -743,9 +752,50 @@ $(document).ready(function() { // Initialize with existing data let iframeOrigins = iframe_origins ?? '[]'; ?>; - let iframeConsents = iframe_consents ?? '[]'; ?>; + let iframeConsents = iframe_consents ?? '{}'; ?>; - // IFrame Origins Management + console.log(iframeConsents); + + // Predefined consent types with default texts + const consentTypes = { + 'agb': { + 'label': 'Zustimmung AGB', + required: true, + 'defaultText': 'Ich habe mich über die wesentlichen Vertragsinhalte lt. Vertragsbedingungen Glasfaseranschluss informiert und akzeptiere die Allgemeinen Geschäftsbedingungen.' + }, + 'dsgvo': { + 'label': 'Zustimmung DSGVO', + required: true, + 'defaultText': 'Ich habe die Information zur Datenschutzgrundverordnung (DSGVO) zur Kenntnis genommen. Diese ist jederzeit im Downloadbereich abrufbar.' + }, + 'ruecktrittsrecht': { + 'label': 'Zustimmung Rücktrittsrecht', + required: true, + 'defaultText': 'Ich habe die Information über die Rücktrittsrechte für Verbraucher gemäß §3 KSchG und §§ 11 FAGG erhalten, gelesen und zur Kenntnis genommen.' + }, + 'datenweitergabe': { + 'label': 'Zustimmung Datenweitergabe', + 'defaultText': 'Ich stimme zu, dass meine Daten zur telefonischen Kontaktaufnahme, sowie für die postalische und elektronische Zusendung von Produkt- und Dienstleistungs-Informationen bzw. für Marketingaktivitäten an verbundene Unternehmen übermittelt werden. Diese Zustimmungserklärung kann jederzeit widerrufen werden.' + }, + 'grabungsarbeiten': { + 'label': 'Zustimmung Grabungsarbeiten', + 'defaultText': 'Ich stimme den notwendigen Grabungsarbeiten für die Installation des Glasfaseranschlusses zu.' + } + }; + + // Ensure iframeConsents is an object with all consent types + Object.keys(consentTypes).forEach(key => { + if (!iframeConsents[key]) { + iframeConsents[key] = { + url: consentTypes[key].defaultURL || '', + text: consentTypes[key].defaultText, + required: consentTypes[key].required || false, + replace: consentTypes[key].defaultReplacer || '' + }; + } + }); + + // IFrame Origins Management (unchanged) function renderIframeOrigins() { const container = $('#iframe-origins-container'); container.empty(); @@ -793,46 +843,57 @@ updateIframeOriginsInput(); }); - // IFrame Consents Management + + + // IFrame Consents Management (modified for predefined types) function renderIframeConsents() { const container = $('#iframe-consents-container'); container.empty(); - iframeConsents.forEach((consent, index) => { + Object.keys(consentTypes).forEach(consentKey => { + const consent = iframeConsents[consentKey]; + const consentConfig = consentTypes[consentKey]; + const row = $(` -
+
+
+
${consentConfig.label}
+
+ placeholder="https://partner.com" value="${consent.url || ''}" data-consent="${consentKey}">
- - -
-
-
-
+ placeholder="Consent" value="${consent.replace || 'Consent'}" data-consent="${consentKey}"> +
+
+
+
+ +
-
-
-
- + +
+ + +
@@ -845,53 +906,43 @@ } function updateIframeConsentsInput() { + console.log('json result', JSON.stringify(iframeConsents)); $('#iframe_consents').val(JSON.stringify(iframeConsents)); } - // Add new iframe consent - $('#add-iframe-consent').click(function() { - iframeConsents.push({ - url: '', - text: '', - required: false, - replace: 'Consent' - }); - renderIframeConsents(); - }); - - // Remove iframe consent - $(document).on('click', '.remove-iframe-consent', function() { - const index = $(this).data('index'); - iframeConsents.splice(index, 1); - renderIframeConsents(); - }); - // Update iframe consent values $(document).on('input', '.iframe-consent-url', function() { - const index = $(this).data('index'); + const consentKey = $(this).data('consent'); const value = $(this).val(); - iframeConsents[index].url = value; + iframeConsents[consentKey].url = value; updateIframeConsentsInput(); }); $(document).on('input', '.iframe-consent-text', function() { - const index = $(this).data('index'); + const consentKey = $(this).data('consent'); const value = $(this).val(); - iframeConsents[index].text = value; + iframeConsents[consentKey].text = value; updateIframeConsentsInput(); }); $(document).on('input', '.iframe-consent-replace', function() { - const index = $(this).data('index'); + const consentKey = $(this).data('consent'); const value = $(this).val(); - iframeConsents[index].replace = value; + iframeConsents[consentKey].replace = value; updateIframeConsentsInput(); }); $(document).on('change', '.iframe-consent-required', function() { - const index = $(this).data('index'); + const consentKey = $(this).data('consent'); const checked = $(this).is(':checked'); - iframeConsents[index].required = checked; + iframeConsents[consentKey].required = checked; + updateIframeConsentsInput(); + }); + + $(document).on('change', '.iframe-consent-activated', function() { + const consentKey = $(this).data('consent'); + const checked = $(this).is(':checked'); + iframeConsents[consentKey].activated = checked; updateIframeConsentsInput(); }); @@ -899,15 +950,20 @@ renderIframeOrigins(); renderIframeConsents(); - // Add at least one empty entry if none exist + // Add at least one empty entry if none exist for origins if (iframeOrigins.length === 0) { $('#add-iframe-origin').click(); } - if (iframeConsents.length === 0) { - $('#add-iframe-consent').click(); - } + // Handle collapse icon rotation + $('#iframe-consents-collapse').on('show.bs.collapse', function () { + $('#iframe-consents-icon').removeClass('fa-chevron-right').addClass('fa-chevron-down'); + }); + + $('#iframe-consents-collapse').on('hide.bs.collapse', function () { + $('#iframe-consents-icon').removeClass('fa-chevron-down').addClass('fa-chevron-right'); + }); }); - + \ No newline at end of file diff --git a/Layout/default/VueViews/PreorderIFrame.php b/Layout/default/VueViews/PreorderIFrame.php index 8059cb311..b867d1fdb 100644 --- a/Layout/default/VueViews/PreorderIFrame.php +++ b/Layout/default/VueViews/PreorderIFrame.php @@ -9,7 +9,9 @@ Bestellformular - + + +