feat: Add registry lookup explanation to admin membership detail
- Add info box explaining how NIP→KRS lookup works - Show real-time status during lookup (Biała Lista → KRS Open API) - Consistent UI with user-facing membership form Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
61ecc9c8d5
commit
1f806b66b0
@ -320,6 +320,58 @@
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
.lookup-status {
|
||||
margin-top: var(--spacing-sm);
|
||||
padding: var(--spacing-sm) var(--spacing-md);
|
||||
border-radius: var(--radius);
|
||||
font-size: var(--font-size-sm);
|
||||
}
|
||||
|
||||
.lookup-status.loading {
|
||||
background: rgba(59, 130, 246, 0.1);
|
||||
color: #3b82f6;
|
||||
}
|
||||
|
||||
.lookup-status.success {
|
||||
background: var(--success-light);
|
||||
color: var(--success);
|
||||
}
|
||||
|
||||
.lookup-status.error {
|
||||
background: var(--error-light);
|
||||
color: var(--error);
|
||||
}
|
||||
|
||||
.registry-info-box {
|
||||
margin: var(--spacing-md) 0;
|
||||
padding: var(--spacing-md);
|
||||
background: rgba(59, 130, 246, 0.05);
|
||||
border: 1px solid rgba(59, 130, 246, 0.2);
|
||||
border-radius: var(--radius);
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.registry-info-box strong {
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.registry-info-box ul {
|
||||
margin: var(--spacing-sm) 0;
|
||||
padding-left: var(--spacing-lg);
|
||||
}
|
||||
|
||||
.registry-info-box li {
|
||||
margin-bottom: var(--spacing-xs);
|
||||
}
|
||||
|
||||
.registry-info-box small {
|
||||
display: block;
|
||||
margin-top: var(--spacing-sm);
|
||||
font-style: italic;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.registry-result {
|
||||
margin-top: var(--spacing-md);
|
||||
padding: var(--spacing-md);
|
||||
@ -445,7 +497,17 @@
|
||||
</svg>
|
||||
Pobierz aktualne dane z KRS/CEIDG
|
||||
</button>
|
||||
<p class="action-help">Sprawdzi NIP {{ application.nip }} w rejestrach i pokaże różnice między danymi zgłoszonymi a oficjalnymi.</p>
|
||||
|
||||
<div id="lookupStatus" class="lookup-status" style="display: none;"></div>
|
||||
|
||||
<div class="registry-info-box">
|
||||
<strong>Jak to działa?</strong>
|
||||
<ul>
|
||||
<li><strong>Dla spółek:</strong> NIP → Biała Lista VAT (Min. Finansów) → numer KRS → KRS Open API (Min. Sprawiedliwości) → dane firmy</li>
|
||||
<li><strong>Dla JDG:</strong> NIP → CEIDG (dane.biznes.gov.pl) → dane firmy</li>
|
||||
</ul>
|
||||
<small>KRS Open API nie obsługuje wyszukiwania po NIP, dlatego najpierw pobieramy KRS z Białej Listy VAT.</small>
|
||||
</div>
|
||||
|
||||
<div class="registry-result" id="registryResult">
|
||||
<h5 id="registryResultTitle">Dane z rejestru</h5>
|
||||
@ -797,6 +859,15 @@ const appNip = '{{ application.nip or "" }}';
|
||||
const csrfToken = '{{ csrf_token() }}';
|
||||
let registryData = null;
|
||||
|
||||
function setLookupStatus(message, type) {
|
||||
const statusEl = document.getElementById('lookupStatus');
|
||||
if (statusEl) {
|
||||
statusEl.textContent = message;
|
||||
statusEl.className = 'lookup-status ' + type;
|
||||
statusEl.style.display = message ? 'block' : 'none';
|
||||
}
|
||||
}
|
||||
|
||||
// Pobieranie danych z rejestru
|
||||
async function lookupRegistry() {
|
||||
if (!appNip) {
|
||||
@ -811,7 +882,8 @@ async function lookupRegistry() {
|
||||
const applyBtn = document.getElementById('btnApplyRegistry');
|
||||
|
||||
btn.disabled = true;
|
||||
btn.innerHTML = '<span class="loading-spinner"></span> Sprawdzam...';
|
||||
btn.innerHTML = '<span class="loading-spinner"></span> Pobieranie...';
|
||||
setLookupStatus('Sprawdzam NIP w Białej Liście VAT (Ministerstwo Finansów)...', 'loading');
|
||||
|
||||
try {
|
||||
const response = await fetch('/api/membership/lookup-nip', {
|
||||
@ -877,17 +949,25 @@ async function lookupRegistry() {
|
||||
|
||||
diffDiv.innerHTML = diffHtml || '<p>Dane zgodne z rejestrem.</p>';
|
||||
applyBtn.style.display = hasDifferences ? 'inline-flex' : 'none';
|
||||
|
||||
if (result.source === 'KRS') {
|
||||
setLookupStatus('✓ Dane pobrane z KRS Open API (Ministerstwo Sprawiedliwości)', 'success');
|
||||
} else if (result.source === 'CEIDG') {
|
||||
setLookupStatus('✓ Dane pobrane z CEIDG (jednoosobowa działalność)', 'success');
|
||||
}
|
||||
} else {
|
||||
registryData = null;
|
||||
resultDiv.classList.add('error');
|
||||
titleEl.textContent = '✗ Nie znaleziono w rejestrze';
|
||||
diffDiv.innerHTML = `<p>${result.message || 'Firma o podanym NIP nie została znaleziona w KRS ani CEIDG.'}</p>`;
|
||||
applyBtn.style.display = 'none';
|
||||
setLookupStatus('Firma nie znaleziona w KRS ani CEIDG', 'error');
|
||||
}
|
||||
} catch (e) {
|
||||
resultDiv.classList.add('active', 'error');
|
||||
titleEl.textContent = '✗ Błąd połączenia';
|
||||
diffDiv.innerHTML = '<p>Nie udało się połączyć z rejestrem. Spróbuj ponownie.</p>';
|
||||
setLookupStatus('Błąd połączenia z rejestrem', 'error');
|
||||
} finally {
|
||||
btn.disabled = false;
|
||||
btn.innerHTML = `
|
||||
|
||||
Loading…
Reference in New Issue
Block a user