added new preorderiframe
This commit is contained in:
@@ -285,6 +285,41 @@
|
||||
<small>Für Begleitschreiben - Status 145</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="iframe_origins">IFrame Origins</label>
|
||||
<div class="col-lg-10">
|
||||
<div id="iframe-origins-container">
|
||||
<!-- Dynamic inputs will be added here -->
|
||||
</div>
|
||||
<button type="button" class="btn btn-sm btn-success mt-2" id="add-iframe-origin">
|
||||
<i class="fas fa-plus"></i> Origin URL
|
||||
</button>
|
||||
<input type="hidden" name="iframe_origins" id="iframe_origins" value=""/>
|
||||
<small class="form-text text-muted">
|
||||
URL's wo der Bestell-Iframe eingebunden werden darf.<br/>
|
||||
Beispiel: https://partner-a.com, https://partner-b.de<br/>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- IFrame Consents -->
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="iframe_consents">IFrame Consents</label>
|
||||
<div class="col-lg-10">
|
||||
<div id="iframe-consents-container">
|
||||
<!-- Dynamic inputs will be added here -->
|
||||
</div>
|
||||
<button type="button" class="btn btn-sm btn-success mt-2" id="add-iframe-consent">
|
||||
<i class="fas fa-plus"></i> Zustimmung
|
||||
</button>
|
||||
<input type="hidden" name="iframe_consents" id="iframe_consents" value=""/>
|
||||
<small class="form-text text-muted">
|
||||
Zusätzliche Custom Zustimmungen mit Verlinkung
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -702,4 +737,177 @@
|
||||
}
|
||||
<?php endif; ?>
|
||||
</script>
|
||||
|
||||
<!--IFRAME SCRIPT PARTS-->
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// Initialize with existing data
|
||||
let iframeOrigins = <?= $campaign->iframe_origins ?? '[]'; ?>;
|
||||
let iframeConsents = <?= $campaign->iframe_consents ?? '[]'; ?>;
|
||||
|
||||
// IFrame Origins Management
|
||||
function renderIframeOrigins() {
|
||||
const container = $('#iframe-origins-container');
|
||||
container.empty();
|
||||
|
||||
iframeOrigins.forEach((origin, index) => {
|
||||
const row = $(`
|
||||
<div class="input-group mb-2">
|
||||
<input type="text" class="form-control iframe-origin-input"
|
||||
placeholder="https://example.com" value="${origin}" data-index="${index}">
|
||||
<div class="input-group-append">
|
||||
<button type="button" class="btn btn-outline-danger remove-iframe-origin" data-index="${index}">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
container.append(row);
|
||||
});
|
||||
|
||||
updateIframeOriginsInput();
|
||||
}
|
||||
|
||||
function updateIframeOriginsInput() {
|
||||
$('#iframe_origins').val(JSON.stringify(iframeOrigins));
|
||||
}
|
||||
|
||||
// Add new iframe origin
|
||||
$('#add-iframe-origin').click(function() {
|
||||
iframeOrigins.push('');
|
||||
renderIframeOrigins();
|
||||
});
|
||||
|
||||
// Remove iframe origin
|
||||
$(document).on('click', '.remove-iframe-origin', function() {
|
||||
const index = $(this).data('index');
|
||||
iframeOrigins.splice(index, 1);
|
||||
renderIframeOrigins();
|
||||
});
|
||||
|
||||
// Update iframe origin value
|
||||
$(document).on('input', '.iframe-origin-input', function() {
|
||||
const index = $(this).data('index');
|
||||
const value = $(this).val();
|
||||
iframeOrigins[index] = value;
|
||||
updateIframeOriginsInput();
|
||||
});
|
||||
|
||||
// IFrame Consents Management
|
||||
function renderIframeConsents() {
|
||||
const container = $('#iframe-consents-container');
|
||||
container.empty();
|
||||
|
||||
iframeConsents.forEach((consent, index) => {
|
||||
const row = $(`
|
||||
<div class="card mb-2">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">URL</label>
|
||||
<input type="text" class="form-control iframe-consent-url"
|
||||
placeholder="https://partner.com" value="${consent.url || ''}" data-index="${index}">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Text</label>
|
||||
<input type="text" class="form-control iframe-consent-text"
|
||||
placeholder="Text" value="${consent.text || ''}" data-index="${index}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-2">
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">URL Replacer</label>
|
||||
<input type="text" class="form-control iframe-consent-replace"
|
||||
placeholder="Consent" value="${consent.replace || ''}" data-index="${index}">
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-check mt-4">
|
||||
<input type="checkbox" class="form-check-input iframe-consent-required"
|
||||
id="consent-required-${index}" data-index="${index}" ${consent.required ? 'checked' : ''}>
|
||||
<label class="form-check-label" for="consent-required-${index}">
|
||||
Erforderlich?
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<button type="button" class="btn btn-outline-danger btn-sm mt-4 remove-iframe-consent" data-index="${index}">
|
||||
<i class="fas fa-trash"></i> Entfernen
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
container.append(row);
|
||||
});
|
||||
|
||||
updateIframeConsentsInput();
|
||||
}
|
||||
|
||||
function updateIframeConsentsInput() {
|
||||
$('#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 value = $(this).val();
|
||||
iframeConsents[index].url = value;
|
||||
updateIframeConsentsInput();
|
||||
});
|
||||
|
||||
$(document).on('input', '.iframe-consent-text', function() {
|
||||
const index = $(this).data('index');
|
||||
const value = $(this).val();
|
||||
iframeConsents[index].text = value;
|
||||
updateIframeConsentsInput();
|
||||
});
|
||||
|
||||
$(document).on('input', '.iframe-consent-replace', function() {
|
||||
const index = $(this).data('index');
|
||||
const value = $(this).val();
|
||||
iframeConsents[index].replace = value;
|
||||
updateIframeConsentsInput();
|
||||
});
|
||||
|
||||
$(document).on('change', '.iframe-consent-required', function() {
|
||||
const index = $(this).data('index');
|
||||
const checked = $(this).is(':checked');
|
||||
iframeConsents[index].required = checked;
|
||||
updateIframeConsentsInput();
|
||||
});
|
||||
|
||||
// Initial render
|
||||
renderIframeOrigins();
|
||||
renderIframeConsents();
|
||||
|
||||
// Add at least one empty entry if none exist
|
||||
if (iframeOrigins.length === 0) {
|
||||
$('#add-iframe-origin').click();
|
||||
}
|
||||
|
||||
if (iframeConsents.length === 0) {
|
||||
$('#add-iframe-consent').click();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|
||||
Reference in New Issue
Block a user