diff --git a/web/templates/exceptions.html b/web/templates/exceptions.html index 4bac505..198e0ed 100644 --- a/web/templates/exceptions.html +++ b/web/templates/exceptions.html @@ -214,7 +214,7 @@

Street Name Exceptions

-

Applied to county address data after formatting, before comparison and import. Match is exact (case-sensitive).

+

Applied to county address data after formatting, before comparison and import. Match is exact (case-sensitive). Leave City blank to apply everywhere.

@@ -225,11 +225,12 @@ County data (from) Corrected name (to) + City (optional) - Loading... + Loading... @@ -261,7 +262,7 @@ function renderTable() { const tbody = document.getElementById('tableBody'); if (corrections.length === 0) { - tbody.innerHTML = 'No exceptions yet. Add a row to get started.'; + tbody.innerHTML = 'No exceptions yet. Add a row to get started.'; return; } tbody.innerHTML = corrections.map((c, i) => ` @@ -270,6 +271,8 @@ oninput="corrections[${i}].from = this.value"> + `).join(''); @@ -280,7 +283,7 @@ } function addRow() { - corrections.push({ from: '', to: '' }); + corrections.push({ from: '', to: '', city: '' }); renderTable(); // Focus the new "from" input const rows = document.getElementById('tableBody').querySelectorAll('tr'); @@ -301,6 +304,7 @@ const inputs = row.querySelectorAll('input'); corrections[i].from = inputs[0].value; corrections[i].to = inputs[1].value; + corrections[i].city = inputs[2].value; }); // Validate @@ -311,10 +315,16 @@ } } + // Drop blank city so the correction applies everywhere, not nowhere + const payload = corrections.map(c => { + const { city, ...rest } = c; + return city && city.trim() ? { ...rest, city: city.trim() } : rest; + }); + fetch('/api/exceptions', { method: 'POST', headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ corrections }) + body: JSON.stringify({ corrections: payload }) }) .then(r => r.json()) .then(data => { @@ -352,7 +362,7 @@ }) .catch(err => { document.getElementById('tableBody').innerHTML = - `Failed to load: ${err.message}`; + `Failed to load: ${err.message}`; });