feat(v1.5): complete phases 40-43 workflow cleanup

This commit is contained in:
2026-03-25 22:46:51 +01:00
parent b8dda81e7b
commit 3610571949
37 changed files with 1557 additions and 259 deletions

View File

@@ -50,54 +50,7 @@
popup.style.left = left + 'px';
popup.style.top = top + 'px';
}, true);
// Bulk print labels
var bulkPrintBtn = document.querySelector('.js-bulk-print-labels');
if (bulkPrintBtn) {
bulkPrintBtn.addEventListener('click', function () {
var checked = document.querySelectorAll('.js-table-select-item:checked');
if (checked.length === 0) {
if (window.OrderProAlerts) {
window.OrderProAlerts.show({ message: 'Zaznacz co najmniej jedno zamowienie.', type: 'warning' });
}
return;
}
var orderIds = [];
checked.forEach(function (cb) { orderIds.push(cb.value); });
var csrf = bulkPrintBtn.getAttribute('data-csrf') || '';
bulkPrintBtn.disabled = true;
bulkPrintBtn.textContent = 'Wysylam...';
fetch('/api/print/jobs/bulk', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ order_ids: orderIds, _token: csrf })
})
.then(function (r) { return r.json(); })
.then(function (data) {
var created = (data.created || []).length;
var skipped = (data.skipped || []).length;
var msg = 'Wyslano ' + created + ' zlecen do drukarki.';
if (skipped > 0) {
msg += ' Pominieto ' + skipped + ' (brak etykiety lub juz w kolejce).';
}
if (window.OrderProAlerts) {
window.OrderProAlerts.show({ message: msg, type: 'success' });
}
bulkPrintBtn.disabled = false;
bulkPrintBtn.textContent = 'Drukuj etykiety';
})
.catch(function () {
if (window.OrderProAlerts) {
window.OrderProAlerts.show({ message: 'Blad sieci — sprobuj ponownie.', type: 'error' });
}
bulkPrintBtn.disabled = false;
bulkPrintBtn.textContent = 'Drukuj etykiety';
});
});
}
})();
</script>

View File

@@ -354,6 +354,25 @@ foreach ($addressesList as $address) {
if ($eventTypeLabel === $eventTypeKey) {
$eventTypeLabel = $eventType;
}
$activitySummary = (string) ($activity['summary'] ?? '');
if ($eventType === 'import') {
$importDetailsRaw = (string) ($activity['details_json'] ?? '');
$importDetails = json_decode($importDetailsRaw, true);
if (is_array($importDetails)) {
$meta = [];
$triggerLabel = trim((string) ($importDetails['trigger_label'] ?? ''));
$sourceUpdatedAt = trim((string) ($importDetails['source_updated_at'] ?? ''));
if ($triggerLabel !== '') {
$meta[] = $triggerLabel;
}
if ($sourceUpdatedAt !== '') {
$meta[] = 'source_updated_at: ' . $sourceUpdatedAt;
}
if ($meta !== []) {
$activitySummary .= ' [' . implode('; ', $meta) . ']';
}
}
}
$actorType = (string) ($activity['actor_type'] ?? 'system');
$actorName = trim((string) ($activity['actor_name'] ?? ''));
if ($actorName !== '') {
@@ -369,7 +388,7 @@ foreach ($addressesList as $address) {
<tr>
<td class="text-nowrap"><?= $e((string) ($activity['created_at'] ?? '')) ?></td>
<td><span class="activity-type-badge activity-type-badge--<?= $e($eventType) ?>"><?= $e($eventTypeLabel) ?></span></td>
<td><?= $e((string) ($activity['summary'] ?? '')) ?></td>
<td><?= $e($activitySummary) ?></td>
<td class="muted"><?= $e($actorLabel) ?></td>
</tr>
<?php endforeach; ?>