Add initial HTML template for MojeGS1 application with Cookiebot and Google Analytics integration
This commit is contained in:
@@ -68,11 +68,11 @@ $integrations = is_array($shopProIntegrations ?? null) ? $shopProIntegrations :
|
||||
<div class="form-field">
|
||||
<span class="field-label"><?= $e($t('products.import.mode')) ?></span>
|
||||
<label class="field-inline">
|
||||
<input type="radio" name="import_mode" value="all" checked>
|
||||
<input type="radio" name="import_mode" value="all">
|
||||
<?= $e($t('products.import.mode_all')) ?>
|
||||
</label>
|
||||
<label class="field-inline">
|
||||
<input type="radio" name="import_mode" value="single">
|
||||
<input type="radio" name="import_mode" value="single" checked>
|
||||
<?= $e($t('products.import.mode_single')) ?>
|
||||
</label>
|
||||
</div>
|
||||
@@ -97,6 +97,58 @@ $integrations = is_array($shopProIntegrations ?? null) ? $shopProIntegrations :
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-backdrop" data-modal-backdrop="product-export-modal" hidden>
|
||||
<div class="modal" role="dialog" aria-modal="true" aria-labelledby="product-export-modal-title">
|
||||
<div class="modal__header">
|
||||
<h3 id="product-export-modal-title"><?= $e($t('products.export.title')) ?></h3>
|
||||
<button type="button" class="btn btn--secondary" data-close-modal="product-export-modal"><?= $e($t('products.export.close')) ?></button>
|
||||
</div>
|
||||
|
||||
<form action="/products/export/shoppro" method="post" class="modal__body" data-export-form>
|
||||
<input type="hidden" name="_token" value="<?= $e($csrfToken ?? '') ?>">
|
||||
|
||||
<label class="form-field">
|
||||
<span class="field-label"><?= $e($t('products.export.integration')) ?></span>
|
||||
<select class="form-control" name="integration_id" required>
|
||||
<option value=""><?= $e($t('products.export.integration_placeholder')) ?></option>
|
||||
<?php foreach ($integrations as $integration): ?>
|
||||
<option value="<?= $e((string) ($integration['id'] ?? 0)) ?>">
|
||||
<?= $e((string) ($integration['name'] ?? '')) ?> (ID: <?= $e((string) ($integration['id'] ?? 0)) ?>)
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</label>
|
||||
<?php if (empty($integrations)): ?>
|
||||
<p class="muted"><?= $e($t('products.export.no_integrations')) ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="form-field">
|
||||
<span class="field-label"><?= $e($t('products.export.mode')) ?></span>
|
||||
<label class="field-inline">
|
||||
<input type="radio" name="export_mode" value="simple" checked>
|
||||
<?= $e($t('products.export.mode_simple')) ?>
|
||||
</label>
|
||||
<label class="field-inline">
|
||||
<input type="radio" name="export_mode" value="variant">
|
||||
<?= $e($t('products.export.mode_variant')) ?>
|
||||
</label>
|
||||
<small class="muted"><?= $e($t('products.export.mode_hint')) ?></small>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<span class="field-label"><?= $e($t('products.export.selected_count_label')) ?>: <strong data-export-selected-count>0</strong></span>
|
||||
<small class="muted"><?= $e($t('products.export.selected_hint')) ?></small>
|
||||
</div>
|
||||
|
||||
<div data-export-selected-wrap></div>
|
||||
|
||||
<div class="form-actions mt-16">
|
||||
<button type="submit" class="btn btn--primary"<?= empty($integrations) ? ' disabled' : '' ?>><?= $e($t('products.export.submit')) ?></button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function() {
|
||||
var openBtn = document.querySelector('[data-open-modal="product-import-modal"]');
|
||||
@@ -109,7 +161,7 @@ $integrations = is_array($shopProIntegrations ?? null) ? $shopProIntegrations :
|
||||
var singleIdInput = backdrop.querySelector('[data-single-id-input]');
|
||||
|
||||
function syncMode() {
|
||||
var mode = 'all';
|
||||
var mode = 'single';
|
||||
modeInputs.forEach(function(input) {
|
||||
if (input.checked) mode = input.value;
|
||||
});
|
||||
@@ -142,6 +194,70 @@ $integrations = is_array($shopProIntegrations ?? null) ? $shopProIntegrations :
|
||||
});
|
||||
})();
|
||||
|
||||
(function() {
|
||||
var openBtn = document.querySelector('[data-open-modal="product-export-modal"]');
|
||||
var backdrop = document.querySelector('[data-modal-backdrop="product-export-modal"]');
|
||||
var closeBtn = document.querySelector('[data-close-modal="product-export-modal"]');
|
||||
var exportForm = backdrop ? backdrop.querySelector('[data-export-form]') : null;
|
||||
var selectedWrap = backdrop ? backdrop.querySelector('[data-export-selected-wrap]') : null;
|
||||
var selectedCount = backdrop ? backdrop.querySelector('[data-export-selected-count]') : null;
|
||||
|
||||
if (!openBtn || !backdrop || !closeBtn || !exportForm || !selectedWrap || !selectedCount) return;
|
||||
|
||||
function selectedIds() {
|
||||
return Array.prototype.slice.call(document.querySelectorAll('.js-table-select-item:checked'))
|
||||
.map(function(input) { return (input.value || '').trim(); })
|
||||
.filter(function(value) { return value !== ''; });
|
||||
}
|
||||
|
||||
function renderSelectedIds(ids) {
|
||||
selectedWrap.innerHTML = '';
|
||||
ids.forEach(function(id) {
|
||||
var input = document.createElement('input');
|
||||
input.type = 'hidden';
|
||||
input.name = 'export_product_ids[]';
|
||||
input.value = id;
|
||||
selectedWrap.appendChild(input);
|
||||
});
|
||||
selectedCount.textContent = String(ids.length);
|
||||
}
|
||||
|
||||
function showNoSelectionMessage() {
|
||||
var message = '<?= $e($t('products.export.flash.no_products_selected')) ?>';
|
||||
if (window.OrderProAlerts && typeof window.OrderProAlerts.show === 'function') {
|
||||
window.OrderProAlerts.show({ type: 'error', message: message, timeout: 2500 });
|
||||
return;
|
||||
}
|
||||
window.alert(message);
|
||||
}
|
||||
|
||||
openBtn.addEventListener('click', function() {
|
||||
renderSelectedIds(selectedIds());
|
||||
backdrop.hidden = false;
|
||||
});
|
||||
|
||||
closeBtn.addEventListener('click', function() {
|
||||
backdrop.hidden = true;
|
||||
});
|
||||
|
||||
backdrop.addEventListener('click', function(event) {
|
||||
if (event.target === backdrop) {
|
||||
backdrop.hidden = true;
|
||||
}
|
||||
});
|
||||
|
||||
exportForm.addEventListener('submit', function(event) {
|
||||
var ids = selectedIds();
|
||||
renderSelectedIds(ids);
|
||||
if (ids.length > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
showNoSelectionMessage();
|
||||
});
|
||||
})();
|
||||
|
||||
(function() {
|
||||
var previewBackdrop = document.querySelector('[data-modal-backdrop="product-image-preview-modal"]');
|
||||
if (!previewBackdrop) return;
|
||||
|
||||
Reference in New Issue
Block a user