prevent doubles

This commit is contained in:
Oliver
2026-05-25 12:25:51 -03:00
parent 28345295b6
commit 55d6f8be7c
2 changed files with 40 additions and 4 deletions
+10 -1
View File
@@ -132,7 +132,7 @@ On mobile (< 620 px): scan input goes full-width on its own row; user dropdown a
## Key behaviours
- **On load**: cookie credentials restored → GET webhook fires → dropdown populated → scan input auto-focused
- **Enter key**: trims input, POSTs to webhook, prepends result row, clears + re-focuses input
- **Enter key**: trims input**duplicate check** POSTs to webhook, prepends result row, clears + re-focuses input
- **Clear button**: empties the table, clears the scan input, resets the scan counter
- **No user selected**: red toast + highlighted dropdown; does not submit
- **401 on any request**: modal prompts for credentials (pre-filled from cookie), saves to cookie, retries original call
@@ -140,6 +140,15 @@ On mobile (< 620 px): scan input goes full-width on its own row; user dropdown a
- **Network error**: dismissing error banner; input selected so user can retry
- **Dropdown error state**: tapping/focusing the dropdown while it shows an error re-triggers `loadUsers()`
- **NDJSON/array/object**: `parseJson()` normalises all response formats from n8n
- **Duplicate scan**: `isDuplicate(code)` queries `.col-code` cells in the live table before every POST; if found, shows a warning toast and skips the webhook call entirely
## Table columns (DOM)
| Visible | Header | CSS class | Content |
|---------|--------|-----------|---------|
| ✓ | Country | — | `item.country` wrapped in teal badge |
| ✓ | Name | `name-cell` | `item.name` |
| ✓ | Tag | — | `item.producttag` in monospace pill |
| ✗ | Code | `col-code` | Raw scanned code (`display:none`), used for duplicate detection |
## How to run
Open `index.html` directly in a browser (`file://`) — no server needed for local use.