This commit is contained in:
2026-04-22 22:54:26 +02:00
parent cd1ea4a9db
commit c73b2fe9f6
26 changed files with 1377 additions and 34 deletions

View File

@@ -2,6 +2,7 @@
$providersList = is_array($providers ?? null) ? $providers : [];
$mappingsList = is_array($mappings ?? null) ? $mappings : [];
$normalizedOptionsList = is_array($normalizedOptions ?? null) ? $normalizedOptions : [];
$unmappedList = is_array($unmappedRawStatuses ?? null) ? $unmappedRawStatuses : [];
$currentProvider = (string) ($provider ?? 'inpost');
?>
@@ -18,6 +19,66 @@ $currentProvider = (string) ($provider ?? 'inpost');
<?php endif; ?>
</section>
<?php if ($unmappedList !== []): ?>
<section class="card mt-16 dsm-unmapped">
<h2 class="section-title">Niezmapowane statusy wykryte w systemie (<?= count($unmappedList) ?>)</h2>
<p class="muted mt-8">Statusy odebrane z API przewoźnika <strong><?= $e((string) ($providersList[$currentProvider] ?? $currentProvider)) ?></strong>, dla których nie ma jeszcze mapowania. Przypisz znormalizowany status, aby paczki przestały być oznaczane jako „Nieznany".</p>
<form action="/settings/delivery-status-mappings/save-bulk" method="post" class="mt-12">
<input type="hidden" name="_token" value="<?= $e($csrfToken ?? '') ?>">
<input type="hidden" name="provider" value="<?= $e($currentProvider) ?>">
<div class="table-wrapper">
<table class="table table--compact">
<thead>
<tr>
<th>Status surowy</th>
<th>Liczba paczek</th>
<th>Ostatnio widziany</th>
<th>Opis (własny)</th>
<th>Status znormalizowany</th>
</tr>
</thead>
<tbody>
<?php foreach ($unmappedList as $unmapped): ?>
<?php
$rawStatus = (string) ($unmapped['raw_status'] ?? '');
$count = (int) ($unmapped['count'] ?? 0);
$lastSeen = (string) ($unmapped['last_seen'] ?? '');
?>
<tr>
<td>
<code class="dsm-raw-status"><?= $e($rawStatus) ?></code>
<input type="hidden" name="raw_status[]" value="<?= $e($rawStatus) ?>">
</td>
<td><?= $count ?></td>
<td><?= $e($lastSeen) ?></td>
<td>
<input type="text" name="description[]" class="form-control form-control--sm"
value="<?= $e($rawStatus) ?>" maxlength="255">
</td>
<td>
<select name="normalized_status[]" class="form-control form-control--sm" required>
<?php foreach ($normalizedOptionsList as $optValue => $optLabel): ?>
<option value="<?= $e($optValue) ?>"<?= $optValue === 'unknown' ? ' selected' : '' ?>>
<?= $e($optLabel) ?>
</option>
<?php endforeach; ?>
</select>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<div class="form-actions mt-12">
<button type="submit" class="btn btn--primary">Dodaj do mapowania</button>
</div>
</form>
</section>
<?php endif; ?>
<section class="card mt-16">
<nav class="content-tabs-nav" aria-label="Wybierz przewoźnika">
<?php foreach ($providersList as $provKey => $provLabel): ?>