feat(47-shipment-created-automation): immediate shipment automation trigger

Phase 47 complete:

- add event shipment.created triggered immediately after shipment creation

- add action update_shipment_status with real-change guard and chain-safe emit

- update automation UI/options, docs, and PAUL state artifacts
This commit is contained in:
2026-03-28 13:24:20 +01:00
parent d3f4bdaecd
commit ad9087d5e4
17 changed files with 784 additions and 310 deletions

View File

@@ -95,6 +95,20 @@
return html;
}
function buildShipmentStatusActionConfig(namePrefix) {
var html = '<select class="form-control" name="' + namePrefix + '[shipment_status_key]">'
+ '<option value="">-- Wybierz docelowy status przesylki --</option>';
Object.keys(data.shipmentStatusOptions || {}).forEach(function(statusKey) {
var config = data.shipmentStatusOptions[statusKey] || {};
var label = config.label || statusKey;
html += '<option value="' + escapeHtml(statusKey) + '">' + escapeHtml(label) + '</option>';
});
html += '</select>';
return html;
}
function addCondition() {
var idx = getNextIndex(conditionsContainer);
var namePrefix = 'conditions[' + idx + ']';
@@ -129,6 +143,7 @@
+ '<select class="form-control automation-row__type" name="' + namePrefix + '[type]" onchange="window.AutomationForm.onActionTypeChange(this)">'
+ '<option value="send_email" selected>Wyslij e-mail</option>'
+ '<option value="issue_receipt">Wystaw paragon</option>'
+ '<option value="update_shipment_status">Zmiana statusu przesylki</option>'
+ '</select>'
+ '<div class="automation-row__config">'
+ buildEmailActionConfig(namePrefix)
@@ -171,6 +186,10 @@
}
if (select.value === 'issue_receipt') {
configDiv.innerHTML = buildIssueReceiptActionConfig(namePrefix);
return;
}
if (select.value === 'update_shipment_status') {
configDiv.innerHTML = buildShipmentStatusActionConfig(namePrefix);
}
}