diff --git a/api/setup/lookupTaxRate.cfm b/api/setup/lookupTaxRate.cfm new file mode 100644 index 0000000..2e15120 --- /dev/null +++ b/api/setup/lookupTaxRate.cfm @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + #serializeJSON(response)# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +#serializeJSON(response)# diff --git a/portal/setup-wizard.html b/portal/setup-wizard.html index 1d7eaa7..4c60bb6 100644 --- a/portal/setup-wizard.html +++ b/portal/setup-wizard.html @@ -2136,6 +2136,30 @@ `); + + // Auto-lookup tax rate based on ZIP code + if (zip && zip.length >= 5) { + lookupTaxRate(zip); + } + } + + // Lookup tax rate from ZIP code and populate the field + async function lookupTaxRate(zipCode) { + const taxInput = document.getElementById('bizTaxRate'); + if (!taxInput) return; + + try { + const resp = await fetch(`/api/setup/lookupTaxRate.cfm?zip=${encodeURIComponent(zipCode)}`); + const data = await resp.json(); + + if (data.OK && data.taxRate > 0) { + taxInput.value = data.taxRate; + taxInput.style.backgroundColor = '#f0fff4'; // Light green to indicate auto-filled + console.log('Tax rate auto-populated:', data.taxRate + '%'); + } + } catch (err) { + console.log('Tax rate lookup failed (user can enter manually):', err); + } } function confirmBusinessInfo() {