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;
|
||||
|
||||
@@ -74,6 +74,18 @@
|
||||
$linkStatus = (string) ($link['link_status'] ?? '');
|
||||
$isActive = $linkStatus === 'active';
|
||||
$confidence = $link['confidence'] ?? null;
|
||||
$hasMissingAlert = ($link['has_missing_alert'] ?? false) === true;
|
||||
$missingAlertMessage = trim((string) ($link['missing_alert_message'] ?? ''));
|
||||
if ($missingAlertMessage === '') {
|
||||
$missingAlertMessage = (string) $t('products.links.alerts.missing_remote_link');
|
||||
}
|
||||
$missingAlertFirstDetectedAt = trim((string) ($link['missing_alert_first_detected_at'] ?? ''));
|
||||
$missingAlertTooltip = $missingAlertMessage;
|
||||
if ($missingAlertFirstDetectedAt !== '') {
|
||||
$missingAlertTooltip .= ' ' . (string) $t('products.links.alerts.alert_since', [
|
||||
'date' => $missingAlertFirstDetectedAt,
|
||||
]);
|
||||
}
|
||||
$lastChangeAt = trim((string) ($link['updated_at'] ?? ''));
|
||||
if ($lastChangeAt === '') {
|
||||
$lastChangeAt = trim((string) ($link['linked_at'] ?? ''));
|
||||
@@ -87,9 +99,14 @@
|
||||
<td><?= $e((string) ($link['link_type'] ?? '')) ?></td>
|
||||
<td><?= $e($confidence === null ? '-' : ((string) $confidence . '%')) ?></td>
|
||||
<td>
|
||||
<span class="status-pill<?= $isActive ? ' is-active' : '' ?>">
|
||||
<?= $e($linkStatus) ?>
|
||||
</span>
|
||||
<div class="product-link-status-cell">
|
||||
<span class="status-pill<?= $isActive ? ' is-active' : '' ?>">
|
||||
<?= $e($linkStatus) ?>
|
||||
</span>
|
||||
<?php if ($hasMissingAlert): ?>
|
||||
<span class="product-link-alert-indicator" title="<?= $e($missingAlertTooltip) ?>" aria-label="<?= $e($missingAlertTooltip) ?>">!</span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</td>
|
||||
<td><?= $e($lastChangeAt === '' ? '-' : $lastChangeAt) ?></td>
|
||||
<td>
|
||||
|
||||
@@ -35,7 +35,20 @@
|
||||
<tr><th>ID</th><td><?= $e((string) ($item['id'] ?? '')) ?></td></tr>
|
||||
<tr><th><?= $e($t('products.fields.name')) ?></th><td><?= $e((string) ($item['name'] ?? '')) ?></td></tr>
|
||||
<tr><th>SKU</th><td><?= $e((string) ($item['sku'] ?? '')) ?></td></tr>
|
||||
<tr><th>EAN</th><td><?= $e((string) ($item['ean'] ?? '')) ?></td></tr>
|
||||
<tr>
|
||||
<th>EAN</th>
|
||||
<td>
|
||||
<?php if (trim((string) ($item['ean'] ?? '')) !== ''): ?>
|
||||
<?= $e((string) $item['ean']) ?>
|
||||
<?php else: ?>
|
||||
<span class="muted">—</span>
|
||||
<form method="post" action="/products/<?= $e((string) $productIdValue) ?>/assign-ean" style="display:inline; margin-left:8px;">
|
||||
<input type="hidden" name="_token" value="<?= $e((string) ($csrfToken ?? '')) ?>">
|
||||
<button type="submit" class="btn btn--primary btn--sm"><?= $e($t('products.gs1.assign_ean')) ?></button>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><th><?= $e($t('products.fields.type')) ?></th><td><?= $e((string) ($item['type'] ?? '')) ?></td></tr>
|
||||
<tr><th><?= $e($t('products.fields.status')) ?></th><td><?= $e((string) ($item['status'] ?? '')) ?></td></tr>
|
||||
<tr><th><?= $e($t('products.fields.promoted')) ?></th><td><?= $e((string) ($item['promoted'] ?? '')) ?></td></tr>
|
||||
@@ -53,6 +66,32 @@
|
||||
<tr><th><?= $e($t('products.fields.meta_keywords')) ?></th><td><?= $e((string) ($item['meta_keywords'] ?? '')) ?></td></tr>
|
||||
<tr><th><?= $e($t('products.fields.seo_link')) ?></th><td><?= $e((string) ($item['seo_link'] ?? '')) ?></td></tr>
|
||||
<tr><th><?= $e($t('products.fields.updated_at')) ?></th><td><?= $e((string) ($item['updated_at'] ?? '')) ?></td></tr>
|
||||
<?php if (!empty($item['producer_name'])): ?>
|
||||
<tr><th>Producent</th><td><?= $e((string) $item['producer_name']) ?></td></tr>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($item['security_information'])): ?>
|
||||
<tr>
|
||||
<th>GPSR — informacje o bezpieczeństwie</th>
|
||||
<td><?= $item['security_information'] ?></td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
$customFields = [];
|
||||
if (!empty($item['custom_fields_json'])) {
|
||||
$decoded = json_decode((string) $item['custom_fields_json'], true);
|
||||
$customFields = is_array($decoded) ? $decoded : [];
|
||||
}
|
||||
?>
|
||||
<?php if ($customFields !== []): ?>
|
||||
<tr>
|
||||
<th>Dodatkowe pola</th>
|
||||
<td>
|
||||
<?php foreach ($customFields as $cf): ?>
|
||||
<div><?= $e((string) ($cf['name'] ?? '')) ?> (<?= $e((string) ($cf['type'] ?? '')) ?><?= (int) ($cf['is_required'] ?? 0) === 1 ? ', wymagane' : '' ?>)</div>
|
||||
<?php endforeach; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user