update
This commit is contained in:
@@ -49,6 +49,37 @@
|
||||
return html;
|
||||
}
|
||||
|
||||
function buildPaymentStatusCheckboxes(namePrefix) {
|
||||
var html = '<div class="checkbox-group">';
|
||||
Object.keys(data.paymentStatusOptions || {}).forEach(function(statusKey) {
|
||||
var label = data.paymentStatusOptions[statusKey] || statusKey;
|
||||
html += '<label class="checkbox-label">'
|
||||
+ '<input type="checkbox" name="' + namePrefix + '[payment_status_keys][]" value="' + escapeHtml(statusKey) + '"> '
|
||||
+ escapeHtml(label)
|
||||
+ '</label>';
|
||||
});
|
||||
html += '</div>';
|
||||
return html;
|
||||
}
|
||||
|
||||
function buildOrderStatusCheckboxes(namePrefix) {
|
||||
var html = '<div class="checkbox-group">';
|
||||
(data.orderStatusOptions || []).forEach(function(statusOption) {
|
||||
var code = (statusOption.code || '').toLowerCase().trim();
|
||||
var label = statusOption.name || code;
|
||||
html += '<label class="checkbox-label">'
|
||||
+ '<input type="checkbox" name="' + namePrefix + '[order_status_codes][]" value="' + escapeHtml(code) + '"> '
|
||||
+ escapeHtml(label)
|
||||
+ '</label>';
|
||||
});
|
||||
html += '</div>';
|
||||
return html;
|
||||
}
|
||||
|
||||
function buildDaysInStatusInput(namePrefix) {
|
||||
return '<input type="number" min="1" step="1" class="form-control" name="' + namePrefix + '[days]" placeholder="Liczba dni">';
|
||||
}
|
||||
|
||||
function buildEmailActionConfig(namePrefix) {
|
||||
var html = '<select class="form-control" name="' + namePrefix + '[template_id]">'
|
||||
+ '<option value="">-- Wybierz szablon --</option>';
|
||||
@@ -135,6 +166,9 @@
|
||||
+ '<select class="form-control automation-row__type" name="' + namePrefix + '[type]" onchange="window.AutomationForm.onConditionTypeChange(this)">'
|
||||
+ '<option value="integration" selected>Integracja (kanal sprzedazy)</option>'
|
||||
+ '<option value="shipment_status">Status przesylki</option>'
|
||||
+ '<option value="payment_status">Status platnosci</option>'
|
||||
+ '<option value="order_status">Status zamowienia</option>'
|
||||
+ '<option value="days_in_status">Liczba dni w statusie</option>'
|
||||
+ '</select>'
|
||||
+ '<div class="automation-row__config">'
|
||||
+ buildIntegrationCheckboxes(namePrefix)
|
||||
@@ -186,6 +220,18 @@
|
||||
}
|
||||
if (select.value === 'shipment_status') {
|
||||
configDiv.innerHTML = buildShipmentStatusCheckboxes(namePrefix);
|
||||
return;
|
||||
}
|
||||
if (select.value === 'payment_status') {
|
||||
configDiv.innerHTML = buildPaymentStatusCheckboxes(namePrefix);
|
||||
return;
|
||||
}
|
||||
if (select.value === 'order_status') {
|
||||
configDiv.innerHTML = buildOrderStatusCheckboxes(namePrefix);
|
||||
return;
|
||||
}
|
||||
if (select.value === 'days_in_status') {
|
||||
configDiv.innerHTML = buildDaysInStatusInput(namePrefix);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user