update
This commit is contained in:
@@ -18,6 +18,7 @@ $statusSyncIntervalMinutes = max(1, (int) ($statusSyncIntervalMinutes ?? 15));
|
||||
$statusMappings = is_array($statusMappings ?? null) ? $statusMappings : [];
|
||||
$orderproStatuses = is_array($orderproStatuses ?? null) ? $orderproStatuses : [];
|
||||
$allegroStatuses = is_array($allegroStatuses ?? null) ? $allegroStatuses : [];
|
||||
$pullStatusMappings = is_array($pullStatusMappings ?? null) ? $pullStatusMappings : [];
|
||||
$allegroMappingIndex = [];
|
||||
foreach ($statusMappings as $m) {
|
||||
$opCode = strtolower(trim((string) ($m['orderpro_status_code'] ?? '')));
|
||||
@@ -25,6 +26,13 @@ foreach ($statusMappings as $m) {
|
||||
$allegroMappingIndex[$opCode] = $m;
|
||||
}
|
||||
}
|
||||
$pullMappingIndex = [];
|
||||
foreach ($pullStatusMappings as $pm) {
|
||||
$aCode = strtolower(trim((string) ($pm['allegro_status_code'] ?? '')));
|
||||
if ($aCode !== '') {
|
||||
$pullMappingIndex[$aCode] = $pm;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<section class="card">
|
||||
@@ -216,6 +224,68 @@ foreach ($statusMappings as $m) {
|
||||
<?php endif; ?>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<section class="mt-24">
|
||||
<h3 class="section-title"><?= $e($t('settings.allegro.statuses.pull_title')) ?></h3>
|
||||
<p class="muted mt-12"><?= $e($t('settings.allegro.statuses.pull_description')) ?></p>
|
||||
|
||||
<form action="/settings/integrations/allegro/statuses/save-pull" method="post" class="mt-12">
|
||||
<input type="hidden" name="_token" value="<?= $e($csrfToken ?? '') ?>">
|
||||
<div class="table-wrap mt-12">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?= $e($t('settings.allegro.statuses.fields.allegro_status')) ?></th>
|
||||
<th><?= $e($t('settings.allegro.statuses.fields.orderpro_status_code')) ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if ($pullStatusMappings === []): ?>
|
||||
<tr>
|
||||
<td colspan="2" class="muted"><?= $e($t('settings.allegro.statuses.empty')) ?></td>
|
||||
</tr>
|
||||
<?php else: ?>
|
||||
<?php foreach ($pullStatusMappings as $pullMapping): ?>
|
||||
<?php
|
||||
$aCode = strtolower(trim((string) ($pullMapping['allegro_status_code'] ?? '')));
|
||||
if ($aCode === '') continue;
|
||||
$aName = (string) ($pullMapping['allegro_status_name'] ?? '');
|
||||
$selectedOrderproCode = strtolower(trim((string) ($pullMapping['orderpro_status_code'] ?? '')));
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<?= $e($aName !== '' ? $aName : $aCode) ?> <code class="muted"><?= $e($aCode) ?></code>
|
||||
<input type="hidden" name="allegro_status_code[]" value="<?= $e($aCode) ?>">
|
||||
<input type="hidden" name="allegro_status_name[]" value="<?= $e($aName) ?>">
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" name="orderpro_status_code[]">
|
||||
<option value=""><?= $e($t('settings.order_statuses.fields.no_mapping')) ?></option>
|
||||
<?php foreach ($orderproStatuses as $opStatus): ?>
|
||||
<?php
|
||||
$opCode = strtolower(trim((string) ($opStatus['code'] ?? '')));
|
||||
$opName = (string) ($opStatus['name'] ?? $opCode);
|
||||
if ($opCode === '') continue;
|
||||
?>
|
||||
<option value="<?= $e($opCode) ?>"<?= $selectedOrderproCode === $opCode ? ' selected' : '' ?>>
|
||||
<?= $e($opName) ?> (<?= $e($opCode) ?>)
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php if ($pullStatusMappings !== []): ?>
|
||||
<div class="form-actions mt-12">
|
||||
<button type="submit" class="btn btn--primary"><?= $e($t('settings.allegro.statuses.actions.save_bulk')) ?></button>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</form>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<div class="content-tab-panel<?= $activeTab === 'settings' ? ' is-active' : '' ?>" data-tab-panel="allegro-tab-settings">
|
||||
|
||||
Reference in New Issue
Block a user