feat(92-buyer-name-copy): ikona kopiowania nazwy kupujacego w szczegolach zamowienia

Phase 92 complete:
- SVG clipboard icon przy nazwie w sekcji Dane zamawiajacego
- navigator.clipboard.writeText() z wizualnym feedbackiem (checkmark 1.5s)
- Style .copy-btn-inline i .copy-name-row

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-09 12:14:36 +02:00
parent 854adc32c1
commit 12c400fdc6
9 changed files with 302 additions and 3473 deletions

View File

@@ -285,3 +285,31 @@
max-width: 100%;
}
}
.copy-name-row {
display: flex;
align-items: center;
gap: 6px;
}
.copy-btn-inline {
display: inline-flex;
align-items: center;
justify-content: center;
background: none;
border: none;
padding: 2px;
cursor: pointer;
color: var(--c-text-muted, #999);
border-radius: 3px;
transition: color 0.15s;
flex-shrink: 0;
&:hover {
color: var(--c-primary);
}
.check-icon {
color: var(--c-action-primary);
}
}

View File

@@ -277,7 +277,15 @@ foreach ($addressesList as $address) {
<div class="muted">-</div>
<?php endif; ?>
<?php else: ?>
<div><?= $e((string) ($addr['name'] ?? '')) ?></div>
<div class="<?= $addrType === 'customer' ? 'copy-name-row' : '' ?>">
<?= $e((string) ($addr['name'] ?? '')) ?>
<?php if ($addrType === 'customer' && trim((string) ($addr['name'] ?? '')) !== ''): ?>
<button type="button" class="copy-btn-inline" onclick="copyBuyerName(this, '<?= $e(str_replace("'", "\\'", (string) ($addr['name'] ?? ''))) ?>')" title="Kopiuj">
<svg class="copy-icon" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>
<svg class="check-icon" style="display:none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>
</button>
<?php endif; ?>
</div>
<?php
$invoiceCompanyName = $addrType === 'invoice' ? trim((string) ($addr['company_name'] ?? '')) : '';
$invoiceName = $addrType === 'invoice' ? trim((string) ($addr['name'] ?? '')) : '';
@@ -1079,4 +1087,17 @@ document.querySelectorAll('.form-delete-package').forEach(function(form) {
});
</script>
<script>
function copyBuyerName(btn, text) {
navigator.clipboard.writeText(text).then(function() {
btn.querySelector('.copy-icon').style.display = 'none';
btn.querySelector('.check-icon').style.display = 'inline';
setTimeout(function() {
btn.querySelector('.copy-icon').style.display = '';
btn.querySelector('.check-icon').style.display = 'none';
}, 1500);
});
}
</script>
<?php require __DIR__ . '/partials/email-send-modal.php'; ?>