This commit is contained in:
2026-03-28 15:04:35 +01:00
parent c1d0d7762f
commit 2ab0d0e90e
44 changed files with 3027 additions and 493 deletions

View File

@@ -30,6 +30,7 @@ $receiptDuplicatePolicyLabels = [
'allow_duplicates' => 'Wystawiaj kolejne paragony',
];
$shipmentStatusOptions = is_array($shipmentStatusOptions ?? null) ? $shipmentStatusOptions : [];
$orderStatusOptions = is_array($orderStatusOptions ?? null) ? $orderStatusOptions : [];
?>
<section class="card">
@@ -127,6 +128,7 @@ $shipmentStatusOptions = is_array($shipmentStatusOptions ?? null) ? $shipmentSta
<option value="send_email"<?= ((string) ($act['action_type'] ?? '')) === 'send_email' ? ' selected' : '' ?>>Wyslij e-mail</option>
<option value="issue_receipt"<?= ((string) ($act['action_type'] ?? '')) === 'issue_receipt' ? ' selected' : '' ?>>Wystaw paragon</option>
<option value="update_shipment_status"<?= ((string) ($act['action_type'] ?? '')) === 'update_shipment_status' ? ' selected' : '' ?>>Zmiana statusu przesylki</option>
<option value="update_order_status"<?= ((string) ($act['action_type'] ?? '')) === 'update_order_status' ? ' selected' : '' ?>>Zmiana statusu zamowienia</option>
</select>
<div class="automation-row__config">
<?php
@@ -168,6 +170,19 @@ $shipmentStatusOptions = is_array($shipmentStatusOptions ?? null) ? $shipmentSta
</option>
<?php endforeach; ?>
</select>
<?php elseif ($actionType === 'update_order_status'): ?>
<select class="form-control" name="actions[<?= $idx ?>][order_status_code]">
<option value="">-- Wybierz docelowy status zamowienia --</option>
<?php foreach ($orderStatusOptions as $statusOption): ?>
<?php
$statusCode = (string) ($statusOption['code'] ?? '');
$statusName = (string) ($statusOption['name'] ?? $statusCode);
?>
<option value="<?= $e($statusCode) ?>"<?= ((string) ($actConfig['status_code'] ?? '')) === $statusCode ? ' selected' : '' ?>>
<?= $e($statusName) ?>
</option>
<?php endforeach; ?>
</select>
<?php else: ?>
<select class="form-control" name="actions[<?= $idx ?>][template_id]">
<option value="">-- Wybierz szablon --</option>
@@ -217,7 +232,13 @@ window.AutomationFormData = {
receiptIssueDateModeLabels: <?= json_encode($receiptIssueDateModeLabels, JSON_UNESCAPED_UNICODE) ?>,
receiptDuplicatePolicies: <?= json_encode($receiptDuplicatePolicies, JSON_UNESCAPED_UNICODE) ?>,
receiptDuplicatePolicyLabels: <?= json_encode($receiptDuplicatePolicyLabels, JSON_UNESCAPED_UNICODE) ?>,
shipmentStatusOptions: <?= json_encode($shipmentStatusOptions, JSON_UNESCAPED_UNICODE) ?>
shipmentStatusOptions: <?= json_encode($shipmentStatusOptions, JSON_UNESCAPED_UNICODE) ?>,
orderStatusOptions: <?= json_encode(array_map(function($status) {
return [
'code' => (string) ($status['code'] ?? ''),
'name' => (string) ($status['name'] ?? '')
];
}, $orderStatusOptions), JSON_UNESCAPED_UNICODE) ?>
};
</script>
<script src="/assets/js/modules/automation-form.js"></script>