English
العربية
Azerbaijani
Català
中文
Hrvatski
Čeština
Dansk
Nederlands
English
Estonian
Persian
Français
Deutsch
עברית
Magyar
Italiano
Macedonian
Norwegian
Português
Português
Română
Русский
Српски
Español
Svenska
Türkçe
Українська
Login
Register
View Cart
Toggle navigation
Home
Store
Browse All
-----
Wordpress & Wocommerce hosting
Reseller Hosting
Dedicated serveri
KVM NVMe VPS
Cloud PBX centrala
E-mail Services
-----
Register a New Domain
Transfer Domains to Us
Announcements
Knowledgebase
Network Status
Affiliates
Contact Us
Account
Login
Register
-----
Forgot Password?
Open Ticket
Portal Home
Client Area
Support Tickets
Submit Ticket
Name
Email Address
Subject
Department
General Enquiries
Support
VPS support
Domeni
WordPress podrška
Abuse report
Priority
High
Medium
Low
Message
Attachments
Add More
Allowed File Extensions: .jpg, .gif, .jpeg, .png, .txt, .pdf (Max file size: 2MB)
Cancel
Powered by
WHMCompleteSolution
Copyright © 2025 HostArena. All Rights Reserved.
×
Close
Loading...
×
Generate Password
Please enter a number between 8 and 64 for the password length
Password Length
Generated Password
Generate new password
Copy
Provera u toku...
document.addEventListener("DOMContentLoaded", function () { const maticniField = document.querySelector("#customfield22"); // ← ISPRAVLJENO const pibField = document.querySelector("input[name='customfield[21]']"); const typeField = document.querySelector("select[name='customfield[32]']"); const companyField = document.querySelector("input[name='companyname']"); const addressField = document.querySelector("input[name='address1']"); const cityField = document.querySelector("input[name='city']"); const loader = document.getElementById("nbs-loader"); const errorBox = document.getElementById("nbs-error"); if (!maticniField) { console.log("MBR FIELD NOT FOUND!"); return; } let timer; function validatePIB(pib) { if (!/^\d10$/.test(pib)) return false; let digits = pib.split("").map(Number); let control = digits[9]; let sum = 0; for (let i = 0; i < 9; i++) { sum += digits[i] * (i + 1); } let mod = sum % 11; if (mod === 1) return false; let calc = (mod === 0) ? 0 : (11 - mod); return calc === control; } function checkPDV(pib) { fetch("aprilookup.php?pib=" + pib) .then(r => r.json()) .then(data => { if (data.obveznikPdv === true) { errorBox.style.display = "block"; errorBox.style.color = "green"; errorBox.innerText = "✔ Firma je u sistemu PDV-a"; } else { errorBox.style.display = "block"; errorBox.style.color = "#cc0000"; errorBox.innerText = "✖ Firma NIJE u sistemu PDV-a"; } }); } function setLoading(state) { if (state) { loader.style.display = "block"; companyField.disabled = true; addressField.disabled = true; cityField.disabled = true; pibField.disabled = true; } else { loader.style.display = "none"; companyField.disabled = false; addressField.disabled = false; cityField.disabled = false; pibField.disabled = false; } } function showError(msg) { errorBox.style.display = "block"; errorBox.style.color = "#cc0000"; errorBox.innerText = msg; } function clearError() { errorBox.style.display = "none"; errorBox.innerText = ""; } function lookupNBS(code) { setLoading(true); fetch("register.php?nbslookup=" + encodeURIComponent(code)) .then(r => r.json()) .then(data => { setLoading(false); if (!data["Пословно име"]) { showError("Firma nije pronađena u NBS registru."); return; } clearError(); companyField.value = data["Пословно име"] ?? ""; addressField.value = data["Адреса"] ?? ""; cityField.value = data["Место"] ?? ""; pibField.value = data["Порески број"] ?? ""; if (!validatePIB(pibField.value)) { showError("PIB nije validan prema kontrolnoj cifri!"); return; } checkPDV(pibField.value); }) .catch(err => { setLoading(false); showError("Greška pri komunikaciji sa NBS."); }); } maticniField.addEventListener("keyup", function () { clearTimeout(timer); clearError(); let type = typeField ? typeField.value : ""; if (type !== "Pravno lice") return; let code = maticniField.value.trim(); if (code.length !== 8 || !/^\d8$/.test(code)) return; timer = setTimeout(() => lookupNBS(code), 500); }); });